mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 03:50:19 +02:00
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@127 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
5ed4b6c5c0
commit
58da4c45a1
15 changed files with 46 additions and 43 deletions
|
@ -43,8 +43,8 @@ public final class ZLBoolean3Option extends ZLSimpleOption {
|
|||
}
|
||||
}
|
||||
|
||||
public ZLBoolean3Option(ZLConfig config, String category, String group, String optionName, ZLBoolean3 defaultValue){
|
||||
super(config, category, group, optionName);
|
||||
public ZLBoolean3Option(String category, String group, String optionName, ZLBoolean3 defaultValue){
|
||||
super(category, group, optionName);
|
||||
myDefaultValue = defaultValue;
|
||||
myValue = myDefaultValue;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ public final class ZLBooleanOption extends ZLSimpleOption {
|
|||
}
|
||||
}
|
||||
|
||||
public ZLBooleanOption (ZLConfig config, String category, String group, String optionName, boolean defaultValue){
|
||||
super(config, category, group, optionName);
|
||||
public ZLBooleanOption (String category, String group, String optionName, boolean defaultValue){
|
||||
super(category, group, optionName);
|
||||
myDefaultValue = defaultValue;
|
||||
myValue = myDefaultValue;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public final class ZLColorOption extends ZLOption {
|
|||
}
|
||||
}
|
||||
|
||||
public ZLColorOption (ZLConfig config, String category, String group, String optionName, ZLColor defaultValue){
|
||||
super(config, category, group, optionName);
|
||||
public ZLColorOption (String category, String group, String optionName, ZLColor defaultValue){
|
||||
super(category, group, optionName);
|
||||
myDefaultValue = defaultValue.getIntValue();
|
||||
myIntValue = myDefaultValue;
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ public final class ZLDoubleOption extends ZLOption{
|
|||
}
|
||||
}
|
||||
|
||||
public ZLDoubleOption (ZLConfig config, String category, String group, String optionName, double defaultValue){
|
||||
super(config, category, group, optionName);
|
||||
public ZLDoubleOption (String category, String group, String optionName, double defaultValue){
|
||||
super(category, group, optionName);
|
||||
myDefaultValue = defaultValue;
|
||||
myValue = myDefaultValue;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ public final class ZLIntegerOption extends ZLOption{
|
|||
}
|
||||
}
|
||||
|
||||
public ZLIntegerOption (ZLConfig config, String category, String group, String optionName, long defaultValue){
|
||||
super(config, category, group, optionName);
|
||||
public ZLIntegerOption (String category, String group, String optionName, long defaultValue){
|
||||
super(category, group, optionName);
|
||||
myDefaultValue = defaultValue;
|
||||
myValue = myDefaultValue;
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ public final class ZLIntegerRangeOption extends ZLOption {
|
|||
}
|
||||
}
|
||||
|
||||
public ZLIntegerRangeOption (ZLConfig config, String category, String group, String optionName, long minValue, long maxValue, long defaultValue){
|
||||
super(config, category, group, optionName);
|
||||
public ZLIntegerRangeOption (String category, String group, String optionName, long minValue, long maxValue, long defaultValue){
|
||||
super(category, group, optionName);
|
||||
myMinValue = minValue;
|
||||
myMaxValue = maxValue;
|
||||
//страхуемся от ошибки программиста =)
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package org.zlibrary.options;
|
||||
|
||||
import org.zlibrary.options.config.ZLConfigInstance;
|
||||
|
||||
public abstract class ZLOption {
|
||||
public static final String LOOK_AND_FEEL_CATEGORY = "ui";
|
||||
public static final String CONFIG_CATEGORY = "options";
|
||||
public static final String STATE_CATEGORY = "state";
|
||||
|
||||
protected ZLConfig myConfig;
|
||||
protected ZLConfig myConfig = ZLConfigInstance.getInstance();
|
||||
protected String myCategory;
|
||||
protected String myGroup;
|
||||
protected String myOptionName;
|
||||
|
@ -19,11 +21,10 @@ public abstract class ZLOption {
|
|||
* @param group
|
||||
* @param optionName
|
||||
*/
|
||||
protected ZLOption (ZLConfig config, String category, String group, String optionName){
|
||||
protected ZLOption (String category, String group, String optionName){
|
||||
myCategory = category;
|
||||
myGroup = group;
|
||||
myOptionName = optionName;
|
||||
myConfig = config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ abstract class ZLSimpleOption extends ZLOption {
|
|||
* конструктор. создается так же как и любая опция
|
||||
* @see ZLOption
|
||||
*/
|
||||
public ZLSimpleOption(ZLConfig config, String category, String group, String optionName){
|
||||
super(config, category, group, optionName);
|
||||
public ZLSimpleOption(String category, String group, String optionName){
|
||||
super(category, group, optionName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ public final class ZLStringOption extends ZLSimpleOption {
|
|||
private String myValue;
|
||||
private String myDefaultValue;
|
||||
|
||||
public ZLStringOption(ZLConfig config, String category, String group, String optionName, String defaultValue){
|
||||
super(config, category, group, optionName);
|
||||
public ZLStringOption(String category, String group, String optionName, String defaultValue){
|
||||
super(category, group, optionName);
|
||||
myDefaultValue = defaultValue;
|
||||
myValue = myDefaultValue;
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
package org.zlibrary.options.config;
|
||||
|
||||
public class ZLConfigFactory {
|
||||
public static ZLConfigImpl createConfig(){
|
||||
return new ZLConfigImpl();
|
||||
}
|
||||
}
|
10
src/org/zlibrary/options/config/ZLConfigInstance.java
Normal file
10
src/org/zlibrary/options/config/ZLConfigInstance.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package org.zlibrary.options.config;
|
||||
|
||||
public class ZLConfigInstance {
|
||||
|
||||
private static final ZLConfigImpl myConfig = new ZLConfigImpl();
|
||||
|
||||
public static ZLConfigImpl getInstance(){
|
||||
return myConfig;
|
||||
}
|
||||
}
|
|
@ -8,11 +8,11 @@ import org.xml.sax.helpers.*;
|
|||
import org.zlibrary.options.ZLConfig;
|
||||
import org.zlibrary.options.config.*;
|
||||
|
||||
/*package*/ class ZLConfigReader implements ZLReadable{
|
||||
/*package*/ class ZLConfigReader implements ZLReader{
|
||||
|
||||
|
||||
private XMLReader myXMLReader;
|
||||
private ZLConfig myConfig = ZLConfigFactory.createConfig();
|
||||
private ZLConfig myConfig;
|
||||
private String myCategory = "";
|
||||
|
||||
private class ConfigContentHandler extends DefaultHandler{
|
||||
|
@ -59,15 +59,16 @@ import org.zlibrary.options.config.*;
|
|||
}
|
||||
|
||||
public ZLConfigReader () {
|
||||
myConfig = ZLConfigInstance.getInstance();
|
||||
try {
|
||||
myXMLReader = XMLReaderFactory.createXMLReader();
|
||||
myXMLReader.setContentHandler(new ConfigContentHandler());
|
||||
} catch (SAXException e) {
|
||||
System.err.println(e.getMessage());
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** Ďđî÷čňŕňü äŕííűĺ čç ďîňîęŕ â XML */
|
||||
/** Ïðî÷èòàòü äàííûå èç ôàéëà XML */
|
||||
public ZLConfig readFile (File file) {
|
||||
try {
|
||||
InputStream input = new FileInputStream(file);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.zlibrary.options.config.reader;
|
||||
|
||||
public class ZLConfigReaderFactory {
|
||||
public ZLReadable createConfigReader(){
|
||||
public ZLReader createConfigReader(){
|
||||
return new ZLConfigReader();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,6 @@ import java.io.File;
|
|||
|
||||
import org.zlibrary.options.ZLConfig;
|
||||
|
||||
public interface ZLReadable {
|
||||
public interface ZLReader {
|
||||
public ZLConfig readFile(File file);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue