use of org.cytoscape.tableimport.internal.util.SourceColumnSemantic in project cytoscape-impl by cytoscape.
the class AttributeEditorPanel method updateTypeButtons.
private void updateTypeButtons() {
final AttributeDataType dataType = getAttributeDataType();
for (Entry<SourceColumnSemantic, JToggleButton> entry : typeButtons.entrySet()) {
final SourceColumnSemantic type = entry.getKey();
final JToggleButton btn = entry.getValue();
btn.setEnabled(TypeUtil.isValid(type, dataType));
btn.setForeground(btn.isEnabled() ? type.getForeground() : UIManager.getColor("Button.disabledForeground"));
}
}
use of org.cytoscape.tableimport.internal.util.SourceColumnSemantic in project cytoscape-impl by cytoscape.
the class AttributeEditorPanel method initComponents.
private void initComponents() {
listDelimiterLabel = new JLabel("List Delimiter:");
listDelimiterLabel.putClientProperty("JComponent.sizeVariant", "small");
typeButtonGroup = new ButtonGroup();
dataTypeButtonGroup = new ButtonGroup();
final List<JToggleButton> dataTypeBtnList = new ArrayList<>();
dataTypeBtnList.add(stringButton = createDataTypeButton(TYPE_STRING));
dataTypeBtnList.add(integerButton = createDataTypeButton(TYPE_INTEGER));
dataTypeBtnList.add(longButton = createDataTypeButton(TYPE_LONG));
dataTypeBtnList.add(floatingPointButton = createDataTypeButton(TYPE_FLOATING));
dataTypeBtnList.add(booleanButton = createDataTypeButton(TYPE_BOOLEAN));
dataTypeBtnList.add(stringListButton = createDataTypeButton(TYPE_STRING_LIST));
dataTypeBtnList.add(integerListButton = createDataTypeButton(TYPE_INTEGER_LIST));
dataTypeBtnList.add(longListButton = createDataTypeButton(TYPE_LONG_LIST));
dataTypeBtnList.add(floatingPointListButton = createDataTypeButton(TYPE_FLOATING_LIST));
dataTypeBtnList.add(booleanListButton = createDataTypeButton(TYPE_BOOLEAN_LIST));
setStyles(dataTypeBtnList);
final GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(false);
final SequentialGroup typeHGroup = layout.createSequentialGroup();
final ParallelGroup typeVGroup = layout.createParallelGroup(CENTER, false);
for (SourceColumnSemantic type : availableTypes) {
final JToggleButton btn = createTypeButton(type);
typeHGroup.addComponent(btn, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
typeVGroup.addComponent(btn);
}
setStyles(new ArrayList<JToggleButton>(typeButtons.values()));
final JLabel typeLabel = new JLabel("Meaning:");
typeLabel.putClientProperty("JComponent.sizeVariant", "small");
final JLabel dataTypeLabel = new JLabel("Data Type:");
dataTypeLabel.putClientProperty("JComponent.sizeVariant", "small");
layout.setHorizontalGroup(layout.createParallelGroup(CENTER, true).addComponent(getAttributeNameTextField(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(typeLabel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(typeHGroup).addComponent(dataTypeLabel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(stringButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(integerButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(longButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(floatingPointButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(booleanButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addComponent(stringListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(integerListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(longListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(floatingPointListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(booleanListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addComponent(listDelimiterLabel).addPreferredGap(ComponentPlacement.RELATED).addComponent(getListDelimiterComboBox(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getOtherTextField(), 12, 36, Short.MAX_VALUE)));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(getAttributeNameTextField(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(typeLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addGroup(typeVGroup).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(dataTypeLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(CENTER).addComponent(stringButton).addComponent(integerButton).addComponent(longButton).addComponent(floatingPointButton).addComponent(booleanButton)).addGroup(layout.createParallelGroup(CENTER).addComponent(stringListButton).addComponent(integerListButton).addComponent(longListButton).addComponent(floatingPointListButton).addComponent(booleanListButton)).addGroup(layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(CENTER).addComponent(listDelimiterLabel).addComponent(getListDelimiterComboBox(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getOtherTextField(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE))));
}
use of org.cytoscape.tableimport.internal.util.SourceColumnSemantic in project cytoscape-impl by cytoscape.
the class AttributeEditorPanel method updateDataTypeButtons.
private void updateDataTypeButtons() {
final SourceColumnSemantic type = getAttributeType();
for (Entry<AttributeDataType, JToggleButton> entry : dataTypeButtons.entrySet()) {
final AttributeDataType dataType = entry.getKey();
final JToggleButton btn = entry.getValue();
btn.setEnabled(TypeUtil.isValid(type, dataType));
}
}
Aggregations