use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class AttributeOrderEditPanel method up.
protected void up() {
int[] is = list.getSelectedRows();
final ArrayList<Integer> nSel = new ArrayList<Integer>();
for (int i = 0; i < is.length; i++) {
final int index = is[i];
if (index > 0) {
final Attribute obj = attributes.get(index);
attributes.remove(index);
final int j = index - 1;
attributes.add(j, obj);
nSel.add(j);
} else
is[i] = -1;
}
is = new int[nSel.size()];
for (int i = 0; i < is.length; i++) is[i] = nSel.get(i);
list.getSelectionModel().clearSelection();
for (int i : is) list.getSelectionModel().addSelectionInterval(i, i);
}
use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class QualifierHistoryPlugin method showHistory.
@SuppressWarnings("unchecked")
protected void showHistory(TableTabView tableView, Element element, Attribute attribute) {
GUIFramework framework = tableView.getFramework();
Hashtable<Element, Hashtable<Attribute, HistoryDialog>> h = (Hashtable<Element, Hashtable<Attribute, HistoryDialog>>) framework.get("HistoryDialogs");
if (h == null) {
h = new Hashtable<Element, Hashtable<Attribute, HistoryDialog>>();
framework.put("HistoryDialogs", h);
}
Hashtable<Attribute, HistoryDialog> h1 = h.get(element);
if (h1 == null) {
h1 = new Hashtable<Attribute, HistoryDialog>();
h.put(element, h1);
}
HistoryDialog hd = h1.get(attribute);
if (hd == null) {
hd = new HistoryDialog(framework, this, element, attribute);
h1.put(attribute, hd);
}
hd.setVisible(true);
}
use of com.ramussoft.common.Attribute 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.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class AttributeHierarchyEditorPanel method moveLeft.
private void moveLeft(final int index) {
final Object o = rightModel.get(index);
rightModel.removeElementAt(index);
int j = -1;
for (final Attribute element : allAttributes) {
if (o == element)
break;
if (leftModel.size() <= j + 1)
break;
if (leftModel.get(j + 1) == element) {
j++;
}
}
j++;
leftModel.add(j, o);
}
use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class RowTreeTableModel method getValueAt.
@Override
public Object getValueAt(Object node, int index) {
TreeTableNode tableRow = (TreeTableNode) node;
if (tableRow instanceof GroupNode) {
if (index == 0) {
GroupNode groupNode = (GroupNode) tableRow;
if (table != null) {
Attribute attribute = groupNode.getAttribute();
if (attribute != null) {
AttributePlugin plugin = framework.findAttributePlugin(attribute);
TableCellRenderer renderer = plugin.getTableCellRenderer(rowSet.getEngine(), framework.getAccessRules(), attribute);
if (renderer != null) {
try {
Component c = renderer.getTableCellRendererComponent(table, groupNode.getValue(), false, false, -1, -1);
if (c instanceof JLabel)
return ((JLabel) c).getText();
} catch (Exception e) {
// e.printStackTrace();
}
}
}
}
return groupNode.getValue();
}
return null;
}
return localizers[index].getValue(valueGetters[index].getValue(tableRow, index));
}
Aggregations