use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class OtherElementPlugin method replaceElements.
@Override
public void replaceElements(Engine engine, Element[] oldElements, Element newElement) {
for (Qualifier qualifier : getAllNotSystemQualifiers(engine)) {
List<Attribute> attributes = new ArrayList<Attribute>();
for (Attribute attribute : qualifier.getAttributes()) {
if ((attribute.getAttributeType().getPluginName().equals(getName())) && (attribute.getAttributeType().getTypeName().equals(getTypeName()))) {
OtherElementPropertyPersistent p = (OtherElementPropertyPersistent) engine.getAttribute(null, attribute);
if (p.getQualifier() == newElement.getQualifierId())
attributes.add(attribute);
}
}
Hashtable<Element, Object[]> hash = engine.getElements(qualifier, attributes);
Enumeration<Element> keys = hash.keys();
while (keys.hasMoreElements()) {
Element key = keys.nextElement();
Object[] objects = hash.get(key);
int aIndex = 0;
for (Object object : objects) if (object != null) {
Long l = (Long) object;
for (Element element : oldElements) {
if (element.getId() == l.longValue()) {
engine.setAttribute(key, attributes.get(aIndex), newElement.getId());
break;
}
}
aIndex++;
}
}
}
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class EvalPlugin method getQualifier.
private Qualifier getQualifier(long qualifierId, Hashtable<Long, Qualifier> qualifiers, Engine engine) {
Qualifier qualifier = qualifiers.get(qualifierId);
if (qualifier == null) {
qualifier = engine.getQualifier(qualifierId);
qualifiers.put(qualifierId, qualifier);
}
return qualifier;
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class SelectRowDialog method showModal.
public List<com.ramussoft.pb.Row> showModal() {
final Qualifier q1 = qualifier;
selectedRows.clear();
createComponents();
if (q1 != null) {
Options.saveOptions(this);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
qualifierView.setSelectedQualifier(q1);
Options.loadOptions(SelectRowDialog.this);
addQualifier = false;
}
});
}
ok = false;
setVisible(true);
deleteComponents();
List<com.ramussoft.pb.Row> result = new ArrayList<com.ramussoft.pb.Row>();
if (ok) {
for (List<Row> list : selectedRows.values()) {
for (Row row : list) {
com.ramussoft.pb.Row r = dataPlugin.findRowByGlobalId(row.getElementId());
if (r != null)
result.add(r);
}
}
if ((addQualifier) && (qualifier != null)) {
Engine engine = dataPlugin.getEngine();
Qualifier q = StandardAttributesPlugin.getQualifiersQualifier(engine);
List<Element> list = engine.getElements(q.getId());
for (Element element : list) {
if (qualifier.equals(StandardAttributesPlugin.getQualifier(engine, element))) {
com.ramussoft.pb.Row r = dataPlugin.findRowByGlobalId(element.getId());
if (r != null) {
result.add(r);
} else {
System.err.println("WARNING: Can not find element for qualifier (" + qualifier.getName() + ")");
}
}
}
}
}
Options.saveOptions(this);
return result;
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class IDEF0ConnectionPlugin method getOuners.
private Rows getOuners(Data data, String name) {
List<Long> ids = OwnersConnection.loadOunerIDs(data.getEngine());
Rows rows = new Rows(null, data, false);
rows.setQualifierName(name);
for (Long long1 : ids) {
Qualifier qualifier = data.getQualifier(long1.longValue());
if (qualifier != null)
rows.addAll(data.getRows(qualifier));
}
return rows;
}
use of com.ramussoft.common.Qualifier in project ramus by Vitaliy-Yakovchuk.
the class ChartSourceSelectPanel method createRightPanel.
private void createRightPanel() {
if (qualifierView == null)
return;
Qualifier qualifier = qualifierView.getSelectedQualifier();
boolean b = qualifier != null;
if (b) {
framework.setOpenDynamikViewEvent(new ActionEvent(QualifierPlugin.OPEN_QUALIFIER, qualifier));
QualifierSource qualifierSource = null;
for (QualifierSource s : chartSource.getQualifierSources()) {
if (s.getQualifier().equals(qualifier)) {
qualifierSource = s;
break;
}
}
if (qualifierSource == null) {
qualifierSource = chartSource.createQualifierSource();
qualifierSource.setQualifier(qualifier);
chartSource.getQualifierSources().add(qualifierSource);
}
qualifierSelectPanel = new QualifierSourceSelectPanel(framework, qualifier, qualifierSource, (sourceType.getSelectedItem().equals(sourceTypeElements)) ? SelectType.CHECK : SelectType.RADIO);
int dl = pane.getDividerLocation();
pane.setRightComponent(qualifierSelectPanel);
pane.revalidate();
pane.repaint();
pane.setDividerLocation(dl);
}
}
Aggregations