use of javax.swing.DefaultCellEditor in project ramus by Vitaliy-Yakovchuk.
the class TableCellEditorFactory method createFontTypeEditor.
private TableCellEditor createFontTypeEditor() {
JComboBox box = new JComboBox();
box.addItem(null);
box.addItem(BOLD);
box.addItem(ITALIC);
box.addItem(BOLD_ITALIC);
return new DefaultCellEditor(box);
}
use of javax.swing.DefaultCellEditor in project ramus by Vitaliy-Yakovchuk.
the class TableCellEditorFactory method createBaseQualifierEditor.
private TableCellEditor createBaseQualifierEditor() {
List<Qualifier> qualifiers = engine.getQualifiers();
Collections.sort(qualifiers, new Comparator<Qualifier>() {
@Override
public int compare(Qualifier o1, Qualifier o2) {
return collator.compare(o1.getName(), o2.getName());
}
});
JComboBox box = new JComboBox();
box.addItem(null);
for (Qualifier qualifier : qualifiers) box.addItem(qualifier);
return new DefaultCellEditor(box);
}
use of javax.swing.DefaultCellEditor in project ramus by Vitaliy-Yakovchuk.
the class TableCellEditorFactory method createTextAligmentEditor.
private TableCellEditor createTextAligmentEditor() {
JComboBox box = new JComboBox();
box.addItem(null);
box.addItem(LEFT);
box.addItem(CENTER);
box.addItem(RIGHT);
box.addItem(JUSTIFY);
return new DefaultCellEditor(box);
}
use of javax.swing.DefaultCellEditor in project ramus by Vitaliy-Yakovchuk.
the class TableCellEditorFactory method createFontEditor.
private TableCellEditor createFontEditor() {
JComboBox box = new JComboBox();
box.addItem(null);
for (String name : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) box.addItem(name);
return new DefaultCellEditor(box);
}
use of javax.swing.DefaultCellEditor in project felix-dev by apache.
the class SliderEditor method setData.
public void setData(UPnPAction action) {
table.deleteMyCellEditors();
String[] names = action.getInputArgumentNames();
size = 0;
this.names = names;
if (names != null) {
values = new String[names.length];
related = new String[names.length];
types = new String[names.length];
for (int i = 0; i < names.length; i++) {
values[i] = "";
UPnPStateVariable currentStateVar = action.getStateVariable(names[i]);
related[i] = currentStateVar.getName();
String javaType = currentStateVar.getJavaDataType().toString();
javaType = javaType.substring(javaType.lastIndexOf('.') + 1);
String upnpType = currentStateVar.getUPnPDataType();
types[i] = javaType + " \\ " + upnpType;
// handle allowed value list
if (currentStateVar.getAllowedValues() != null) {
String[] av = currentStateVar.getAllowedValues();
JComboBox comboBox = new JComboBox();
for (int j = 0; j < av.length; j++) {
comboBox.addItem(av[j]);
}
// preset the first value from list
values[i] = av[0];
table.setMyCellEditor(new DefaultCellEditor(comboBox), i);
}
// handle default value
if (currentStateVar.getDefaultValue() != null) {
String val = currentStateVar.getDefaultValue().toString();
if (val.length() > 0)
values[i] = val;
}
// handle range values
if ((currentStateVar.getMaximum() != null) && (currentStateVar.getMinimum() != null)) {
int max = currentStateVar.getMaximum().intValue();
int min = currentStateVar.getMinimum().intValue();
int value = min;
try {
value = Integer.parseInt(values[i]);
} catch (NumberFormatException ignored) {
}
table.setMyCellEditor(new SliderEditor(min, max, value), i);
}
}
size = names.length;
}
this.fireTableChanged(new TableModelEvent(this));
this.fireTableStructureChanged();
}
Aggregations