use of javax.swing.DefaultCellEditor in project omero-insight by ome.
the class OMETreeTable method setDefaultEditors.
/**
* Sets the default editors for the cells in the table. This includes
* editors for cells containing: int, long, string, booleans,
* floats, longs, doubles.
*/
protected void setDefaultEditors() {
Iterator<Class<?>> classIterator = DEFAULT_EDITORS.keySet().iterator();
Class<?> classType;
DefaultCellEditor editorType;
while (classIterator.hasNext()) {
classType = classIterator.next();
editorType = DEFAULT_EDITORS.get(classType);
this.setDefaultEditor(classType, editorType);
}
}
use of javax.swing.DefaultCellEditor in project zaproxy by zaproxy.
the class HttpPanelParamTableView method initAddins.
private void initAddins() {
// Get all addins
addins = new LinkedList<>();
addins.add(new ParamAddinMagic());
addins.add(new ParamAddinUrlencode());
comboBoxAddIns = new JComboBox<>();
comboBoxAddIns.addItem(ADD_INS);
for (ParamAddinInterface addin : addins) {
comboBoxAddIns.addItem(addin);
}
comboBoxAddIns.addActionListener(new ComboBoxAddinsActionListener());
table.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(getComboBoxTypes()));
table.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
if (table.getColumnCount() != 4) {
return;
}
table.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(comboBoxAddIns));
table.getColumnModel().getColumn(3).setCellRenderer(new ComboBoxCellRenderer(comboBoxAddIns));
}
use of javax.swing.DefaultCellEditor in project zaproxy by zaproxy.
the class HttpPanelParamTableView method setEditable.
@Override
public void setEditable(boolean editable) {
if (isEditable != editable) {
if (isEditable) {
table.getColumnModel().removeColumn(table.getColumnModel().getColumn(3));
} else {
TableColumn column = new TableColumn(3, 150, new ComboBoxCellRenderer(comboBoxAddIns), new DefaultCellEditor(comboBoxAddIns));
column.setPreferredWidth(150);
column.setMaxWidth(150);
table.addColumn(column);
}
isEditable = editable;
httpPanelTabularModel.setEditable(editable);
}
}
use of javax.swing.DefaultCellEditor in project vcell by virtualcell.
the class StructureMappingTableModel method updateSubdomainComboBox.
@SuppressWarnings({ "rawtypes", "unchecked" })
private void updateSubdomainComboBox() {
GeometryClass[] geometryClasses = getGeometryContext().getGeometry().getGeometryClasses();
DefaultComboBoxModel aModel = new DefaultComboBoxModel();
for (GeometryClass gc : geometryClasses) {
aModel.addElement(gc);
}
JComboBox subdomainComboBoxCellEditor = new JComboBox();
subdomainComboBoxCellEditor.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
setHorizontalTextPosition(SwingConstants.LEFT);
if (value instanceof GeometryClass) {
GeometryClass gc = (GeometryClass) value;
setText(gc.getName());
if (value instanceof SubVolume) {
SubVolume subVolume = (SubVolume) value;
java.awt.Color handleColor = new java.awt.Color(colormap[subVolume.getHandle()]);
// small square icon with subdomain color
Icon icon = new ColorIcon(10, 10, handleColor, true);
setHorizontalTextPosition(SwingConstants.RIGHT);
setIcon(icon);
} else if (value instanceof SurfaceClass) {
SurfaceClass sc = (SurfaceClass) value;
Set<SubVolume> sv = sc.getAdjacentSubvolumes();
Iterator<SubVolume> iterator = sv.iterator();
SubVolume sv1 = iterator.next();
SubVolume sv2 = iterator.next();
java.awt.Color c1 = new java.awt.Color(colormap[sv2.getHandle()]);
java.awt.Color c2 = new java.awt.Color(colormap[sv1.getHandle()]);
Icon icon = new ColorIconEx(10, 10, c1, c2);
setIcon(icon);
setHorizontalTextPosition(SwingConstants.RIGHT);
}
}
return this;
}
});
subdomainComboBoxCellEditor.setModel(aModel);
ownerTable.getColumnModel().getColumn(SPATIAL_COLUMN_SUBDOMAIN).setCellEditor(new DefaultCellEditor(subdomainComboBoxCellEditor));
}
use of javax.swing.DefaultCellEditor in project knime-core by knime.
the class OutFieldsTable method createFieldTypeCellEditor.
// CELL EDITORS
/**
* Create cell editor for for the input columns / flow variables.
* @return an editor for the type field
*/
protected TableCellEditor createFieldTypeCellEditor() {
JComboBox<FieldType> comboBox = new JComboBox<FieldType>();
comboBox.addItem(FieldType.Column);
comboBox.addItem(FieldType.FlowVariable);
DefaultCellEditor editor = new DefaultCellEditor(comboBox);
editor.setClickCountToStart(2);
return editor;
}
Aggregations