Search in sources :

Example 1 with DFDFunction

use of com.ramussoft.pb.dfd.visual.DFDFunction in project ramus by Vitaliy-Yakovchuk.

the class MovingArea method addIDEF0Object.

private IDEF0Object addIDEF0Object(final Function function) {
    IDEF0Object movingFunction;
    if (function.getType() < Function.TYPE_EXTERNAL_REFERENCE) {
        if (DIAGRAM_TYPE_DFD == activeFunction.getDecompositionType())
            movingFunction = new DFDFunction(this, function) {

                /**
                 * @see com.ramussoft.pb.idef.visual.MovingText#onFocusGained(java.awt.event.FocusEvent)
                 */
                @Override
                public void focusGained(boolean silent) {
                    super.focusGained(silent);
                    setActiveObject(this, silent);
                }

                @Override
                public void focusLost() {
                    super.focusLost();
                    if (getActiveObject() == this)
                        setActiveObject(null);
                }
            };
        else if (DIAGRAM_TYPE_DFDS == activeFunction.getDecompositionType())
            movingFunction = new DFDSFunction(this, function) {

                /**
                 * @see com.ramussoft.pb.idef.visual.MovingText#onFocusGained(java.awt.event.FocusEvent)
                 */
                @Override
                public void focusGained(boolean silent) {
                    super.focusGained(silent);
                    setActiveObject(this, silent);
                }

                @Override
                public void focusLost() {
                    super.focusLost();
                    if (getActiveObject() == this)
                        setActiveObject(null);
                }
            };
        else
            movingFunction = new MovingFunction(this, function) {

                /**
                 * @see com.ramussoft.pb.idef.visual.MovingText#onFocusGained(java.awt.event.FocusEvent)
                 */
                @Override
                public void focusGained(boolean silent) {
                    super.focusGained(silent);
                    setActiveObject(this, silent);
                }

                @Override
                public void focusLost() {
                    super.focusLost();
                    if (getActiveObject() == this)
                        setActiveObject(null, false);
                }
            };
    } else {
        if (function.getType() == Function.TYPE_EXTERNAL_REFERENCE) {
            movingFunction = new External(this, function) {

                /**
                 * @see com.ramussoft.pb.idef.visual.MovingText#onFocusGained(java.awt.event.FocusEvent)
                 */
                @Override
                public void focusGained(boolean silent) {
                    super.focusGained(silent);
                    setActiveObject(this);
                }

                @Override
                public void focusLost() {
                    super.focusLost();
                    if (getActiveObject() == this)
                        setActiveObject(null);
                }
            };
        } else if (function.getType() == Function.TYPE_DFDS_ROLE) {
            movingFunction = new DFDSRole(this, function) {

                /**
                 * @see com.ramussoft.pb.idef.visual.MovingText#onFocusGained(java.awt.event.FocusEvent)
                 */
                @Override
                public void focusGained(boolean silent) {
                    super.focusGained(silent);
                    setActiveObject(this, silent);
                }

                @Override
                public void focusLost() {
                    super.focusLost();
                    if (getActiveObject() == this)
                        setActiveObject(null, false);
                }
            };
        } else {
            // DATA STORE
            movingFunction = new DataStore(this, function) {

                /**
                 * @see com.ramussoft.pb.idef.visual.MovingText#onFocusGained(java.awt.event.FocusEvent)
                 */
                @Override
                public void focusGained(boolean silent) {
                    super.focusGained(silent);
                    setActiveObject(this);
                }

                @Override
                public void focusLost() {
                    super.focusLost();
                    if (getActiveObject() == this)
                        setActiveObject(null);
                }
            };
        }
    }
    movingFunctions.put(function, movingFunction);
    return movingFunction;
}
Also used : DFDFunction(com.ramussoft.pb.dfd.visual.DFDFunction) DFDSRole(com.ramussoft.pb.dfds.visual.DFDSRole) DataStore(com.ramussoft.pb.dfd.visual.DataStore) External(com.ramussoft.pb.dfd.visual.External) DFDSFunction(com.ramussoft.pb.dfds.visual.DFDSFunction)

Example 2 with DFDFunction

use of com.ramussoft.pb.dfd.visual.DFDFunction in project ramus by Vitaliy-Yakovchuk.

the class MovingArea method editActive.

/**
 * Якщо виділений якийсь об’єкт, тоді з’являється діалогове вікно для роботи
 * з його властивостями.
 */
@SuppressWarnings("unused")
public void editActive() {
    if ((Metadata.EDUCATIONAL) && (Math.random() < 0.2d)) {
        AttributePlugin plugin = panel.getFramework().findAttributePlugin(new AttributeType("Core", "Table", false));
        if (!(plugin instanceof EmptyPlugin)) {
            System.exit(233);
        }
    }
    if ((activeObject instanceof MovingFunction) || (activeObject instanceof DFDFunction)) {
        final IDEF0Object movingFunction = (IDEF0Object) activeObject;
        // String text = movingFunction.getFunction().getName();
        panel.getFunctionOptions().showModal(movingFunction);
    /*
			 * if(!text.equals(movingFunction.getFunction().getName()))
			 * movingFunction.resetBounds();
			 */
    } else if (activeObject instanceof DFDSRole) {
        panel.getDFDSRoleOptionsDialog().showModal((DFDSRole) activeObject);
    } else if (activeObject instanceof DFDObject) {
        panel.getDFDObjectOptionsDialog().showModal((DFDObject) activeObject);
    } else if (activeObject instanceof MovingText)
        panel.getTextOptionsDialog().showModal((MovingText) activeObject);
    else if (activeObject instanceof PaintSector.Pin) {
        panel.getArrowOptionsDialog().showModal(((PaintSector.Pin) activeObject).getSector(), this);
    // setPanels();
    }
    repaintAsync();
}
Also used : EmptyPlugin(com.ramussoft.gui.common.EmptyPlugin) DFDFunction(com.ramussoft.pb.dfd.visual.DFDFunction) DFDSRole(com.ramussoft.pb.dfds.visual.DFDSRole) AttributePlugin(com.ramussoft.gui.common.AttributePlugin) Pin(com.ramussoft.pb.idef.elements.PaintSector.Pin) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) AttributeType(com.ramussoft.common.AttributeType) DFDObject(com.ramussoft.pb.dfd.visual.DFDObject)

Aggregations

DFDFunction (com.ramussoft.pb.dfd.visual.DFDFunction)2 DFDSRole (com.ramussoft.pb.dfds.visual.DFDSRole)2 AttributeType (com.ramussoft.common.AttributeType)1 AttributePlugin (com.ramussoft.gui.common.AttributePlugin)1 EmptyPlugin (com.ramussoft.gui.common.EmptyPlugin)1 DFDObject (com.ramussoft.pb.dfd.visual.DFDObject)1 DataStore (com.ramussoft.pb.dfd.visual.DataStore)1 External (com.ramussoft.pb.dfd.visual.External)1 DFDSFunction (com.ramussoft.pb.dfds.visual.DFDSFunction)1 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)1 Pin (com.ramussoft.pb.idef.elements.PaintSector.Pin)1