GED: Arc Properties
[scilab.git] / scilab / modules / gui / src / java / org / scilab / modules / gui / ged / SwapObject.java
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2012 2013 - Marcos CARDINOT
4  *
5  * This file must be used under the terms of the CeCILL.
6  * This source file is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution.  The terms
8  * are also available at
9  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10  *
11  */
12 package org.scilab.modules.gui.ged;
13
14 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
15 import org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties;
16 import org.scilab.modules.gui.ged.graphic_objects.arc.Arc;
17 import org.scilab.modules.gui.ged.graphic_objects.axes.Axes;
18 import org.scilab.modules.gui.ged.graphic_objects.champ.Champ;
19 import org.scilab.modules.gui.ged.graphic_objects.datatip.Datatip;
20 import org.scilab.modules.gui.ged.graphic_objects.fec.Fec;
21 import org.scilab.modules.gui.ged.graphic_objects.figure.Figure;
22 import org.scilab.modules.gui.ged.graphic_objects.imageplot.Imageplot;
23 import org.scilab.modules.gui.ged.graphic_objects.label.Label;
24 import org.scilab.modules.gui.ged.graphic_objects.legend.Legend;
25 import org.scilab.modules.gui.ged.graphic_objects.polyline.Polyline;
26 import org.scilab.modules.gui.ged.graphic_objects.rectangle.Rectangle;
27 import org.scilab.modules.gui.ged.graphic_objects.segs.Segs;
28 import org.scilab.modules.gui.ged.graphic_objects.surface.Surface;
29
30 /**
31 * Manager object exchange.
32 *
33 * @author Marcos CARDINOT <mcardinot@gmail.com>
34 */
35 public class SwapObject {
36     private static int lastType;
37
38     /**
39     * Manager which property window will open.
40     * @param objectID Enters the identification of object.
41     */
42     public SwapObject(String objectID) {
43         Integer type = (Integer) GraphicController.getController().getProperty(objectID, GraphicObjectProperties.__GO_TYPE__);
44         lastType = type;
45         switch (type) {
46             case GraphicObjectProperties.__GO_POLYLINE__:
47                 Polyline polyline = new Polyline(objectID);
48                 SwingInspector.setPanel(polyline, MessagesGED.polyline);
49                 break;
50             case GraphicObjectProperties.__GO_PLOT3D__:
51                 Surface plot3d = new Surface(objectID);
52                 SwingInspector.setPanel(plot3d, MessagesGED.plot3d);
53                 break;
54             case GraphicObjectProperties.__GO_GRAYPLOT__:
55                 Imageplot grayplot = new Imageplot(objectID);
56                 SwingInspector.setPanel(grayplot, MessagesGED.grayplot);
57                 break;
58             case GraphicObjectProperties.__GO_FAC3D__:
59                 Surface fac3d = new Surface(objectID);
60                 SwingInspector.setPanel(fac3d, MessagesGED.fac3d);
61                 break;
62             case GraphicObjectProperties.__GO_MATPLOT__:
63                 Imageplot matplot = new Imageplot(objectID);
64                 SwingInspector.setPanel(matplot, MessagesGED.matplot);
65                 break;
66             case GraphicObjectProperties.__GO_LEGEND__:
67                 Legend legend = new Legend(objectID);
68                 SwingInspector.setPanel(legend, MessagesGED.legend);
69                 break;
70             case GraphicObjectProperties.__GO_LABEL__:
71                 Label label = new Label(objectID);
72                 SwingInspector.setPanel(label, MessagesGED.label);
73                 break;
74             case GraphicObjectProperties.__GO_ARC__:
75                 Arc arc = new Arc(objectID);
76                 SwingInspector.setPanel(arc, MessagesGED.arc);
77                 break;
78             case GraphicObjectProperties.__GO_CHAMP__:
79                 Champ champ = new Champ(objectID);
80                 SwingInspector.setPanel(champ, MessagesGED.champ);
81                 break;
82             case GraphicObjectProperties.__GO_FEC__:
83                 Fec fec = new Fec(objectID);
84                 SwingInspector.setPanel(fec, MessagesGED.fec);
85                 break;
86             case GraphicObjectProperties.__GO_RECTANGLE__:
87                 Rectangle rectangle = new Rectangle(objectID);
88                 SwingInspector.setPanel(rectangle, MessagesGED.rectangle);
89                 break;
90             case GraphicObjectProperties.__GO_SEGS__:
91                 Segs segs = new Segs(objectID);
92                 SwingInspector.setPanel(segs, MessagesGED.segs);
93                 break;
94             case GraphicObjectProperties.__GO_DATATIP__:
95                 Datatip datatip = new Datatip(objectID);
96                 SwingInspector.setPanel(datatip, MessagesGED.datatip);
97                 break;
98             case GraphicObjectProperties.__GO_AXES__:
99                 Axes axes = new Axes(objectID);
100                 SwingInspector.setPanel(axes, MessagesGED.axes);
101                 break;
102             default:
103                 try {
104                     Figure figure = new Figure(objectID);
105                     SwingInspector.setPanel(figure, MessagesGED.figure);
106                 } catch (NullPointerException e) { }
107                 break;
108         }
109     }
110
111     /**
112     * Get the last type of object.
113     * @return type
114     */
115     public static int getLastType() {
116         return lastType;
117     }
118 }