use of com.ramussoft.pb.idef.elements.PaintSector.Pin in project ramus by Vitaliy-Yakovchuk.
the class MovingArea method setActiveObject.
public void setActiveObject(final Object activeObject, boolean silent) {
this.prevActiveObject = this.getActiveObject();
if (activeObject instanceof MovingText)
this.activeMovingTextIndex = refactor.getTexts().indexOf(activeObject);
else
this.activeMovingTextIndex = -1;
if (activeObject instanceof MovingFunction) {
NFunction function = (NFunction) ((MovingFunction) activeObject).getFunction();
if (!silent) {
panel.getFramework().propertyChanged(Commands.ACTIVATE_ELEMENT, function.getElement());
long id = dataPlugin.getBaseFunctionQualifier().getAttributeForName();
for (Attribute attr : dataPlugin.getBaseFunctionQualifier().getAttributes()) if (attr.getId() == id) {
panel.getFramework().propertyChanged(Commands.ACTIVATE_ATTRIBUTE, new AttributeEditorView.ElementAttribute(function.getElement(), attr));
}
}
Enumeration e = ((MovingFunction) activeObject).getFunction().children();
while (e.hasMoreElements()) ((Function) e.nextElement()).getSectors();
}
final Object o = this.activeObject;
if ((activeObject == null) && (!silent)) {
panel.getFramework().propertyChanged(Commands.ACTIVATE_ATTRIBUTE, null);
}
this.activeObject = activeObject;
if (o != activeObject)
panel.getFrame().refreshActions(panel);
if (activeObject instanceof PaintSector.Pin) {
final PaintSector.Pin pin = (PaintSector.Pin) activeObject;
panel.getFrame().getJCheckBoxMenuItemShowTilda().setSelected(pin.getSector().isShowTilda());
panel.getFrame().getJCheckBoxMenuItemTransparentText().setSelected(pin.getSector().isTransparent());
if (!silent) {
panel.getFramework().propertyChanged(Commands.ACTIVATE_ELEMENT, ((NSector) pin.getSector().getSector()).getElement(), pin);
panel.getFramework().propertyChanged(Commands.ACTIVATE_ATTRIBUTE, new AttributeEditorView.ElementAttribute(((NSector) pin.getSector().getSector()).getElement(), IDEF0Plugin.getStreamAttribute(dataPlugin.getEngine())), pin);
}
}
repaintAsync();
}
use of com.ramussoft.pb.idef.elements.PaintSector.Pin in project ramus by Vitaliy-Yakovchuk.
the class HTMLHelper method getDiagram.
/*
*
* private static final int IMAGE_WIDTH = 850; private static final int
* IMAGE_HEIGHT = 738;
*/
public String getDiagram(final String sId, final String functionController, final String clasificatorController) {
if (sId == null)
return null;
final Row r = dataPlugin.findRowByGlobalId(GlobalId.convert(sId));
if (r instanceof Function) {
final Function function = (Function) r;
final int imageWidth = IMAGE_WIDTH;
final int imageHeight = IMAGE_HEIGHT;
final DiagramHolder htmlStream = new DiagramHolder();
htmlStream.println("<img border=0 width=" + imageWidth + " height=" + imageHeight + " src=\"" + functionController + "idef0/" + function.getGlobalId().toString() + "\" 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);
final SectorRefactor refactor = area.getRefactor();
for (int i = 0; i < childs.size(); i++) {
final Function fun = (Function) childs.get(i);
String where;
if (fun.isLeaf())
where = clasificatorController;
else
where = functionController + "index/";
htmlStream.print("<area shape=RECT coords=" + getAreaCoords(fun.getBounds(), area) + " href=\"" + where + fun.getGlobalId().toString() + "\"");
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=\"" + clasificatorController + stream.getGlobalId().toString() + "\"");
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=\"" + clasificatorController + stream.getGlobalId().toString() + "\"");
htmlStream.println(">");
}
}
htmlStream.println("<map>");
return htmlStream.toString();
}
return null;
}
Aggregations