Search in sources :

Example 11 with Pin

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();
}
Also used : Pin(com.ramussoft.pb.idef.elements.PaintSector.Pin) Enumeration(java.util.Enumeration) NFunction(com.ramussoft.pb.data.negine.NFunction) Attribute(com.ramussoft.common.Attribute) NSector(com.ramussoft.pb.data.negine.NSector) Pin(com.ramussoft.pb.idef.elements.PaintSector.Pin) AttributeEditorView(com.ramussoft.gui.attribute.AttributeEditorView) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) DFDObject(com.ramussoft.pb.dfd.visual.DFDObject)

Example 12 with Pin

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;
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea) SectorRefactor(com.ramussoft.pb.idef.elements.SectorRefactor) Dimension(java.awt.Dimension) Function(com.ramussoft.pb.Function) MovingLabel(com.ramussoft.pb.idef.visual.MovingLabel) Pin(com.ramussoft.pb.idef.elements.PaintSector.Pin) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Aggregations

Pin (com.ramussoft.pb.idef.elements.PaintSector.Pin)12 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)7 FloatPoint (com.dsoft.pb.types.FloatPoint)4 Attribute (com.ramussoft.common.Attribute)3 Row (com.ramussoft.pb.Row)3 Stream (com.ramussoft.pb.Stream)3 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)3 BasicStroke (java.awt.BasicStroke)3 Element (com.ramussoft.common.Element)2 Engine (com.ramussoft.common.Engine)2 Journaled (com.ramussoft.common.journal.Journaled)2 AbstractAttributeEditor (com.ramussoft.gui.common.AbstractAttributeEditor)2 MetadataGetter (com.ramussoft.gui.qualifier.table.MetadataGetter)2 Crosspoint (com.ramussoft.pb.Crosspoint)2 Function (com.ramussoft.pb.Function)2 NSector (com.ramussoft.pb.data.negine.NSector)2 Point (com.ramussoft.pb.idef.elements.Point)2 PerspectivePoint (com.ramussoft.pb.idef.elements.SectorRefactor.PerspectivePoint)2 MovingArea (com.ramussoft.pb.idef.visual.MovingArea)2 MovingLabel (com.ramussoft.pb.idef.visual.MovingLabel)2