Search in sources :

Example 1 with JCommandButtonStrip

use of org.pushingpixels.flamingo.api.common.JCommandButtonStrip in project gephi by gephi.

the class DataTableTopComponent method prepareAddColumnButton.

/**
     * Create the special Add new column button.
     */
private void prepareAddColumnButton() {
    JCommandButtonStrip strip = new JCommandButtonStrip(JCommandButtonStrip.StripOrientation.HORIZONTAL);
    strip.setDisplayState(CommandButtonDisplayState.BIG);
    JCommandButton button = new JCommandButton(NbBundle.getMessage(DataTableTopComponent.class, "DataTableTopComponent.addColumnButton.text"), ImageWrapperResizableIcon.getIcon(ImageUtilities.loadImage("org/gephi/desktop/datalab/resources/table-insert-column.png", true), new Dimension(16, 16)));
    button.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_ONLY);
    button.setDisplayState(CommandButtonDisplayState.BIG);
    if (isShowingNodesTable()) {
        button.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                showAddColumnUI(AddColumnUI.Mode.NODES_TABLE);
            }
        });
    } else {
        button.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                showAddColumnUI(AddColumnUI.Mode.EDGES_TABLE);
            }
        });
    }
    strip.add(button);
    columnManipulatorsPanel.add(strip);
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JCommandButton(org.pushingpixels.flamingo.api.common.JCommandButton) Dimension(java.awt.Dimension) JCommandButtonStrip(org.pushingpixels.flamingo.api.common.JCommandButtonStrip)

Example 2 with JCommandButtonStrip

use of org.pushingpixels.flamingo.api.common.JCommandButtonStrip in project gephi by gephi.

the class DataTableTopComponent method prepareMergeColumnsButton.

/**
     * Create the special merge columns button.
     */
private void prepareMergeColumnsButton() {
    JCommandButtonStrip strip = new JCommandButtonStrip(JCommandButtonStrip.StripOrientation.HORIZONTAL);
    strip.setDisplayState(CommandButtonDisplayState.BIG);
    JCommandButton button = new JCommandButton(NbBundle.getMessage(DataTableTopComponent.class, "DataTableTopComponent.mergeColumnsButton.text"), ImageWrapperResizableIcon.getIcon(ImageUtilities.loadImage("org/gephi/desktop/datalab/resources/merge.png", true), new Dimension(16, 16)));
    button.setCommandButtonKind(JCommandButton.CommandButtonKind.ACTION_ONLY);
    button.setDisplayState(CommandButtonDisplayState.BIG);
    if (isShowingNodesTable()) {
        button.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                showMergeColumnsUI(MergeColumnsUI.Mode.NODES_TABLE);
            }
        });
    } else {
        button.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                showMergeColumnsUI(MergeColumnsUI.Mode.EDGES_TABLE);
            }
        });
    }
    strip.add(button);
    columnManipulatorsPanel.add(strip);
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JCommandButton(org.pushingpixels.flamingo.api.common.JCommandButton) Dimension(java.awt.Dimension) JCommandButtonStrip(org.pushingpixels.flamingo.api.common.JCommandButtonStrip)

Example 3 with JCommandButtonStrip

use of org.pushingpixels.flamingo.api.common.JCommandButtonStrip in project gephi by gephi.

the class DataTableTopComponent method prepareColumnManipulatorsButtons.

/**
     * Creates the buttons that call the AttributeColumnManipulators.
     */
private void prepareColumnManipulatorsButtons() {
    Table table;
    Column[] columns;
    if (isShowingNodesTable()) {
        table = graphModel.getNodeTable();
    } else {
        table = graphModel.getEdgeTable();
    }
    columns = getTableAvailableColumnsModel(table).getAvailableColumns();
    DataLaboratoryHelper dlh = DataLaboratoryHelper.getDefault();
    AttributeColumnsManipulator[] manipulators = dlh.getAttributeColumnsManipulators();
    JCommandButtonStrip currentButtonGroup = new JCommandButtonStrip(JCommandButtonStrip.StripOrientation.HORIZONTAL);
    currentButtonGroup.setDisplayState(CommandButtonDisplayState.BIG);
    Integer lastManipulatorType = null;
    for (AttributeColumnsManipulator acm : manipulators) {
        if (lastManipulatorType == null) {
            lastManipulatorType = acm.getType();
        }
        if (lastManipulatorType != acm.getType()) {
            columnManipulatorsPanel.add(currentButtonGroup);
            currentButtonGroup = new JCommandButtonStrip(JCommandButtonStrip.StripOrientation.HORIZONTAL);
            currentButtonGroup.setDisplayState(CommandButtonDisplayState.BIG);
        }
        lastManipulatorType = acm.getType();
        currentButtonGroup.add(prepareJCommandButton(graphModel, table, columns, acm));
    }
    columnManipulatorsPanel.add(currentButtonGroup);
}
Also used : DataLaboratoryHelper(org.gephi.datalab.api.DataLaboratoryHelper) NodesDataTable(org.gephi.desktop.datalab.tables.NodesDataTable) Table(org.gephi.graph.api.Table) EdgesDataTable(org.gephi.desktop.datalab.tables.EdgesDataTable) Column(org.gephi.graph.api.Column) AttributeColumnsManipulator(org.gephi.datalab.spi.columns.AttributeColumnsManipulator) JCommandButtonStrip(org.pushingpixels.flamingo.api.common.JCommandButtonStrip)

Aggregations

JCommandButtonStrip (org.pushingpixels.flamingo.api.common.JCommandButtonStrip)3 Dimension (java.awt.Dimension)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 JCommandButton (org.pushingpixels.flamingo.api.common.JCommandButton)2 DataLaboratoryHelper (org.gephi.datalab.api.DataLaboratoryHelper)1 AttributeColumnsManipulator (org.gephi.datalab.spi.columns.AttributeColumnsManipulator)1 EdgesDataTable (org.gephi.desktop.datalab.tables.EdgesDataTable)1 NodesDataTable (org.gephi.desktop.datalab.tables.NodesDataTable)1 Column (org.gephi.graph.api.Column)1 Table (org.gephi.graph.api.Table)1