Package research

Source Code of research.SaturnToolBar

package research;

import research.tool.*;
import research.figure.*;
import research.connection.LineConnection;
import research.connection.ElbowConnection;
import research.connection.ElbowConnection2;
import research.toolAction.*;

import javax.swing.*;

/**
* author: zhangwei
* Date: 2003-5-10
* Time: 22:07:00
*/

public class SaturnToolBar extends JToolBar {

    protected final ToolActionController controller = new ToolActionController();

    public SaturnToolBar() {

        ToolAction toolAction = null;
        ImageIcon toolIcon = null;
        ToolButton tooButton = null;

        toolAction = new ToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/select.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Select, Move and Resize Figures");
        toolAction.putValue(ToolAction.TOOL, new SelectionTool());
        controller.addToolAction(toolAction);
        controller.setDefaultToolAction(toolAction);
        toolAction.setSelected(true);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new CreationToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/rect.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Rectangle Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new RectangleFigure());
        toolAction.putValue(ToolAction.TOOL, new CreationTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new CreationToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/round_rect.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Round Rectangle Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new RoundRectangleFigure());
        toolAction.putValue(ToolAction.TOOL, new CreationTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new CreationToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/ellipse.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Ellipse Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new EllipseFigure());
        toolAction.putValue(ToolAction.TOOL, new CreationTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new CreationToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/triangle.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Triangle Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new TriangleFigure());
        toolAction.putValue(ToolAction.TOOL, new CreationTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new CreationToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/diamond.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Diamond Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new DiamondFigure());
        toolAction.putValue(ToolAction.TOOL, new CreationTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new CreationToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/rect.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Component Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new ComponentFigure());
        toolAction.putValue(ToolAction.TOOL, new CreationTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new ConnectionToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/line_connection.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Line Connection Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new LineConnection());
        toolAction.putValue(ToolAction.TOOL, new ConnectionTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        /**
         toolAction = new ConnectionToolAction();
         toolIcon = new ImageIcon(getClass().getResource("image/elbow_connection.png"));
         toolAction.putValue(Action.SMALL_ICON, toolIcon);
         toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Elbow Connection Figure");
         toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new ElbowConnection());
         toolAction.putValue(ToolAction.TOOL, new ConnectionTool());
         controller.addToolAction(toolAction);
         toolAction.setSelected(false);
         tooButton = new ToolButton(toolAction);
         this.add(tooButton);
         **/

        toolAction = new ConnectionToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/ns_elbow_connection.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Elbow Connection Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new ElbowConnection2(ElbowConnection2.V_V_MODE));
        toolAction.putValue(ToolAction.TOOL, new ConnectionTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new ConnectionToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/we_elbow_connection.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Elbow Connection Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new ElbowConnection2(ElbowConnection2.H_H_MODE));
        toolAction.putValue(ToolAction.TOOL, new ConnectionTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new TextToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/label.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Text Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new TextFigure());
        toolAction.putValue(ToolAction.TOOL, new ConnectedTextTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new TextToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/label.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Text Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new TextFigure0());
        toolAction.putValue(ToolAction.TOOL, new ConnectedTextTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);

        toolAction = new TextAreaToolAction();
        toolIcon = new ImageIcon(getClass().getResource("image/text.png"));
        toolAction.putValue(Action.SMALL_ICON, toolIcon);
        toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Text Figure");
        toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new TextAreaFigure());
        toolAction.putValue(ToolAction.TOOL, new ConnectedTextAreaTool());
        controller.addToolAction(toolAction);
        toolAction.setSelected(false);
        tooButton = new ToolButton(toolAction);
        this.add(tooButton);
       
    }

    public ToolActionController getController() {
        return controller;
    }

}
TOP

Related Classes of research.SaturnToolBar

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.