use of com.ramussoft.database.common.RowChildAdapter in project ramus by Vitaliy-Yakovchuk.
the class ReportsView method createComponent.
@Override
public JComponent createComponent() {
JComponent createComponent = super.createComponent();
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if ((e.getClickCount() % 2 == 0) && (e.getClickCount() > 0)) {
openReport();
} else {
if ((e.getClickCount() == 1) && (System.currentTimeMillis() - lastClickTime < QualifierView.EDIT_NAME_CLICK_DELAY) && (Arrays.equals(lastSelectedRows, table.getSelectedRows()))) {
if (!table.isEditing()) {
editTableField();
}
} else {
lastClickTime = System.currentTimeMillis();
lastSelectedRows = table.getSelectedRows();
}
}
}
}
});
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(ActionEvent e) {
if ((table.getSelectedRow() >= 0) && (table.getSelectedColumn() >= 0))
editTableField();
}
});
component.getRowSet().addRowChildListener(new RowChildAdapter() {
@Override
public void addedByThisRowSet(final Row row) {
row.setAttribute(ReportPlugin.getReportTypeAttribute(engine), createType);
row.setAttribute(ReportPlugin.getReportNameAttribute(engine), name);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
openReport(row);
}
});
}
});
return createComponent;
}
use of com.ramussoft.database.common.RowChildAdapter in project ramus by Vitaliy-Yakovchuk.
the class QualifierView method createInnerComponent.
@Override
protected void createInnerComponent() {
super.createInnerComponent();
((AbstractTableModel) component.getTable().getModel()).fireTableStructureChanged();
component.getTable().setLeafIcon(new ImageIcon(getClass().getResource("/com/ramussoft/gui/table/qualifier.png")));
getComponent().getRowSet().addRowChildListener(new RowChildAdapter() {
@Override
public void added(Row parent, Row row, int index) {
if (parent.getParent() == null)
return;
framework.propertyChanged("CloseQualifier", StandardAttributesPlugin.getQualifierId(engine, parent.getElementId()));
}
});
}
Aggregations