use of com.ramussoft.gui.common.AttributePlugin in project ramus by Vitaliy-Yakovchuk.
the class AttributePullView method createComponent.
@Override
public JComponent createComponent() {
component = new RowTreeTableComponent(engine, attributeQualifier, rules, new RowRootCreater(), new Attribute[] { attributeName, attributeTypeName }, framework);
table = component.getTable();
component.getModel().setEditable(1, false);
((AbstractTableModel) table.getModel()).fireTableStructureChanged();
Attribute type = (Attribute) engine.getPluginProperty("Core", StandardAttributesPlugin.ATTRIBUTE_TYPE_NAME);
final Hashtable<String, String> names = new Hashtable<String, String>();
for (AttributeType type2 : engine.getAttributeTypes()) {
AttributePlugin plugin = framework.findAttributePlugin(type2);
try {
String key = "AttributeType." + type2.toString();
names.put(key, plugin.getString(key));
} catch (Exception e) {
e.printStackTrace();
}
}
String key = "AttributeType.Core.ElementList";
names.put(key, GlobalResourcesManager.getString(key));
component.getModel().setAttributeLocalizer(new RowTreeTableModel.Localizer() {
@Override
public Object getValue(Object key) {
if (key == null)
return "Anknown attribute type";
return names.get("AttributeType." + key.toString());
}
}, type);
table.getTreeSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
refreshActions();
}
});
rowSet = component.getRowSet();
table.setEditIfNullEvent(false);
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if ((e.getClickCount() % 2 == 0) && (e.getClickCount() > 0)) {
setupAttribute();
}
}
}
});
refreshActions();
table.setComponentPopupMenu(createJPopupMenu());
return component;
}
use of com.ramussoft.gui.common.AttributePlugin in project ramus by Vitaliy-Yakovchuk.
the class ElementAttributesEditor method reload.
protected void reload() {
CloseEvent event = new CloseEvent(this);
CloseListener[] listeners = getCloseListeners();
for (CloseListener listener : listeners) {
listener.closed(event);
removeCloseListener(listener);
}
loadCurrentQualifierAttributes();
Engine engine = framework.getEngine();
AccessRules rules = framework.getAccessRules();
getters = new ValueGetter[attributes.size()];
renderers = new TableCellRenderer[attributes.size()];
values = new Object[attributes.size()];
saveValues = new boolean[attributes.size()];
Arrays.fill(saveValues, true);
Arrays.fill(getters, new ValueGetter() {
@Override
public Object getValue(TableNode node, int index) {
return node.getValueAt(index);
}
});
for (int i = 0; i < attributes.size(); i++) {
Attribute attr = attributes.get(i).attribute;
AttributePlugin plugin = framework.findAttributePlugin(attr);
if (plugin instanceof TabledAttributePlugin) {
ValueGetter getter = ((TabledAttributePlugin) plugin).getValueGetter(attr, engine, framework, this);
if (getter != null)
getters[i] = getter;
}
renderers[i] = plugin.getTableCellRenderer(engine, rules, attr);
}
loadElement();
}
use of com.ramussoft.gui.common.AttributePlugin in project ramus by Vitaliy-Yakovchuk.
the class MovingArea method editActive.
/**
* Якщо виділений якийсь об’єкт, тоді з’являється діалогове вікно для роботи
* з його властивостями.
*/
@SuppressWarnings("unused")
public void editActive() {
if ((Metadata.EDUCATIONAL) && (Math.random() < 0.2d)) {
AttributePlugin plugin = panel.getFramework().findAttributePlugin(new AttributeType("Core", "Table", false));
if (!(plugin instanceof EmptyPlugin)) {
System.exit(233);
}
}
if ((activeObject instanceof MovingFunction) || (activeObject instanceof DFDFunction)) {
final IDEF0Object movingFunction = (IDEF0Object) activeObject;
// String text = movingFunction.getFunction().getName();
panel.getFunctionOptions().showModal(movingFunction);
/*
* if(!text.equals(movingFunction.getFunction().getName()))
* movingFunction.resetBounds();
*/
} else if (activeObject instanceof DFDSRole) {
panel.getDFDSRoleOptionsDialog().showModal((DFDSRole) activeObject);
} else if (activeObject instanceof DFDObject) {
panel.getDFDObjectOptionsDialog().showModal((DFDObject) activeObject);
} else if (activeObject instanceof MovingText)
panel.getTextOptionsDialog().showModal((MovingText) activeObject);
else if (activeObject instanceof PaintSector.Pin) {
panel.getArrowOptionsDialog().showModal(((PaintSector.Pin) activeObject).getSector(), this);
// setPanels();
}
repaintAsync();
}
use of com.ramussoft.gui.common.AttributePlugin in project ramus by Vitaliy-Yakovchuk.
the class GroupRootCreater method init.
@Override
public void init(Engine engine, GUIFramework framework, Closeable model) {
for (Attribute a : attrs) {
AttributePlugin plugin = framework.findAttributePlugin(a);
ValueGetter getter = null;
if (plugin instanceof TabledAttributePlugin) {
getter = ((TabledAttributePlugin) plugin).getValueGetter(a, engine, framework, model);
}
if (getter == null)
getter = new RowTreeTableModel.DefaultValueGetter();
hash.put(a, getter);
}
}
use of com.ramussoft.gui.common.AttributePlugin in project ramus by Vitaliy-Yakovchuk.
the class FunctionOptionsDialog method load.
private void load() {
Engine e = dataPlugin.getEngine();
Qualifier qualifier = function.getQualifier();
attributes = new ArrayList<Attribute>(qualifier.getAttributes());
for (int i = attributes.size() - 1; i >= 0; i--) {
Attribute attribute = attributes.get(i);
AttributePlugin plugin = framework.findAttributePlugin(attribute.getAttributeType());
Element element = ((NFunction) function).getElement();
AttributeEditor editor = plugin.getAttributeEditor(e, dataPlugin.getAccessRules(), element, attribute, "function", null);
if (editor == null)
continue;
attributeEditors.add(0, editor);
JComponent component = editor.getComponent();
JPanel panel = new JPanel(new BorderLayout());
panel.add(component, BorderLayout.CENTER);
Action[] actions = editor.getActions();
if (actions.length > 0) {
JToolBar bar = new JToolBar();
for (Action a : actions) {
JButton b = bar.add(a);
b.setFocusable(false);
bar.add(b);
}
panel.add(bar, BorderLayout.NORTH);
}
getJTabbedPane().insertTab(attribute.getName(), null, panel, null, 0);
Object value = e.getAttribute(element, attribute);
editor.setValue(value);
values.add(0, value);
}
getJColorChooser().setColor(function.getBackground());
getJColorChooser1().setColor(function.getForeground());
getJFontChooser().setSelFont(function.getFont());
functionType.setFunction(function);
selectOwner.setFunction(function);
}
Aggregations