use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class MatrixProjectionIDEF0 method getLeft.
/**
* Метод повертає вектор елементів класифікатора потоків, які пов’язані з
* відповідним елементом класифікатора робіт.
*/
public Vector<Row> getLeft(final Row row) {
Function parent;
if ((parent = (Function) row.getParentRow()) == null)
return new Vector<Row>();
final Vector<Row> res = new Vector<Row>();
final Function f = (Function) row;
final Vector sectors = parent.getSectors();
Sector sector;
Stream stream;
final int l = sectors.size();
for (int i = 0; i < l; i++) {
sector = (Sector) sectors.get(i);
if ((stream = sector.getStream()) != null) {
if (type == MovingPanel.RIGHT) {
if (f.equals(sector.getStart().getFunction()))
res.add(stream);
} else {
if (f.equals(sector.getEnd().getFunction()) && sector.getEnd().getFunctionType() == type)
res.add(stream);
}
}
}
return res;
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method printIDEF0Model.
private void printIDEF0Model() throws IOException {
int imageWidth = IMAGE_WIDTH;
String s = (String) params.get("w");
if (s != null) {
try {
imageWidth = new Integer(s).intValue();
} catch (final Exception e) {
}
}
int imageHeight = IMAGE_HEIGHT;
s = (String) params.get("h");
if (s != null) {
try {
imageHeight = new Integer(s).intValue();
} catch (final Exception e) {
}
}
Row row = loadRowById();
Row old = row;
if (row == null || !(row instanceof Function)) {
printIDEF0Error();
return;
}
row = replaceIDEF0Row(row);
final Function function = (Function) row;
String functionType;
String name = function.getName();
int iFunctionType = function.getType();
Row ouner = null;
if (function.getParent() == null) {
final Enumeration e = function.children();
while (e.hasMoreElements()) {
final Function f = (Function) e.nextElement();
ouner = f.getOwner();
iFunctionType = f.getType();
name = f.getName();
if (ouner != null)
break;
}
} else
ouner = function.getOwner();
switch(iFunctionType) {
case Function.TYPE_PROCESS_KOMPLEX:
functionType = RES.getString("functionProcessKomplex");
break;
case Function.TYPE_PROCESS:
functionType = RES.getString("functionProcess");
break;
case Function.TYPE_PROCESS_PART:
functionType = RES.getString("functionProcessPart");
break;
case Function.TYPE_ACTION:
functionType = RES.getString("functionAction");
break;
case Function.TYPE_OPERATION:
functionType = RES.getString("functionOperation");
break;
default:
functionType = "";
break;
}
htmlTitle = functionType + " " + name;
printStartD();
if (printVersion) {
} else {
if (imageWidth != 800) {
htmlStream.print("<a href=\"" + fromLink + "idef0/index.html?id=" + function.getGlobalId().toString() + "&w=800&h=600\" style=\"color:rgb(0,0,0);\">");
htmlStream.print("800x600");
htmlStream.println("</a>");
}
if (imageWidth != 905) {
htmlStream.print("<a href=\"" + fromLink + "idef0/index.html?id=" + function.getGlobalId().toString() + "&w=905&h=700\" style=\"color:rgb(0,0,0);\">");
htmlStream.print("905x700");
htmlStream.println("</a>");
}
if (imageWidth != 1024) {
htmlStream.print("<a href=\"" + fromLink + "idef0/index.html?id=" + function.getGlobalId().toString() + "&w=1024&h=768\" style=\"color:rgb(0,0,0);\">");
htmlStream.print("1024x768");
htmlStream.println("</a>");
}
if (imageWidth != 1152) {
htmlStream.print("<a href=\"" + fromLink + "idef0/index.html?id=" + function.getGlobalId().toString() + "&w=1152&h=864\" style=\"color:rgb(0,0,0);\">");
htmlStream.print("1152x864");
htmlStream.println("</a>");
}
if (imageWidth != 1300) {
htmlStream.print("<a href=\"" + fromLink + "idef0/index.html?id=" + function.getGlobalId().toString() + "&w=1300&h=1000\" style=\"color:rgb(0,0,0);\">");
htmlStream.print("1300x1000");
htmlStream.println("</a>");
}
if (imageWidth != 1600) {
htmlStream.print("<a href=\"" + fromLink + "idef0/index.html?id=" + function.getGlobalId().toString() + "&w=1600&h=1200\" style=\"color:rgb(0,0,0);\">");
htmlStream.print("1600x1200");
htmlStream.println("</a>");
}
final Row parent = function.getParentRow();
htmlStream.println(RES.getString("functionType") + ": <b>" + functionType + "</b>");
if (parent != null) {
printStartATeg("idef0/index.html?id=" + parent.getGlobalId().toString());
htmlStream.println(RES.getString("oneLevelTop"));
printEndATeg();
// printStartATeg("idef0/index.html?id="
// + dataPlugin.getBaseFunction().getGlobalId().toString());
htmlStream.println(RES.getString("contents"));
printEndATeg();
}
if (ouner != null) {
printStartATeg("rows/index.html?id=" + ouner.getGlobalId().toString());
htmlStream.println(RES.getString("ouner") + ": " + ouner.getKod() + ". " + ouner.getName());
printEndATeg();
}
if (old == row) {
printStartATeg("rows/index.html?id=" + function.getGlobalId().toString());
htmlStream.println(RES.getString("element"));
printEndATeg();
}
Row top = row;
while (top.getParentRow() != null) {
top = top.getParentRow();
}
printStartATeg("fullmodel/index.html?id=" + top.getElement().getId());
htmlStream.println(RES.getString("ExpandedModel"));
printEndATeg();
}
htmlStream.print("<br>");
htmlStream.println("<img border=0 src=\"" + fromLink + "idef0/" + "model." + getImagesFormatName() + "?id=" + function.getGlobalId().toString() + "&w=" + imageWidth + "&h=" + imageHeight + "\" useMap=#M" + function.getGlobalId().toString() + ">");
htmlStream.println("<map name=M" + function.getGlobalId().toString() + ">");
final Vector childs = dataPlugin.getChilds(function, true);
final MovingArea area = PIDEF0painter.createMovingArea(new Dimension(imageWidth, imageHeight), dataPlugin, function);
final SectorRefactor refactor = area.getRefactor();
for (int i = 0; i < childs.size(); i++) {
final Function fun = (Function) childs.get(i);
Row row2 = dataPlugin.findRowByGlobalId(fun.getLink());
String where = "rows";
if ((row2 == null) && (fun.getType() < Function.TYPE_EXTERNAL_REFERENCE)) {
row2 = fun;
if (!fun.isLeaf())
where = "idef0";
}
if (row2 != null) {
htmlStream.print("<area shape=RECT coords=" + getAreaCoords(fun.getBounds(), area) + " href=\"" + fromLink + where + "/index.html?id=" + row2.getElement().getId() + "&w=" + imageWidth + "&h=" + imageHeight + (printVersion ? "&printVersion=true" : "") + "\"");
htmlStream.println(">");
}
}
refactor.loadFromFunction(function, false);
final int sc = refactor.getSectorsCount();
for (int i = 0; i < sc; i++) {
final PaintSector sector = refactor.getSector(i);
final Stream stream = sector.getStream();
final MovingLabel text = refactor.getSector(i).getText();
if (text != null && stream != null) {
htmlStream.print("<area shape=RECT coords=" + getAreaCoords(text.getBounds(), area) + " href=\"" + fromLink + "rows/index.html?id=" + stream.getGlobalId().toString() + "§orId=" + sector.getSector().getGlobalId() + "&w=" + imageWidth + "&h=" + imageHeight + "\"");
htmlStream.println(">");
}
final int l = sector.getPinCount();
for (int j = 0; j < l; j++) if (stream != null) {
final Pin pin = sector.getPin(j);
htmlStream.print("<area shape=RECT coords=" + getPinCoords(pin, area) + " href=\"" + fromLink + "rows/index.html?id=" + stream.getGlobalId().toString() + "§orId=" + sector.getSector().getGlobalId() + "&w=" + imageWidth + "&h=" + imageHeight + "\"");
htmlStream.println(">");
}
}
htmlStream.println("<map>");
printEndD();
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class HTTPParser method addFunction.
private void addFunction(final Row row, final Function function, final Vector<UF> res) {
if (!function.isHaveChilds()) {
final Function par = (Function) function.getParent();
boolean dfd = par.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFD;
final Vector<Sector> sectors = par.getSectors();
for (int i = 0; i < sectors.size(); i++) {
final Sector s = sectors.get(i);
final Stream stream = s.getStream();
if (stream != null) {
if (function.equals(s.getStart().getFunction())) {
if (RowFactory.isPresent(stream.getAdded(), row)) {
final UF uf = new UF(function, s.getStart().getFunctionType());
if (res.indexOf(uf) < 0) {
res.add(uf);
if (dfd)
uf.type = MovingPanel.RIGHT;
}
}
} else if (function.equals(s.getEnd().getFunction())) {
if (RowFactory.isPresent(stream.getAdded(), row)) {
final UF uf = new UF(function, s.getEnd().getFunctionType());
if (res.indexOf(uf) < 0) {
res.add(uf);
if (dfd)
uf.type = MovingPanel.LEFT;
}
}
}
}
}
}
}
use of com.ramussoft.pb.Stream 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.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class MovingArea method copyDFDSVisual.
protected void copyDFDSVisual() {
startUserTransaction();
DFDSRole role = (DFDSRole) activeObject;
VisualPanelImpl panelImpl = new VisualPanelImpl(role);
Stream stream = role.getStream();
Row[] oRows = stream.getAdded();
for (Row row : dataPlugin.getRecChilds(dataPlugin.getBaseFunction(), true)) if (row instanceof Function) {
final Function f = (Function) row;
if (f.getType() == Function.TYPE_DFDS_ROLE && f.getElement().getId() != role.getFunction().getElement().getId()) {
long l = f.getLink();
if (l >= 0) {
Stream s = (Stream) dataPlugin.findRowByGlobalId(l);
if (s != null && s.getAdded() != null) {
Row[] rows = s.getAdded();
boolean b = false;
for (Row row2 : rows) if (row2 != null) {
if (b)
break;
for (Row row3 : oRows) if (row3.equals(row2)) {
panelImpl.copyTo(new VisualPanel() {
@Override
public void setForegroundA(Color foreground) {
f.setForeground(foreground);
}
@Override
public void setFontA(Font font) {
f.setFont(font);
}
@Override
public void setBoundsA(FRectangle bounds) {
f.setBounds(bounds);
}
@Override
public void setBackgroundA(Color background) {
f.setBackground(background);
}
@Override
public Color getForegroundA() {
return f.getForeground();
}
@Override
public Font getFontA() {
return f.getFont();
}
@Override
public FRectangle getBoundsA() {
return f.getBounds();
}
@Override
public Color getBackgroundA() {
return f.getBackground();
}
}, copyOptions.copyBK, copyOptions.copyFK, copyOptions.copyFont, copyOptions.copySize);
b = true;
break;
}
}
}
}
}
}
commitUserTransaction();
}
Aggregations