Search in sources :

Example 1 with SelectionListener

use of com.ramussoft.gui.qualifier.table.event.SelectionListener in project ramus by Vitaliy-Yakovchuk.

the class QualifierHistoryPlugin method getHistoryAction.

private Action getHistoryAction(final TableTabView tableView) {
    Action res = (Action) tableView.getTag().get("HistoryAction");
    if (res == null) {
        final Action action = new AbstractAction() {

            /**
             */
            private static final long serialVersionUID = 6587512715104944731L;

            {
                putValue(ACTION_COMMAND_KEY, "Action.ShowHistory");
                putValue(SMALL_ICON, new ImageIcon(getClass().getResource("/com/ramussoft/gui/table/history.png")));
                setEnabled(false);
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                RowTreeTable table = tableView.getComponent().getTable();
                Row row;
                if ((table.getSelectedColumn() >= 0) && (table.getSelectedNode() != null) && ((row = table.getSelectedNode().getRow()) != null)) {
                    int c = table.convertColumnIndexToModel(table.getSelectedColumn());
                    Attribute attribute = table.getRowSet().getAttributes()[c];
                    showHistory(tableView, row.getElement(), attribute);
                }
            }
        };
        res = action;
        tableView.getTag().put("HistoryAction", res);
        tableView.getComponent().getTable().addSelectionListener(new SelectionListener() {

            @Override
            public void changeSelection(SelectionEvent event) {
                RowTreeTable table = tableView.getComponent().getTable();
                Row row;
                if ((table.getSelectedColumn() >= 0) && (table.getSelectedNode() != null) && ((row = table.getSelectedNode().getRow()) != null)) {
                    int c = table.convertColumnIndexToModel(table.getSelectedColumn());
                    Attribute attribute = table.getRowSet().getAttributes()[c];
                    action.setEnabled(StandardAttributesPlugin.hasHistory(tableView.getFramework().getEngine(), row.getElement(), attribute));
                } else {
                    action.setEnabled(false);
                }
            }
        });
    }
    return res;
}
Also used : ImageIcon(javax.swing.ImageIcon) Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) Attribute(com.ramussoft.common.Attribute) ActionEvent(java.awt.event.ActionEvent) SelectionEvent(com.ramussoft.gui.qualifier.table.event.SelectionEvent) Row(com.ramussoft.database.common.Row) RowTreeTable(com.ramussoft.gui.qualifier.table.RowTreeTable) AbstractAction(javax.swing.AbstractAction) SelectionListener(com.ramussoft.gui.qualifier.table.event.SelectionListener)

Example 2 with SelectionListener

use of com.ramussoft.gui.qualifier.table.event.SelectionListener in project ramus by Vitaliy-Yakovchuk.

the class TableView method createComponent.

@Override
public JComponent createComponent() {
    JComponent res = super.createComponent();
    component.getTable().addSelectionListener(new SelectionListener() {

        @Override
        public void changeSelection(SelectionEvent event) {
            TableView.this.tableSelectedValueChanged();
        }
    });
    return res;
}
Also used : JComponent(javax.swing.JComponent) SelectionEvent(com.ramussoft.gui.qualifier.table.event.SelectionEvent) SelectionListener(com.ramussoft.gui.qualifier.table.event.SelectionListener)

Example 3 with SelectionListener

use of com.ramussoft.gui.qualifier.table.event.SelectionListener in project ramus by Vitaliy-Yakovchuk.

the class SelectRowPanel method createComponents.

private void createComponents() {
    if (framework == null) {
        throw new NullPointerException("framework equals to null");
    }
    splitPane.setRightComponent(new JPanel());
    qualifierView = new QualifierView(framework, dataPlugin.getEngine(), accessRules) {

        @Override
        protected void addListeners() {
            table.addSelectionListener(new SelectionListener() {

                @Override
                public void changeSelection(SelectionEvent event) {
                    deleteRightPanel();
                    createRightComponent();
                }
            });
            table.setEditIfNullEvent(false);
            table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "EditCell");
            table.getActionMap().put("EditCell", new AbstractAction() {

                /**
                 */
                private static final long serialVersionUID = 3229634866196074563L;

                @Override
                public void actionPerformed(java.awt.event.ActionEvent e) {
                    if ((table.getSelectedRow() >= 0) && (table.getSelectedColumn() >= 0))
                        editTableField();
                }
            });
        }
    };
    if (qualifierHideElements != null)
        qualifierView.setHideElements(qualifierHideElements);
    splitPane.setLeftComponent(qualifierView.createComponent());
    createRightComponent();
}
Also used : JPanel(javax.swing.JPanel) QualifierView(com.ramussoft.gui.qualifier.QualifierView) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) SelectionEvent(com.ramussoft.gui.qualifier.table.event.SelectionEvent) AbstractAction(javax.swing.AbstractAction) SelectionListener(com.ramussoft.gui.qualifier.table.event.SelectionListener)

Example 4 with SelectionListener

use of com.ramussoft.gui.qualifier.table.event.SelectionListener in project ramus by Vitaliy-Yakovchuk.

the class SelectRowDialog method createComponents.

private void createComponents() {
    if (framework == null) {
        throw new NullPointerException("framework equals to null");
    }
    splitPane.setRightComponent(new JPanel());
    qualifierView = new QualifierView(framework, dataPlugin.getEngine(), accessRules) {

        @Override
        protected void addListeners() {
            table.addSelectionListener(new SelectionListener() {

                @Override
                public void changeSelection(SelectionEvent event) {
                    deleteRightPanel();
                    createRightComponent();
                }
            });
            table.setEditIfNullEvent(false);
            table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "EditCell");
            table.getActionMap().put("EditCell", new AbstractAction() {

                /**
                 */
                private static final long serialVersionUID = 3229634866196074563L;

                @Override
                public void actionPerformed(java.awt.event.ActionEvent e) {
                    if ((table.getSelectedRow() >= 0) && (table.getSelectedColumn() >= 0))
                        editTableField();
                }
            });
        }
    };
    if (qualifierHideElements != null)
        qualifierView.setHideElements(qualifierHideElements);
    splitPane.setLeftComponent(qualifierView.createComponent());
    createRightComponent();
}
Also used : JPanel(javax.swing.JPanel) QualifierView(com.ramussoft.gui.qualifier.QualifierView) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) SelectionEvent(com.ramussoft.gui.qualifier.table.event.SelectionEvent) AbstractAction(javax.swing.AbstractAction) SelectionListener(com.ramussoft.gui.qualifier.table.event.SelectionListener)

Example 5 with SelectionListener

use of com.ramussoft.gui.qualifier.table.event.SelectionListener in project ramus by Vitaliy-Yakovchuk.

the class SectorRowsEditor method getSelectRowPane.

private SelectRowPanel getSelectRowPane() {
    if (selectRowPanel == null) {
        selectRowPanel = new SelectRowPanel(framework, dataPlugin, accessRules);
        selectRowPanel.addSelectionListener(new SelectionListener() {

            @Override
            public void changeSelection(SelectionEvent event) {
                if (event.isSelected())
                    addRows(event.getRows());
                else {
                    removeRows(event.getRows());
                }
            }
        });
    }
    return selectRowPanel;
}
Also used : SelectionEvent(com.ramussoft.gui.qualifier.table.event.SelectionEvent) SelectRowPanel(com.ramussoft.pb.frames.SelectRowPanel) SelectionListener(com.ramussoft.gui.qualifier.table.event.SelectionListener)

Aggregations

SelectionEvent (com.ramussoft.gui.qualifier.table.event.SelectionEvent)10 SelectionListener (com.ramussoft.gui.qualifier.table.event.SelectionListener)10 Row (com.ramussoft.database.common.Row)5 AbstractAction (javax.swing.AbstractAction)5 Attribute (com.ramussoft.common.Attribute)3 ActionEvent (java.awt.event.ActionEvent)3 AccessRules (com.ramussoft.common.AccessRules)2 Engine (com.ramussoft.common.Engine)2 ActionEvent (com.ramussoft.gui.common.event.ActionEvent)2 QualifierView (com.ramussoft.gui.qualifier.QualifierView)2 RowRootCreater (com.ramussoft.gui.qualifier.table.RowRootCreater)2 RowTreeTableComponent (com.ramussoft.gui.qualifier.table.RowTreeTableComponent)2 TreeTableNode (com.ramussoft.gui.qualifier.table.TreeTableNode)2 MouseAdapter (java.awt.event.MouseAdapter)2 MouseEvent (java.awt.event.MouseEvent)2 JPanel (javax.swing.JPanel)2 RowTreeTable (com.ramussoft.gui.qualifier.table.RowTreeTable)1 SelectRowPanel (com.ramussoft.pb.frames.SelectRowPanel)1 Action (javax.swing.Action)1 ImageIcon (javax.swing.ImageIcon)1