Search in sources :

Example 11 with SourceColumnSemantic

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"));
    }
}
Also used : SourceColumnSemantic(org.cytoscape.tableimport.internal.util.SourceColumnSemantic) AttributeDataType(org.cytoscape.tableimport.internal.util.AttributeDataType) JToggleButton(javax.swing.JToggleButton)

Example 12 with SourceColumnSemantic

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))));
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SourceColumnSemantic(org.cytoscape.tableimport.internal.util.SourceColumnSemantic) JToggleButton(javax.swing.JToggleButton) ButtonGroup(javax.swing.ButtonGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) ArrayList(java.util.ArrayList) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Example 13 with SourceColumnSemantic

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));
    }
}
Also used : SourceColumnSemantic(org.cytoscape.tableimport.internal.util.SourceColumnSemantic) AttributeDataType(org.cytoscape.tableimport.internal.util.AttributeDataType) JToggleButton(javax.swing.JToggleButton)

Aggregations

SourceColumnSemantic (org.cytoscape.tableimport.internal.util.SourceColumnSemantic)13 AttributeDataType (org.cytoscape.tableimport.internal.util.AttributeDataType)8 ArrayList (java.util.ArrayList)4 JToggleButton (javax.swing.JToggleButton)3 IOException (java.io.IOException)2 InvalidFormatException (org.apache.poi.openxml4j.exceptions.InvalidFormatException)2 Sheet (org.apache.poi.ss.usermodel.Sheet)2 Workbook (org.apache.poi.ss.usermodel.Workbook)2 AttributeMappingParameters (org.cytoscape.tableimport.internal.reader.AttributeMappingParameters)2 NetworkTableMappingParameters (org.cytoscape.tableimport.internal.reader.NetworkTableMappingParameters)2 Window (java.awt.Window)1 ActionEvent (java.awt.event.ActionEvent)1 WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 WindowFocusListener (java.awt.event.WindowFocusListener)1 IndexedPropertyChangeEvent (java.beans.IndexedPropertyChangeEvent)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 FileInputStream (java.io.FileInputStream)1 AbstractAction (javax.swing.AbstractAction)1