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;
}
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;
}
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();
}
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();
}
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;
}
Aggregations