add scrollable property in ui_frame
[scilab.git] / scilab / modules / graphic_objects / src / java / org / scilab / modules / graphic_objects / xmlloader / GOBuilder.java
1 package org.scilab.modules.graphic_objects.xmlloader;
2
3 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_DOCKABLE__;
4 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BORDER_OPT_PADDING__;
5 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_GRID__;
6 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_PADDING__;
7 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_INFOBAR_VISIBLE__;
8 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT__;
9 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LINE_THICKNESS__;
10 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_MARGINS__;
11 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_MENUBAR_VISIBLE__;
12 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_NAME__;
13 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
14 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_RESIZE__;
15 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_SIZE__;
16 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_STYLE__;
17 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TAG__;
18 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TITLE__;
19 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TOOLBAR_VISIBLE__;
20 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TYPE__;
21 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_BORDER_POSITION__;
22 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_CHECKBOX__;
23 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTANGLE__;
24 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTNAME__;
25 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTSIZE__;
26 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTWEIGHT__;
27 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_COLOR__;
28 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_HIGHLIGHT_IN__;
29 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__;
30 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_IN_BORDER__;
31 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_JUSTIFICATION__;
32 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_OUT_BORDER__;
33 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_POSITION__;
34 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_ROUNDED__;
35 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_SHADOW_IN__;
36 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_SHADOW_OUT__;
37 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_STYLE__;
38 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER_TITLE__;
39 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
40 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME__;
41 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GRIDBAG_ANCHOR__;
42 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GRIDBAG_FILL__;
43 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GRIDBAG_GRID__;
44 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GRIDBAG_PADDING__;
45 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GRIDBAG_WEIGHT__;
46 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_HORIZONTALALIGNMENT__;
47 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
48 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_PUSHBUTTON__;
49 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SCROLLABLE__;
50 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
51 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TAB__;
52 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TEXT__;
53 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VISIBLE__;
54 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_SCROLLABLE__;
55
56 import java.util.Map;
57
58 import org.scilab.modules.graphic_objects.builder.Builder;
59 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
60 import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
61 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
62 import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorder;
63 import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorder.BorderType;
64 import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorderType;
65 import org.scilab.modules.graphic_objects.utils.LayoutType;
66 import org.xml.sax.Attributes;
67
68 public class GOBuilder {
69     public static Integer figureBuilder(GraphicController controller, Attributes attributes) {
70         Integer fig = Builder.createFigure(false, 0, 0, false, false);
71         //Integer fig = Builder.createNewFigureWithAxes();
72         String item = null;
73
74         // hide toolbar
75         controller.setProperty(fig, __GO_TOOLBAR_VISIBLE__, false);
76
77         // hide menubar
78         controller.setProperty(fig, __GO_MENUBAR_VISIBLE__, false);
79
80         // hide infobar
81         controller.setProperty(fig, __GO_INFOBAR_VISIBLE__, false);
82
83         // remove docking bar
84         controller.setProperty(fig, __GO_DOCKABLE__, false);
85
86         // id
87         XmlTools.setPropAsString(fig, __GO_TAG__, attributes.getValue("id"));
88
89         // position
90         Integer[] position = (Integer[]) controller.getProperty(fig, __GO_POSITION__);
91
92         // posX
93         item = attributes.getValue("posX");
94         if (item != null) {
95             position[0] = Integer.parseInt(item);
96         }
97
98         // posY
99         item = attributes.getValue("posY");
100         if (item != null) {
101             position[1] = Integer.parseInt(item);
102         }
103
104         // set position
105         controller.setProperty(fig, __GO_POSITION__, position);
106
107         Integer[] size = (Integer[]) controller.getProperty(fig, __GO_SIZE__);
108         // width
109         item = attributes.getValue("width");
110         if (item != null) {
111             size[0] = Integer.parseInt(item);
112         }
113
114         // height
115         item = attributes.getValue("height");
116         if (item != null) {
117             size[1] = Integer.parseInt(item);
118         }
119
120         // set size
121         controller.setProperty(fig, __GO_SIZE__, size);
122
123         // title
124         XmlTools.setPropAsString(fig, __GO_NAME__, attributes.getValue("title"));
125
126         // icon
127         // XmlTools.setPropAsString(fig, __GO_ICON__,
128         // attributes.getValue("icon"));
129
130         // resizable
131         XmlTools.setPropAsBoolean(fig, __GO_RESIZE__, attributes.getValue("resizable"));
132
133         // layout and layout_options
134         item = attributes.getValue("layout");
135         if (item == null) {
136             item = "name:border"; //default layout is border
137         }
138
139
140         setLayoutProperty(controller, fig, item);
141
142         // visible
143         XmlTools.setPropAsBoolean(fig, __GO_VISIBLE__, attributes.getValue("visible"));
144
145         return fig;
146     }
147
148     public static Integer uicontrolBuilder(GraphicController controller, int type, Attributes attributes, int parent) {
149         if (type == __GO_UI_FRAME__) {
150             String item = attributes.getValue("scrollable");
151             if (item != null && item.equals("true")) {
152                 type = __GO_UI_FRAME_SCROLLABLE__;
153             }
154         }
155
156         Integer uic = controller.askObject(GraphicObject.getTypeFromName(type));
157         return uicontrolUpdater(controller, uic, attributes, parent);
158     }
159
160     public static Integer uicontrolUpdater(GraphicController controller, int uic, Attributes attributes, int parent) {
161         return uicontrolUpdater(controller, uic, attributes, parent, null);
162     }
163
164     public static Integer uicontrolUpdater(GraphicController controller, int uic, Attributes attributes, int parent, Map<String, String> fromModel) {
165         String item = null;
166
167         try {
168             Map<String, String> map = null;
169             // Common attributes
170
171             // id
172             XmlTools.setPropAsString(uic, __GO_TAG__, attributes.getValue("id"));
173
174             // layout and layout_options
175             item = attributes.getValue("layout");
176             if (item == null) {
177                 if (fromModel != null) {
178                     item = fromModel.get("layout");
179                 }
180             }
181
182             if (item == null) {
183                 item = "name:none";
184             }
185             setLayoutProperty(controller, uic, item);
186
187             //visible
188             item = attributes.getValue("visible");
189             if (item != null) {
190                 if (item == null || item.equals("true")) {
191                     System.out.println("setVisible true");
192                     controller.setProperty(uic, __GO_VISIBLE__, true);
193                 } else {
194                     System.out.println("setVisible false");
195                     controller.setProperty(uic, __GO_VISIBLE__, false);
196                 }
197             }
198             // constraints
199
200             // get parent layout
201             LayoutType layout = LayoutType.NONE;
202             if (parent != 0) {
203                 layout = LayoutType.intToEnum((Integer) controller.getProperty(parent, __GO_LAYOUT__));
204             }
205
206             if (layout != LayoutType.NONE) {
207                 item = attributes.getValue("constraint");
208                 if (item == null && fromModel != null) {
209                     // use value from model if property is not in "declaration"
210                     item = XmlTools.getFromMap(fromModel, "constraint");
211                 }
212
213                 if (item != null) {
214                     map = CSSParser.parseLine(item);
215                 }
216
217                 switch (layout) {
218                     case BORDER: {
219                         item = XmlTools.getFromMap(map, "position", "center");
220                         controller.setProperty(uic, __GO_UI_BORDER_POSITION__, Uicontrol.BorderLayoutType.stringToEnum(item).ordinal());
221                         break;
222                     }
223                     case GRIDBAG: {
224                         Integer[] grid = new Integer[] { 0, 0, 0, 0 };
225                         grid[0] = Integer.parseInt(XmlTools.getFromMap(map, "gridx", "0"));
226                         grid[1] = Integer.parseInt(XmlTools.getFromMap(map, "gridy", "0"));
227                         grid[2] = Integer.parseInt(XmlTools.getFromMap(map, "gridwidth", "1"));
228                         grid[3] = Integer.parseInt(XmlTools.getFromMap(map, "gridheight", "1"));
229
230                         Double[] weight = new Double[] { 0.0, 0.0 };
231                         weight[0] = Double.parseDouble(XmlTools.getFromMap(map, "weightx", "1.0"));
232                         weight[1] = Double.parseDouble(XmlTools.getFromMap(map, "weighty", "1.0"));
233
234                         Integer fill = Uicontrol.FillType.stringToEnum(XmlTools.getFromMap(map, "fill", "none")).ordinal();
235                         Integer anchor = Uicontrol.AnchorType.stringToEnum(XmlTools.getFromMap(map, "anchor", "center")).ordinal();
236
237                         Integer[] padding = new Integer[] { 0, 0 };
238                         padding[0] = Integer.parseInt(XmlTools.getFromMap(map, "ipadx", "0"));
239                         padding[1] = Integer.parseInt(XmlTools.getFromMap(map, "ipady", "0"));
240
241                         controller.setProperty(uic, __GO_UI_GRIDBAG_GRID__, grid);
242                         controller.setProperty(uic, __GO_UI_GRIDBAG_WEIGHT__, weight);
243                         controller.setProperty(uic, __GO_UI_GRIDBAG_FILL__, fill);
244                         controller.setProperty(uic, __GO_UI_GRIDBAG_ANCHOR__, anchor);
245                         controller.setProperty(uic, __GO_UI_GRIDBAG_PADDING__, padding);
246                         break;
247                     }
248                     default:
249                         break;
250                 }
251
252                 // insets -> marging
253                 String insets = XmlTools.getFromMap(map, "insets", "0,0,0,0");
254                 Double[] margins = new Double[] { 0.0, 0.0, 0.0, 0.0 };
255                 String[] insert = insets.split(",");
256                 for (int i = 0; i < insert.length && i < 4; i++) {
257                     margins[i] = Double.parseDouble(insert[i]);
258                 }
259
260                 controller.setProperty(uic, __GO_MARGINS__, margins);
261             }
262
263             // specific attributes
264             Integer type = (Integer) controller.getProperty(uic, __GO_STYLE__);
265             switch (type) {
266                 case __GO_UI_FRAME__: {
267                     // border
268                     item = attributes.getValue("border");
269                     if (item == null && fromModel != null) {
270                         // use value from model if property is not in
271                         // "declaration"
272                         item = XmlTools.getFromMap(fromModel, "border");
273                     }
274
275                     if (item != null) {
276                         map = CSSParser.parseLine(item);
277                     }
278
279                     FrameBorderType borderType = FrameBorderType.stringToEnum(XmlTools.getFromMap(map, "name", "none"));
280                     Integer border = createBorder(controller, uic, borderType, map);
281                     controller.setProperty(uic, __GO_UI_FRAME_BORDER__, border);
282
283                     String[] text = new String[1];
284                     text[0] = attributes.getValue("tab-title");
285                     if (text[0] != null) {
286                         controller.setProperty(uic, __GO_UI_STRING__, text);
287                     }
288
289                     item = attributes.getValue("scrollable");
290                     if (item == null || item.equals("false")) {
291                         controller.setProperty(uic, __GO_UI_SCROLLABLE__, false);
292                     } else {
293                         controller.setProperty(uic, __GO_UI_SCROLLABLE__, true);
294                     }
295
296                     break;
297                 }
298
299                 case __GO_UI_TAB__: {
300                     item = attributes.getValue("ui-style");
301                     if (item != null) {
302                         map = CSSParser.parseLine(item);
303                         item = XmlTools.getFromMap(map, "bold", "false");
304                         if (item.equals("true")) {
305                             controller.setProperty(uic, __GO_UI_FONTWEIGHT__, "bold");
306                         }
307
308                         item = XmlTools.getFromMap(map, "italic", "false");
309                         if (item.equals("true")) {
310                             controller.setProperty(uic, __GO_UI_FONTANGLE__, "italic");
311                         }
312                     }
313                     break;
314                 }
315                 case __GO_UI_CHECKBOX__: {
316                     controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "left");
317
318                     String[] text = new String[1];
319                     text[0] = attributes.getValue("text");
320                     if (text[0] != null) {
321                         controller.setProperty(uic, __GO_UI_STRING__, text);
322                     }
323                     break;
324                 }
325                 case __GO_UI_PUSHBUTTON__: {
326                     String[] text = new String[1];
327                     text[0] = attributes.getValue("text");
328                     if (text[0] != null) {
329                         controller.setProperty(uic, __GO_UI_STRING__, text);
330                     }
331                     break;
332                 }
333                 case __GO_UI_TEXT__:
334                     controller.setProperty(uic, __GO_UI_HORIZONTALALIGNMENT__, "left");
335                     String[] text = new String[1];
336                     text[0] = attributes.getValue("text");
337                     if (text[0] != null) {
338                         controller.setProperty(uic, __GO_UI_STRING__, text);
339                     }
340
341                     String columns = attributes.getValue("columns");
342                     if (columns != null) {
343                         System.out.println("columns : " + columns);
344                         controller.setProperty(uic, __GO_UI_MAX__, Double.parseDouble(columns));
345                     }
346                     break;
347             }
348
349         } catch (CSSParserException e) {
350             e.printStackTrace();
351         }
352
353         return uic;
354     }
355
356     private static void setLayoutProperty(GraphicController controller, Integer uid, String item) {
357         try {
358             Map<String, String> map = null;
359             map = CSSParser.parseLine(item);
360             item = map.get("name");
361             LayoutType layout = LayoutType.stringToEnum(item);
362             controller.setProperty(uid, __GO_LAYOUT__, layout.ordinal());
363
364             // layout_options
365             switch (layout) {
366                 case BORDER: {
367                     Integer[] pad = new Integer[] { 0, 0 };
368                     pad[0] = Integer.parseInt(XmlTools.getFromMap(map, "hgap", "0"));
369                     pad[1] = Integer.parseInt(XmlTools.getFromMap(map, "vgap", "0"));
370
371                     controller.setProperty(uid, __GO_BORDER_OPT_PADDING__, pad);
372                     break;
373                 }
374                 case GRID: {
375                     Integer[] grid = new Integer[] { 0, 0 };
376                     grid[0] = Integer.parseInt(XmlTools.getFromMap(map, "rows", "0"));
377                     grid[1] = Integer.parseInt(XmlTools.getFromMap(map, "cols", "0"));
378
379                     Integer[] pad = new Integer[] { 0, 0 };
380                     pad[0] = Integer.parseInt(XmlTools.getFromMap(map, "hgap", "0"));
381                     pad[1] = Integer.parseInt(XmlTools.getFromMap(map, "vgap", "0"));
382
383                     controller.setProperty(uid, __GO_GRID_OPT_GRID__, grid);
384                     controller.setProperty(uid, __GO_GRID_OPT_PADDING__, pad);
385                     break;
386                 }
387                 default:
388                 case GRIDBAG:
389                 case NONE:
390                     // nothing to do
391                     break;
392             }
393         } catch (CSSParserException e) {
394             e.printStackTrace();
395         }
396
397     }
398
399     private static Integer createBorder(GraphicController controller, Integer uic, FrameBorderType borderType, Map<String, String> map) {
400         Integer border = controller.askObject(GraphicObject.getTypeFromName(__GO_UI_FRAME_BORDER__));
401         controller.setProperty(border, __GO_UI_FRAME_BORDER_STYLE__, borderType.ordinal());
402
403         switch (borderType) {
404             case SOFTBEVEL:
405             case BEVEL: {
406                 BorderType etching = BorderType.stringToEnum(XmlTools.getFromMap(map, "type", "none"));
407                 String color = XmlTools.getFromMap(map, "color", "black");
408
409                 controller.setProperty(border, __GO_TYPE__, etching.ordinal());
410                 controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, color);
411                 controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__, color);
412                 controller.setProperty(border, __GO_UI_FRAME_BORDER_SHADOW_OUT__, color);
413                 controller.setProperty(border, __GO_UI_FRAME_BORDER_SHADOW_IN__, color);
414                 break;
415             }
416             case COMPOUND: {
417                 FrameBorderType borderOut = FrameBorderType.stringToEnum(XmlTools.getFromMap(map, "border-out", "none"));
418                 FrameBorderType borderIn = FrameBorderType.stringToEnum(XmlTools.getFromMap(map, "border-in", "none"));
419
420                 Integer out = createBorder(controller, border, borderOut, map);
421                 Integer in = createBorder(controller, border, borderIn, map);
422
423                 controller.setProperty(border, __GO_UI_FRAME_BORDER_OUT_BORDER__, out);
424                 controller.setProperty(border, __GO_UI_FRAME_BORDER_IN_BORDER__, in);
425
426                 break;
427             }
428             case EMPTY: {
429                 Double[] position = new Double[4];
430                 position[0] = Double.parseDouble(XmlTools.getFromMap(map, "top", "0"));
431                 position[1] = Double.parseDouble(XmlTools.getFromMap(map, "left", "0"));
432                 position[2] = Double.parseDouble(XmlTools.getFromMap(map, "right", "0"));
433                 position[3] = Double.parseDouble(XmlTools.getFromMap(map, "bottom", "0"));
434
435                 controller.setProperty(border, __GO_POSITION__, position);
436                 break;
437             }
438             case ETCHED: {
439                 BorderType etching = BorderType.stringToEnum(XmlTools.getFromMap(map, "type", "none"));
440                 String color = XmlTools.getFromMap(map, "color", "black");
441
442                 controller.setProperty(border, __GO_TYPE__, etching.ordinal());
443                 controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__, color);
444                 controller.setProperty(border, __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__, color);
445                 break;
446             }
447             case LINE: {
448                 String color = XmlTools.getFromMap(map, "color", "black");
449                 Integer thickness = Integer.parseInt(XmlTools.getFromMap(map, "thickness", "1"));
450                 Boolean rounded = Boolean.parseBoolean(XmlTools.getFromMap(map, "rounded", "false"));
451
452                 controller.setProperty(border, __GO_UI_FRAME_BORDER_COLOR__, color);
453                 controller.setProperty(border, __GO_LINE_THICKNESS__, thickness);
454                 controller.setProperty(border, __GO_UI_FRAME_BORDER_ROUNDED__, rounded);
455                 break;
456             }
457             case MATTE: {
458                 Double[] position = new Double[4];
459                 position[0] = Double.parseDouble(XmlTools.getFromMap(map, "top", "0"));
460                 position[1] = Double.parseDouble(XmlTools.getFromMap(map, "left", "0"));
461                 position[2] = Double.parseDouble(XmlTools.getFromMap(map, "right", "0"));
462                 position[3] = Double.parseDouble(XmlTools.getFromMap(map, "bottom", "0"));
463                 String color = XmlTools.getFromMap(map, "color", "black");
464
465                 controller.setProperty(border, __GO_POSITION__, position);
466                 controller.setProperty(border, __GO_UI_FRAME_BORDER_COLOR__, color);
467                 break;
468             }
469             case TITLED: {
470
471                 FrameBorderType borderOut = FrameBorderType.stringToEnum(XmlTools.getFromMap(map, "border", "none"));
472                 Integer out = createBorder(controller, border, borderOut, map);
473                 String title = XmlTools.getFromMap(map, "title", "");
474                 FrameBorder.JustificationType justify = FrameBorder.JustificationType.stringToEnum(XmlTools.getFromMap(map, "justify", "leading"));
475                 String fontName = XmlTools.getFromMap(map, "font-name", "");
476                 String fontAngle = XmlTools.getFromMap(map, "italic", "false") == "false" ? "normal" : "italic";
477                 Integer fontSize = Integer.parseInt(XmlTools.getFromMap(map, "font-size", "0"));
478                 String fontWeight = XmlTools.getFromMap(map, "bold", "false") == "false" ? "normal" : "bold";
479
480                 FrameBorder.TitlePositionType position = FrameBorder.TitlePositionType.stringToEnum(XmlTools.getFromMap(map, "position", "leading"));
481
482                 String color = XmlTools.getFromMap(map, "color", "black");
483
484                 controller.setProperty(border, __GO_UI_FRAME_BORDER_OUT_BORDER__, out);
485
486                 controller.setProperty(border, __GO_UI_FRAME_BORDER_TITLE__, out);
487                 controller.setProperty(border, __GO_TITLE__, title);
488                 controller.setProperty(border, __GO_UI_FRAME_BORDER_JUSTIFICATION__, justify.ordinal());
489                 controller.setProperty(border, __GO_UI_FONTNAME__, fontName);
490                 controller.setProperty(border, __GO_UI_FONTANGLE__, fontAngle);
491                 controller.setProperty(border, __GO_UI_FONTSIZE__, fontSize);
492                 controller.setProperty(border, __GO_UI_FONTWEIGHT__, fontWeight);
493                 controller.setProperty(border, __GO_UI_FRAME_BORDER_POSITION__, position.ordinal());
494                 controller.setProperty(border, __GO_UI_FRAME_BORDER_COLOR__, color);
495
496                 break;
497             }
498             case NONE:
499             default:
500                 break;
501         }
502
503         return border;
504     }
505
506 }