use of com.ramussoft.common.AttributeType 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.common.AttributeType in project ramus by Vitaliy-Yakovchuk.
the class AttributeStorageCommand method loadAttribute.
protected void loadAttribute(BinaryDataInput input, Attribute attribute) throws IOException {
attribute.setAttributeType(new AttributeType());
attribute.setId(input.readLong());
attribute.setName(input.readSwimedString());
attribute.getAttributeType().setPluginName(input.readSwimedString());
attribute.getAttributeType().setTypeName(input.readSwimedString());
attribute.getAttributeType().setComparable(input.readBoolean());
}
use of com.ramussoft.common.AttributeType 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.common.AttributeType in project ramus by Vitaliy-Yakovchuk.
the class NewProjectDialog method showModal.
public void showModal(final Engine engine, final AccessRules accessRules, final GUIFramework framework) {
((Journaled) engine).setNoUndoPoint();
final Properties name_author = new DefaultProperties(new Property[] { new DefaultProperty(AUTOR, Property.TEXT_FIELD), new DefaultProperty(PROJECT_NAME, Property.TEXT_FIELD), new DefaultProperty(MODEL_NAME, Property.TEXT_FIELD) }, Factory.getString("name_author.Describe"));
final Properties used_at = new DefaultProperties(new Property[] { new DefaultProperty(USED_AT, Property.TEXT_FIELD) }, Factory.getString("used_at.Describe"));
final Properties def = new DefaultProperties(new Property[] { new DefaultProperty(DEFINITION, Property.TEXT) }, Factory.getString("describe.Describe"));
final Properties clasificators = new DefaultProperties(new Property[] { new DefaultProperty(CLASIFICATOR1, Property.TEXT_FIELD), new DefaultProperty(CLASIFICATOR2, Property.TEXT_FIELD), new DefaultProperty(CLASIFICATOR3, Property.TEXT_FIELD), new DefaultProperty(CLASIFICATOR4, Property.TEXT_FIELD), new DefaultProperty(CLASIFICATOR5, Property.TEXT_FIELD) }, Factory.getString("Clasificators.Describe"));
masterModel = new DefaultMasterModel(new Properties[] { name_author, used_at, def, clasificators });
mainPanel = new MainPanel(new PanelCreator(masterModel)) {
@Override
public boolean cancel() {
if (super.cancel()) {
NewProjectDialog.this.setVisible(false);
finish();
return true;
}
return false;
}
@Override
protected void finish() {
super.finish();
((Journaled) engine).startUserTransaction();
final Qualifier baseFunction = engine.createQualifier();
String modelName = getValue(MODEL_NAME);
if ((modelName == null) || (modelName.length() == 0))
baseFunction.setName(ResourceLoader.getString("base_function"));
else
baseFunction.setName(modelName);
Attribute name = engine.createAttribute(new AttributeType("Core", "Text", true));
name.setName(ResourceLoader.getString("name"));
engine.updateAttribute(name);
java.util.Properties ps = engine.getProperties(AutochangePlugin.AUTO_ADD_ATTRIBUTES);
ps.setProperty(AutochangePlugin.AUTO_ADD_ATTRIBUTE_IDS, Long.toString(name.getId()));
ps.setProperty(AutochangePlugin.ATTRIBUTE_FOR_NAME, Long.toString(name.getId()));
engine.setProperties(AutochangePlugin.AUTO_ADD_ATTRIBUTES, ps);
baseFunction.getAttributes().add(name);
baseFunction.setAttributeForName(name.getId());
IDEF0Plugin.installFunctionAttributes(baseFunction, engine);
Element element = engine.createElement(IDEF0Plugin.getModelTree(engine).getId());
engine.setAttribute(element, StandardAttributesPlugin.getAttributeQualifierId(engine), baseFunction.getId());
HierarchicalPersistent hp = new HierarchicalPersistent();
hp.setParentElementId(-1l);
hp.setPreviousElementId(-1l);
engine.setAttribute(element, StandardAttributesPlugin.getAttributeNameAttribute(engine), baseFunction.getName());
engine.setAttribute(element, StandardAttributesPlugin.getHierarchicalAttribute(engine), hp);
DataPlugin dataPlugin = NDataPluginFactory.getDataPlugin(baseFunction, engine, accessRules);
if (dfd.isSelected())
dataPlugin.getBaseFunction().setDecompositionType(MovingArea.DIAGRAM_TYPE_DFD);
else if (dfds.isSelected())
dataPlugin.getBaseFunction().setDecompositionType(MovingArea.DIAGRAM_TYPE_DFDS);
else if (dfds.isSelected())
dataPlugin.getBaseFunction().setDecompositionType(MovingArea.DIAGRAM_TYPE_DFDS);
ProjectOptions projectOptions = new ProjectOptions();
projectOptions.setProjectAutor(getValue(AUTOR));
projectOptions.setProjectName(getValue(PROJECT_NAME));
projectOptions.setDefinition(getValue(DEFINITION));
projectOptions.setUsedAt(getValue(USED_AT));
NewProjectDialog.this.setVisible(false);
final String[] cls = getClasifiactors();
final StringBuffer ounersIds = new StringBuffer();
for (final String c : cls) {
Row row = dataPlugin.createRow(null, false);
Qualifier qualifier = engine.getQualifier(StandardAttributesPlugin.getQualifierId(engine, row.getElement().getId()));
qualifier.setName(c);
engine.updateQualifier(qualifier);
if (ouners.indexOf(c) >= 0) {
ounersIds.append(qualifier.getId());
ounersIds.append(' ');
}
}
dataPlugin.setProperty(DataPlugin.PROPERTY_OUNERS, ounersIds.toString());
dataPlugin.getBaseFunction().setProjectOptions(projectOptions);
((Journaled) engine).commitUserTransaction();
((Journaled) engine).setNoUndoPoint();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
framework.propertyChanged("ShowWorkspace", "Workspace.IDEF0");
OpenDiagram open = new OpenDiagram(baseFunction, -1l);
framework.propertyChanged(IDEF0ViewPlugin.OPEN_DIAGRAM, open);
}
});
}
};
setContentPane(mainPanel);
pack();
Dimension size = this.getSize();
setMinimumSize(new Dimension(size.width, size.height + 30));
setLocationRelativeTo(null);
setVisible(true);
frame.repaint();
}
use of com.ramussoft.common.AttributeType in project ramus by Vitaliy-Yakovchuk.
the class ReportPlugin method init.
@Override
public void init(Engine engine, AccessRules rules) {
super.init(engine, rules);
engine.setPluginProperty(getName(), PLUGIN, this);
reports = engine.getSystemQualifier(REPORTS_QUALIFIER);
if (reports == null) {
reports = engine.createSystemQualifier();
reportName = createAttribute(REPORT_NAME, new AttributeType("Core", "Text", true));
reportQualifier = createAttribute(REPORT_QUALIFIER, new AttributeType("Core", "Long", true));
reports.setName(REPORTS_QUALIFIER);
reports.getAttributes().add(reportName);
reports.getSystemAttributes().add(reportQualifier);
reports.setAttributeForName(reportName.getId());
Attribute hierarchical = (Attribute) engine.getPluginProperty("Core", HierarchicalPlugin.HIERARHICAL_ATTRIBUTE);
reports.getSystemAttributes().add(hierarchical);
engine.updateQualifier(reports);
} else {
reportName = engine.getSystemAttribute(REPORT_NAME);
reportQualifier = engine.getSystemAttribute(REPORT_QUALIFIER);
}
reportType = engine.getSystemAttribute(REPORT_TYPE);
if (reportType == null) {
reportType = createAttribute(REPORT_TYPE, new AttributeType("Core", "Text", true));
reports.getSystemAttributes().add(reportType);
engine.updateQualifier(reports);
}
}
Aggregations