new support classes added
This commit is contained in:
parent
9764f546da
commit
83e0196c50
21 changed files with 798 additions and 9 deletions
27
src/com/coder/client/property/CheckBoxProperty.java
Normal file
27
src/com/coder/client/property/CheckBoxProperty.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package com.coder.client.property;
|
||||
|
||||
import org.controlsfx.property.editor.Editors;
|
||||
import org.controlsfx.property.editor.PropertyEditor;
|
||||
|
||||
public class CheckBoxProperty extends CoderClientProperty<Boolean> {
|
||||
|
||||
public CheckBoxProperty(String name, boolean defaultValue){
|
||||
super(name, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return Boolean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyEditor<?> getEditor() {
|
||||
return Editors.createCheckEditor(this);
|
||||
}
|
||||
|
||||
}
|
||||
51
src/com/coder/client/property/CoderClientProperty.java
Normal file
51
src/com/coder/client/property/CoderClientProperty.java
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
package com.coder.client.property;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.controlsfx.control.PropertySheet;
|
||||
import org.controlsfx.property.editor.PropertyEditor;
|
||||
|
||||
public abstract class CoderClientProperty<T> implements PropertySheet.Item {
|
||||
|
||||
private String name;
|
||||
private T value;
|
||||
|
||||
public CoderClientProperty(String name, T defaultValue){
|
||||
this.name = name;
|
||||
this.value = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
this.value = (T)value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Class<? extends PropertyEditor<?>>> getPropertyEditorClass() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCategory() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public abstract PropertyEditor<?> getEditor();
|
||||
|
||||
}
|
||||
31
src/com/coder/client/property/ComboBoxProperty.java
Normal file
31
src/com/coder/client/property/ComboBoxProperty.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package com.coder.client.property;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.controlsfx.property.editor.Editors;
|
||||
import org.controlsfx.property.editor.PropertyEditor;
|
||||
|
||||
public class ComboBoxProperty extends CoderClientProperty<String> {
|
||||
private Collection<String> valueAlternatives;
|
||||
|
||||
public ComboBoxProperty(String name, String defaultValue, Collection<String> valueAlternatives){
|
||||
super(name, defaultValue);
|
||||
this.valueAlternatives = valueAlternatives;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return valueAlternatives.getClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyEditor<?> getEditor() {
|
||||
return Editors.createChoiceEditor(this, valueAlternatives);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue