use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class RolesView method createComponent.
@Override
public JComponent createComponent() {
contentPanel = new JPanel(new BorderLayout());
String property = getProperty(DataPlugin.PROPERTY_OUNERS);
if (property == null)
property = "";
final StringTokenizer st = new StringTokenizer(property, " ");
List<Qualifier> owners = new ArrayList<Qualifier>();
while (st.hasMoreElements()) {
Qualifier owner = getEngine().getQualifier(Long.parseLong(st.nextToken()));
if (owner != null)
owners.add(owner);
}
if (owners.size() > 0)
createCenterPanel(owners.get(0));
return contentPanel;
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class ModelParaleler method getRow.
private Row getRow(long rowId) {
if (rowId < 0l)
return null;
Row res = rowHash.get(rowId);
if (res == null) {
Row row = fromDataPlugin.findRowByGlobalId(rowId);
if (row == null)
return null;
Element element = row.getElement();
if (!((row instanceof Stream) && (element.getName().equals("")))) {
Qualifier qualifier = null;
if (row instanceof Stream)
qualifier = IDEF0Plugin.getBaseStreamQualifier(toEngine);
else
qualifier = getQualifier(element.getQualifierId());
if (qualifier == null)
return null;
Element e = toEngine.getElement(element.getName(), qualifier.getId());
if (e != null) {
Row row2 = toDataPlugin.findRowByGlobalId(e.getId());
rowHash.put(e.getId(), row2);
return row2;
}
}
Row r = fromDataPlugin.findRowByGlobalId(rowId);
res = toDataPlugin.createRow(getRow(getParentRow(r)), r.isElement());
rowHash.put(r.getElement().getId(), res);
copyRow(r, res);
}
return res;
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class ModelParaleler method loadFromParalel.
public void loadFromParalel(boolean importAll, List<Qualifier> selected) {
List<Attribute> tAttrs = toEngine.getAttributes();
List<Attribute> fAttrs = fromEngine.getAttributes();
for (Attribute f : fAttrs) for (Attribute t : tAttrs) if ((f.getName().equals(t.getName())) && (f.getAttributeType().equals(t.getAttributeType())))
attrHash.put(f.getId(), t);
List<Qualifier> fList = fromEngine.getQualifiers();
List<Qualifier> tList = toEngine.getQualifiers();
for (Qualifier f : fList) if (!IDEF0Plugin.isFunction(f))
for (Qualifier t : tList) if (!IDEF0Plugin.isFunction(t))
if (f.getName().equals(t.getName()))
qHash.put(f.getId(), t);
Vector<Row> fRows = fromDataPlugin.getRecChilds(null, false);
Vector<Row> tRows = toDataPlugin.getRecChilds(null, false);
for (Row f : fRows) for (Row t : tRows) if (f.getName().equals(t.getName())) {
rowHash.put(f.getElement().getId(), t);
Vector<Row> fCRows = fromDataPlugin.getRecChilds(f, true);
Vector<Row> tCRows = toDataPlugin.getRecChilds(t, true);
for (Row fc : fCRows) for (Row tc : tCRows) if (fc.getName().equals(tc.getName()))
rowHash.put(fc.getElement().getId(), tc);
}
if (importAll) {
createAllRows();
}
for (Qualifier qualifier : selected) {
fromDataPlugin = NDataPluginFactory.getDataPlugin(qualifier, fromEngine, fromDataPlugin.getAccessRules());
Qualifier baseFunction = toEngine.createQualifier();
baseFunction.setName(qualifier.getName());
IDEF0Plugin.installFunctionAttributes(baseFunction, toEngine);
toDataPlugin = NDataPluginFactory.getDataPlugin(baseFunction, toEngine, toDataPlugin.getAccessRules());
base = toDataPlugin.getBaseFunction();
List<Attribute> list = getAttributes(qualifier.getAttributes());
for (Attribute a : list) if (baseFunction.getAttributes().indexOf(a) < 0)
baseFunction.getAttributes().add(a);
Attribute forName = fromEngine.getAttribute(qualifier.getAttributeForName());
if (forName != null)
baseFunction.setAttributeForName(getAttribute(forName).getId());
toEngine.updateQualifier(baseFunction);
if (fromDataPlugin.getBaseFunction().getChildCount() > 0) {
function = (Function) fromDataPlugin.getBaseFunction().getChildAt(0);
Vector<Row> childs = fromDataPlugin.getRecChilds(function, true);
childs.add(0, function);
for (Row row : childs) {
NFunction dest = (NFunction) getRow(row);
showMessageAnimation(dest.toString());
}
NFunction func = (NFunction) getRow(function);
createSectorsOnUpperLevel(func);
}
}
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class ModelsPanel method openDiagram.
public void openDiagram() {
RowTreeTable table = tree.getTable();
final List<OpenDiagram> models = new ArrayList<OpenDiagram>();
Qualifier modelTree = IDEF0Plugin.getModelTree(engine);
for (int i : table.getSelectedRows()) {
if (i >= 0) {
TreePath path = table.getPathForRow(i);
if (path != null) {
TreeTableNode node = (TreeTableNode) path.getLastPathComponent();
if (node != null) {
Row row = node.getRow();
if (row != null) {
if (row.getElement().getQualifierId() == modelTree.getId()) {
Long id = (Long) row.getAttribute(StandardAttributesPlugin.getAttributeQualifierId(engine));
if (id != null) {
Qualifier model = engine.getQualifier(id);
if (model != null) {
OpenDiagram openDiagram = new OpenDiagram(model, -1l);
models.add(openDiagram);
}
}
} else {
if (row.getChildCount() <= 0)
row = row.getParent();
OpenDiagram openDiagram = new OpenDiagram(row.getRowSet().getQualifier(), row.getElementId());
models.add(openDiagram);
}
}
}
}
}
}
if (models.size() > 0) {
if (engine.getPluginProperty("IDEF0", "DataPlugin") == null) {
framework.showAnimation(GlobalResourcesManager.getString("Wait.DataLoading"));
Thread thread = new Thread() {
@Override
public void run() {
NDataPluginFactory.getDataPlugin(null, engine, framework.getAccessRules());
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
openDiagrams(models);
framework.hideAnimation();
}
});
}
};
thread.start();
} else
openDiagrams(models);
}
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class IDEF0TabView method close.
@Override
public void close() {
super.close();
framework.removeActionListener(Commands.FULL_REFRESH, fullRefreshAction);
framework.removeActionListener(CLOSE, closeAction);
framework.removeActionListener(UPDATE_SIZES, updateSizeAction);
framework.removeActionListener(DISABLE_SILENT_REFRESH, setSilentRefreshAction);
Qualifier qualifier = dataPlugin.getBaseFunctionQualifier();
dataPlugin.getEngine().removeElementAttributeListener(qualifier, reloadMovingArea);
dataPlugin.getEngine().removeElementAttributeListener(IDEF0Plugin.getBaseFunctions(dataPlugin.getEngine()), reloadMovingArea);
dataPlugin.getEngine().removeElementListener(qualifier, elementAdapter);
dataPlugin.getEngine().removeElementListener(IDEF0Plugin.getBaseFunctions(dataPlugin.getEngine()), elementAdapter);
dataPlugin.getEngine().removeQualifierListener(qualifierListener);
panel.close();
}
Aggregations