📄 defaultcategory.java
字号:
} catch (Exception e) {
return defaultValue;
}
}
}
/**
* Helper method to allow for strong-binding within Properties.
*
* @since 2.2
* @param name
* @param value
*/
public void setBooleanProperty(String name, boolean value) {
Boolean bool = new Boolean(value);
setProperty(name, bool.toString());
}
/**
* Helper method to allow for strong-binding within Properties.
*
* @since 2.2
* @param name The name of the property
* @param defaultValue The default value
* @return If the String value can be converted to Boolean, the
* value will be return, otherwise the the default value.
*/
public char getCharProperty(String name, char defaultValue) {
String value = properties.getProperty(name);
if (value == null) {
return defaultValue;
} else {
String subValue = vm.replaceVariables(value,getConfigurationName());
if (subValue.length() == 1) {
return subValue.charAt(0);
} else {
return defaultValue;
}
}
}
/**
* Helper method to allow for strong-binding within Properties.
*
* @since 2.2
* @param string
* @param c
*/
public void setCharProperty(String key, char value) {
Character temp = new Character(value);
setProperty(key, temp.toString());
}
/**
* Helper method to allow for strong-binding within Properties.
*
* @since 2.2
* @param name The name of the property
* @param defaultValue The default value
* @return If the String value can be converted to Boolean, the
* value will be return, otherwise the the default value.
*/
public double getDoubleProperty(String name, double defaultValue) {
String value = properties.getProperty(name);
if (value == null) {
return defaultValue;
} else {
try {
return Double.parseDouble(vm.replaceVariables(value,getConfigurationName()));
} catch (Exception e) {
return defaultValue;
}
}
}
/**
* Helper method to allow for strong-binding within Properties.
* <br/>
* This method does not support any kind of inheritance! Use the
* configuration.getIntProperty method instead
*
* @since 2.2
* @param name The name of the property
* @param defaultValue The default value
* @return If the String value can be converted to Boolean, the
* value will be return, otherwise the the default value.
*/
public int getIntProperty(String name, int defaultValue) {
String value = properties.getProperty(name);
if (value == null) {
return defaultValue;
} else {
try {
return Integer.parseInt(vm.replaceVariables(value,getConfigurationName()));
} catch (NumberFormatException nfe) {
return defaultValue;
}
}
}
/**
* Helper method to allow for strong-binding within Properties.
*
* @since 2.2
* @param string
* @param i
*/
public void setIntProperty(String key, int value) {
Integer temp = new Integer(value);
setProperty(key, temp.toString());
}
/**
* Helper method to allow for strong-binding within Properties.
* <br/>
* This method does not support any kind of inheritance! Use the
* configuration.getIntProperty method instead
*
* @since 2.2
* @param name The name of the property
* @param defaultValue The default value
* @return If the String value can be converted to Boolean, the
* value will be return, otherwise the the default value.
*/
public long getLongProperty(String name, long defaultValue) {
String value = (String)properties.get(name);
value = getProperty(name);
if (value == null) {
return defaultValue;
} else {
try {
return Long.parseLong(vm.replaceVariables(value,getConfigurationName()));
} catch (Exception e) {
return defaultValue;
}
}
}
/**
* Helper method to allow for strong-binding within Properties.
*
* @since 2.2
* @param string
* @param l
*/
public void setLongProperty(String key, long value) {
Long temp = new Long(value);
setProperty(key, temp.toString());
}
/**
* Getter for property configurationName.
*
* @since 2.2
* @return Value of property configurationName.
*
*/
public String getConfigurationName() {
return configurationName;
}
/**
* Setter for property configurationName.
*
* @since 2.2
* @param configurationName New value of property configurationName.
*
*/
public void setConfigurationName(String configurationName) {
this.configurationName = configurationName;
}
/**
* Helper method to allow for strong-binding within Properties.
*
* @since 2.2
* @param key
* @param value
*/
public void setDoubleProperty(String key, double value) {
Double temp = new Double(value);
setProperty(key, temp.toString());
}
/**
* Adds the given listener to the list that wish to receive the
* {@link org.jconfig.event.PropertyChangedEvent PropertyChangedEvent}.
*
* @since 2.2
* @param listener
*/
public void addPropertyListener( PropertyListener listener ) {
listenerList.add( PropertyListener.class, listener );
}
/**
* Removes the given listener to the list that wish to receive the
* {@link org.jconfig.event.PropertyChangedEvent PropertyChangedEvent}.
*
* @since 2.2
* @param listener
*/
public void removePropertyListener( PropertyListener listener ) {
listenerList.remove( PropertyListener.class, listener );
}
/**
* Notifies all {@link PropertyListener PropertyListeners} of changes
* to the property (added, removed, changed).
*
* @param event
*/
public void firePropertyChangedEvent(PropertyChangedEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == PropertyListener.class) {
// Lazily create the event:
((PropertyListener) listeners[i + 1]).propertyChanged(event);
}
}
fireCategoryChangedEvent((CategoryChangedEvent)event);
}
public void setExtendsCategory(String extendsCategory) {
this.extendsCategory = extendsCategory;
}
public String getExtendsCategory() {
return extendsCategory;
}
public void renameCategory(String newName) {
name = newName;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -