use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class ElistPanel method getElementInfo.
public ElementInfo getElementInfo(long elementId) {
int c = table.getRowCount();
for (int row = 0; row < c; row++) {
TreeTableNode node = (TreeTableNode) table.getPathForRow(row).getLastPathComponent();
Row r = node.getRow();
if ((r != null) && (r.getElementId() == elementId)) {
return new ElementInfo(getRowY(row), false);
}
if (table.isCollapsed(row)) {
if (isPresent(node, elementId)) {
return new ElementInfo(getRowY(row), true);
}
}
}
return null;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class ElementListAttributeEditor method getValue.
@Override
public Object getValue() {
List<ElementListPersistent> list = new ArrayList<ElementListPersistent>();
List<Row> rows = component.getModel().getSelectedRows();
for (Row row : rows) {
ElementListPersistent p;
if (left) {
p = new ElementListPersistent(row.getElementId(), element.getId());
} else {
p = new ElementListPersistent(element.getId(), row.getElementId());
}
list.add(p);
}
Collections.sort(list);
return list;
}
use of com.ramussoft.database.common.Row 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.Row in project ramus by Vitaliy-Yakovchuk.
the class ChartSetView method createComponent.
@Override
public JComponent createComponent() {
final JLabel label = new JLabel(ChartResourceManager.getString("Message.MoveChartToChartSet"));
desktop = new JDesktopPane();
desktop.setTransferHandler(new TransferHandler("") {
/**
*/
private static final long serialVersionUID = 4967256166603971141L;
@Override
public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
for (DataFlavor flavor : transferFlavors) {
if (flavor.equals(RowTreeTable.rowsListFlavor)) {
return true;
}
}
return false;
}
@Override
public boolean importData(JComponent comp, Transferable t) {
try {
Rows rows = (Rows) t.getTransferData(RowTreeTable.rowsListFlavor);
if (rows.size() > 0) {
((Journaled) engine).startUserTransaction();
for (Row row : rows) {
Point position = comp.getMousePosition();
if (position == null)
position = new Point(10, 10);
ChartPlugin.addChartLink(engine, element, row.getElement(), position.getX(), position.getY(), 340, 300);
}
}
((Journaled) engine).commitUserTransaction();
return rows.size() > 0;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
});
label.setBackground(desktop.getBackground());
desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
List<ChartBounds> bounds = ChartPlugin.getChartBounds(engine, element);
for (ChartBounds cb : bounds) {
final JInternalFrame frame = new JInternalFrame(cb.getChart().getName(), true, true, true, true);
final ChartView chartView = new ChartView(framework, cb.getChart()) {
protected void titleChanged(String newTitle) {
frame.setTitle(newTitle);
reload();
}
};
final ChartBounds b = cb;
frame.setSize((int) cb.getWidth(), (int) cb.getHeight());
frame.setLocation((int) cb.getX(), (int) cb.getY());
frame.setContentPane(chartView.createComponent());
desktop.add(frame);
frame.setVisible(true);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
ChartHolder holder = new ChartHolder(chartView, frame, b.getLink());
holders.add(holder);
}
});
}
return desktop;
}
use of com.ramussoft.database.common.Row in project ramus by Vitaliy-Yakovchuk.
the class ChartsView method createComponent.
@Override
public JComponent createComponent() {
Engine engine = framework.getEngine();
AccessRules accessRules = framework.getAccessRules();
component = new RowTreeTableComponent(engine, ChartPlugin.getCharts(engine), accessRules, new RowRootCreater(), new Attribute[] { StandardAttributesPlugin.getAttributeNameAttribute(engine) }, framework);
component.getTable().addSelectionListener(new SelectionListener() {
@Override
public void changeSelection(SelectionEvent event) {
TreeTableNode selectedNode = component.getTable().getSelectedNode();
if (selectedNode == null)
chartPrefernecesAction.setEnabled(false);
else {
Row row = selectedNode.getRow();
chartPrefernecesAction.setEnabled(row != null);
}
openChartAction.setEnabled(chartPrefernecesAction.isEnabled());
deleteChartAction.setEnabled(chartPrefernecesAction.isEnabled());
}
});
table = component.getTable();
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if ((e.getClickCount() % 2 == 0) && (e.getClickCount() > 0)) {
openDiagram();
} else {
if ((e.getClickCount() == 1) && (System.currentTimeMillis() - lastClickTime < 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();
}
});
table.setExportRows(true);
return component;
}
Aggregations