GenericBooleanParameterpublic class GenericBooleanParameter extends Object
Fields Summary |
---|
protected static final boolean | DEBUG | GenericParameterAdapter | adapter | String | name | org.eclipse.swt.widgets.Button | checkBox | boolean | defaultValue | List | performers |
Constructors Summary |
---|
public GenericBooleanParameter(GenericParameterAdapter adapter, org.eclipse.swt.widgets.Composite composite, String name)
this(adapter, composite, name, adapter.getBooleanValue(name), null, null);
| public GenericBooleanParameter(GenericParameterAdapter adapter, org.eclipse.swt.widgets.Composite composite, String name, String textKey)
this(adapter, composite, name, adapter.getBooleanValue(name), textKey, null);
| public GenericBooleanParameter(GenericParameterAdapter adapter, org.eclipse.swt.widgets.Composite composite, String name, boolean defaultValue, String textKey)
this(adapter, composite, name, defaultValue, textKey, null);
| public GenericBooleanParameter(GenericParameterAdapter adapter, org.eclipse.swt.widgets.Composite composite, String name, boolean defaultValue)
this(adapter, composite, name, defaultValue, null, null);
| public GenericBooleanParameter(GenericParameterAdapter _adapter, org.eclipse.swt.widgets.Composite composite, String _name, boolean _defaultValue, String textKey, org.gudy.azureus2.ui.swt.config.IAdditionalActionPerformer actionPerformer)
adapter = _adapter;
name = _name;
defaultValue = _defaultValue;
if (actionPerformer != null) {
performers.add(actionPerformer);
}
boolean value = adapter.getBooleanValue(name, defaultValue);
checkBox = new Button(composite, SWT.CHECK);
if (textKey != null)
Messages.setLanguageText(checkBox, textKey);
checkBox.setSelection(value);
checkBox.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
setSelected(checkBox.getSelection(), true);
}
});
|
Methods Summary |
---|
private void | debug(java.lang.String string)
System.out.println("[GenericBooleanParameter:" + name + "] " + string);
| public org.eclipse.swt.widgets.Control | getControl()
return checkBox;
| public java.lang.String | getName()
return name;
| public boolean | isSelected()
return adapter.getBooleanValue(name);
| public void | setAdditionalActionPerformer(org.gudy.azureus2.ui.swt.config.IAdditionalActionPerformer actionPerformer)
performers.add(actionPerformer);
actionPerformer.setSelected(isSelected());
actionPerformer.performAction();
| public void | setLayoutData(java.lang.Object layoutData)
checkBox.setLayoutData(layoutData);
| public void | setName(java.lang.String newName)
name = newName;
| public void | setSelected(boolean selected)
Utils.execSWTThread(new AERunnable() {
public void runSupport() {
if (!checkBox.isDisposed()) {
if (checkBox.getSelection() != selected) {
if (DEBUG) {
debug("bool.setSelection(" + selected + ")");
}
checkBox.setSelection(selected);
}
if (DEBUG) {
debug("setBooleanValue to " + checkBox.getSelection()
+ " via setValue(int)");
}
adapter.setBooleanValue(name, checkBox.getSelection());
} else {
adapter.setBooleanValue(name, selected);
}
if (performers.size() > 0) {
for (int i = 0; i < performers.size(); i++) {
IAdditionalActionPerformer performer = (IAdditionalActionPerformer) performers.get(i);
performer.setSelected(selected);
performer.performAction();
}
}
adapter.informChanged(false);
}
});
| protected void | setSelected(boolean selected, boolean force)
if (force) {
setSelected(selected);
} else {
Utils.execSWTThread(new AERunnable() {
public void runSupport() {
if (checkBox.getSelection() != selected) {
checkBox.setSelection(selected);
}
}
});
}
|
|