use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method printClasificator.
private void printClasificator() throws IOException {
final Row row = loadRowById();
if (row == null) {
printError(RES.getString("cantLoatClasificator"));
return;
}
if (row instanceof Function) {
htmlTitle = MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) row) + " " + row.getName();
} else
htmlTitle = row.getKod() + ". " + row.getName();
printStartD();
printRowBase(row);
if (row instanceof Function) {
boolean b = true;
if (!row.isLeaf()) {
b = false;
htmlStream.println("<br>");
printStartATeg("idef0/index.html?id=" + row.getGlobalId().toString());
htmlStream.print(RES.getString("idef0Model"));
printEndATeg();
}
if (row.isElement()) {
if (b)
htmlStream.println("<br>");
else
htmlStream.print(" ");
printStartATeg("idef0/index.html?id=" + row.getParentRow().getGlobalId().toString());
htmlStream.print(RES.getString("ParentIDEF0Model"));
printEndATeg();
}
htmlStream.println("<br>");
} else if (row instanceof Stream && !dataPlugin.getBaseStream().equals(row)) {
printStreamsRows((Stream) row);
}
boolean haveTable = false;
Vector<Row> v = dataPlugin.getChilds(row, row.isElement());
if (v.size() > 0) {
if (haveTable)
htmlStream.println("<br>");
printElements(RES.getString("childElements"), v.toArray(), row.isElement() ? "rows" : "clasificators");
haveTable = true;
}
if (!row.isElement()) {
if (haveTable)
htmlStream.println("<br>");
v = dataPlugin.getRecChilds(row, true);
htmlStream.println("<hr>");
String var = params.get("var");
String attr = params.get("attr");
if (var != null) {
Engine engine = dataPlugin.getEngine();
long attrId = Long.parseLong(attr);
long varId = Long.parseLong(var);
Attribute attribute = engine.getAttribute(attrId);
List<VariantPropertyPersistent> list = (List<VariantPropertyPersistent>) engine.getAttribute(null, attribute);
VariantPropertyPersistent vpp = null;
for (VariantPropertyPersistent vp : list) if (vp.getVariantId() == varId) {
vpp = vp;
break;
}
if ((vpp != null) && (vpp.getValue() != null)) {
String value = vpp.getValue();
ArrayList list1 = new ArrayList();
for (Row r : v) {
if (value.equals(((NRow) r).getAttribute(attribute)))
list1.add(r);
}
htmlStream.println("(" + value + ")");
htmlStream.println("<br>");
printElements(RES.getString("childElements"), list1.toArray(), row.isElement() ? "rows" : "clasificators");
}
} else
printElements(RES.getString("clasificatorElements"), v.toArray());
} else
printRowAttributes(row);
if (row instanceof Function && (row.isElement())) {
printFunctionsArrows((Function) row);
} else if (!(row instanceof Stream)) {
printArrowFunctionss(row);
}
printEndD();
}
use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class AttributeVariantPanel method moveDown.
private void moveDown(final int[] selectedRows) {
for (int i = selectedRows.length - 1; i >= 0; i--) {
final int r = selectedRows[i];
if (r < data.size() - 1) {
VariantPropertyPersistent attr = data.get(r);
data.remove(r);
data.add(r + 1, attr);
}
}
model.fireTableDataChanged();
}
use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class AttributeVariantPanel method moveUp.
private void moveUp(final int[] selectedRows) {
for (final int r : selectedRows) {
if (r > 0) {
VariantPropertyPersistent attr = data.get(r);
data.remove(r);
data.add(r - 1, attr);
}
}
model.fireTableDataChanged();
}
use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class AttributeVariantPanel method add.
protected void add() {
long max = -1;
for (int i = 0; i < data.size(); i++) if (data.get(i).getVariantId() > max)
max = data.get(i).getVariantId();
VariantPropertyPersistent p = new VariantPropertyPersistent();
p.setVariantId(max + 1);
p.setValue("");
data.add(p);
model.fireTableRowsInserted(data.size() - 1, data.size() - 1);
}
use of com.ramussoft.core.attribute.simple.VariantPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class VariantAttributeViewer method printAttribute.
@Override
public void printAttribute(PrintStream printStream, DataPlugin dataPlugin, Element element, Attribute attribute, HTTPParser parser, AttributeViewerCallback callback) throws IOException {
Engine engine = dataPlugin.getEngine();
String value = (String) engine.getAttribute(element, attribute);
if (value != null) {
List<VariantPropertyPersistent> list = (List<VariantPropertyPersistent>) engine.getAttribute(null, attribute);
VariantPropertyPersistent vp = null;
for (VariantPropertyPersistent persistent : list) {
if (persistent.getValue().equals(value))
vp = persistent;
}
if (vp != null) {
long id = StandardAttributesPlugin.getElement(engine, element.getQualifierId()).getId();
callback.beforePrint(printStream);
parser.printStartATeg("rows/index.html?id=" + id + "&var=" + vp.getVariantId() + "&attr=" + attribute.getId());
printStream.print(value);
parser.printEndATeg();
callback.afterPrint(printStream);
}
}
}
Aggregations