Add a property to manage L&F for uicontrols in GUIs. 20/13620/5
Vincent COUVERT [Fri, 31 Jan 2014 13:20:30 +0000 (14:20 +0100)]
Change-Id: Ib56c758d13d52094c9a41f65725fe16fc4da5072

38 files changed:
scilab/modules/graphic_objects/includes/graphicObjectProperties.h
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/console/Console.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObjectProperties.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/Uicontrol.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/checkbox/CheckBox.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/edit/Edit.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/frame/Frame.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/listbox/ListBox.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/popupmenu/PopupMenu.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/pushbutton/PushButton.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/radiobutton/RadioButton.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/slider/Slider.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/uiimage/UiImage.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/uicontrol/uitext/UiText.java
scilab/modules/graphic_objects/src/scripts/propertiesMap.properties
scilab/modules/graphics/Gui_Import.def
scilab/modules/graphics/macros/%h_p.sci
scilab/modules/graphics/src/c/getHandleProperty/GetHashTable.c
scilab/modules/graphics/src/c/getHandleProperty/SetHashTable.c
scilab/modules/gui/includes/GetConsoleShowHiddenHandles.h
scilab/modules/gui/includes/SetConsoleShowHiddenHandles.h
scilab/modules/gui/src/cpp/GetConsoleShowHiddenHandles.cpp
scilab/modules/gui/src/cpp/SetConsoleShowHiddenHandles.cpp
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingView.java
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingViewWidget.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/checkbox/SwingScilabCheckBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabEditBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/frame/SwingScilabFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/label/SwingScilabLabel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/popupmenu/SwingScilabPopupMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/pushbutton/SwingScilabPushButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/radiobutton/SwingScilabRadioButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabScroll.java [new file with mode: 0644]
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabSlider.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabDockablePanel.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/window/SwingScilabDockingWindow.java
scilab/modules/gui/src/java/org/scilab/modules/gui/slider/ScilabSliderBridge.java

index 84319e8..50ae396 100755 (executable)
 #define __GO_UI_ICON__ 306
 #define __GO_CONSOLE__ 307
 #define __GO_SHOWHIDDENHANDLES__ 308
-#define __GO_WAITBAR__ 309
-#define __GO_PROGRESSIONBAR__ 310
-#define __GO_UI_MESSAGE__ 311
-#define __GO_UI_MESSAGE_SIZE__ 312
-#define __GO_DATATIP__ 313
-#define __GO_DATATIP_DATA__ 314
-#define __GO_DATATIP_ORIENTATION__ 315
-#define __GO_DATATIP_3COMPONENT__ 316
-#define __GO_DATATIP_AUTOORIENTATION__ 317
-#define __GO_DATATIP_INTERP_MODE__ 318
-#define __GO_DATATIP_DISPLAY_FNC__ 319
-#define __GO_DATATIP_BOX_MODE__ 320
-#define __GO_DATATIP_LABEL_MODE__ 321
-#define __GO_AMBIENTCOLOR__ 322
-#define __GO_DIFFUSECOLOR__ 323
-#define __GO_SPECULARCOLOR__ 324
-#define __GO_COLOR_MATERIAL__ 325
-#define __GO_MATERIAL_SHININESS__ 326
-#define __GO_LIGHT__ 327
-#define __GO_LIGHT_TYPE__ 328
-#define __GO_DATATIPS__ 329
-#define __GO_DATATIPS_COUNT__ 330
-#define __GO_DATATIP_INDEXES__ 331
-#define __GO_DATA_MODEL_DISPLAY_FUNCTION__ 332
-#define __GO_DATA_MODEL_DISPLAY_FUNCTION_SIZE__ 333
-#define __GO_RESIZE__ 334
-#define __GO_TOOLBAR__ 335
-#define __GO_TOOLBAR_VISIBLE__ 336
-#define __GO_MENUBAR__ 337
-#define __GO_MENUBAR_VISIBLE__ 338
-#define __GO_INFOBAR_VISIBLE__ 339
-#define __GO_DOCKABLE__ 340
-#define __GO_LAYOUT__ 341
-#define __GO_LAYOUT_SET__ 342
-#define __GO_UI_TAB__ 343
-#define __GO_UI_GRIDBAG_GRID__ 344
-#define __GO_UI_GRIDBAG_WEIGHT__ 345
-#define __GO_UI_GRIDBAG_FILL__ 346
-#define __GO_UI_GRIDBAG_ANCHOR__ 347
-#define __GO_UI_GRIDBAG_PADDING__ 348
-#define __GO_UI_GRID_GRID__ 349
-#define __GO_UI_GRID_PADDING__ 350
-#define __GO_UI_BORDER_POSITION__ 351
-#define __GO_GRID_OPT_GRID__ 352
-#define __GO_GRID_OPT_PADDING__ 353
-#define __GO_BORDER_OPT_PADDING__ 354
-#define __GO_UI_FRAME_BORDER__ 355
-#define __GO_UI_FRAME_BORDER_COLOR__ 356
-#define __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__ 357
-#define __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__ 358
-#define __GO_UI_FRAME_BORDER_IN_BORDER__ 359
-#define __GO_UI_FRAME_BORDER_JUSTIFICATION__ 360
-#define __GO_UI_FRAME_BORDER_OUT_BORDER__ 361
-#define __GO_UI_FRAME_BORDER_ROUNDED__ 362
-#define __GO_UI_FRAME_BORDER_SHADOW_IN__ 363
-#define __GO_UI_FRAME_BORDER_SHADOW_OUT__ 364
-#define __GO_UI_FRAME_BORDER_TITLE__ 365
-#define __GO_UI_FRAME_BORDER_POSITION__ 366
-#define __GO_UI_FRAME_BORDER_STYLE__ 367
-#define __GO_UI_GROUP_NAME__ 368
-#define __GO_UI_TITLE_POSITION__ 369
-#define __GO_UI_TITLE_SCROLL__ 370
-#define __GO_UI_FRAME_BORDER_TYPE__ 371
+#define __GO_USEDEPRECATEDLF__ 309
+#define __GO_WAITBAR__ 310
+#define __GO_PROGRESSIONBAR__ 311
+#define __GO_UI_MESSAGE__ 312
+#define __GO_UI_MESSAGE_SIZE__ 313
+#define __GO_DATATIP__ 314
+#define __GO_DATATIP_DATA__ 315
+#define __GO_DATATIP_ORIENTATION__ 316
+#define __GO_DATATIP_3COMPONENT__ 317
+#define __GO_DATATIP_AUTOORIENTATION__ 318
+#define __GO_DATATIP_INTERP_MODE__ 319
+#define __GO_DATATIP_DISPLAY_FNC__ 320
+#define __GO_DATATIP_BOX_MODE__ 321
+#define __GO_DATATIP_LABEL_MODE__ 322
+#define __GO_AMBIENTCOLOR__ 323
+#define __GO_DIFFUSECOLOR__ 324
+#define __GO_SPECULARCOLOR__ 325
+#define __GO_COLOR_MATERIAL__ 326
+#define __GO_MATERIAL_SHININESS__ 327
+#define __GO_LIGHT__ 328
+#define __GO_LIGHT_TYPE__ 329
+#define __GO_DATATIPS__ 330
+#define __GO_DATATIPS_COUNT__ 331
+#define __GO_DATATIP_INDEXES__ 332
+#define __GO_DATA_MODEL_DISPLAY_FUNCTION__ 333
+#define __GO_DATA_MODEL_DISPLAY_FUNCTION_SIZE__ 334
+#define __GO_RESIZE__ 335
+#define __GO_TOOLBAR__ 336
+#define __GO_TOOLBAR_VISIBLE__ 337
+#define __GO_MENUBAR__ 338
+#define __GO_MENUBAR_VISIBLE__ 339
+#define __GO_INFOBAR_VISIBLE__ 340
+#define __GO_DOCKABLE__ 341
+#define __GO_LAYOUT__ 342
+#define __GO_LAYOUT_SET__ 343
+#define __GO_UI_TAB__ 344
+#define __GO_UI_GRIDBAG_GRID__ 345
+#define __GO_UI_GRIDBAG_WEIGHT__ 346
+#define __GO_UI_GRIDBAG_FILL__ 347
+#define __GO_UI_GRIDBAG_ANCHOR__ 348
+#define __GO_UI_GRIDBAG_PADDING__ 349
+#define __GO_UI_GRID_GRID__ 350
+#define __GO_UI_GRID_PADDING__ 351
+#define __GO_UI_BORDER_POSITION__ 352
+#define __GO_GRID_OPT_GRID__ 353
+#define __GO_GRID_OPT_PADDING__ 354
+#define __GO_BORDER_OPT_PADDING__ 355
+#define __GO_UI_FRAME_BORDER__ 356
+#define __GO_UI_FRAME_BORDER_COLOR__ 357
+#define __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__ 358
+#define __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__ 359
+#define __GO_UI_FRAME_BORDER_IN_BORDER__ 360
+#define __GO_UI_FRAME_BORDER_JUSTIFICATION__ 361
+#define __GO_UI_FRAME_BORDER_OUT_BORDER__ 362
+#define __GO_UI_FRAME_BORDER_ROUNDED__ 363
+#define __GO_UI_FRAME_BORDER_SHADOW_IN__ 364
+#define __GO_UI_FRAME_BORDER_SHADOW_OUT__ 365
+#define __GO_UI_FRAME_BORDER_TITLE__ 366
+#define __GO_UI_FRAME_BORDER_POSITION__ 367
+#define __GO_UI_FRAME_BORDER_STYLE__ 368
+#define __GO_UI_GROUP_NAME__ 369
+#define __GO_UI_TITLE_POSITION__ 370
+#define __GO_UI_TITLE_SCROLL__ 371
+#define __GO_UI_FRAME_BORDER_TYPE__ 372
 
 #endif /* !__GRAPHIC_OBJECT_PROPERTIES_H__ */
index 2b9cad3..1de9046 100644 (file)
@@ -13,6 +13,7 @@
 package org.scilab.modules.graphic_objects.console;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CONSOLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_SHOWHIDDENHANDLES__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_USEDEPRECATEDLF__;
 
 import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
 import org.scilab.modules.graphic_objects.graphicObject.Visitor;
@@ -34,9 +35,12 @@ public final class Console extends GraphicObject {
 
     private ScilabMode scilabMode;
 
+    private boolean useDeprecatedLF = true;
+
     /** Console properties names */
     private enum ConsoleProperty {
-        SHOWHIDDENHANDLES
+        SHOWHIDDENHANDLES,
+        USEDEPRECATEDLF
     };
 
     /**
@@ -119,6 +123,8 @@ public final class Console extends GraphicObject {
     public Object getPropertyFromName(int propertyName) {
         if (propertyName == __GO_SHOWHIDDENHANDLES__) {
             return ConsoleProperty.SHOWHIDDENHANDLES;
+        } else if (propertyName == __GO_USEDEPRECATEDLF__) {
+            return ConsoleProperty.USEDEPRECATEDLF;
         } else {
             return super.getPropertyFromName(propertyName);
         }
@@ -131,6 +137,8 @@ public final class Console extends GraphicObject {
     public Object getProperty(Object property) {
         if (property == ConsoleProperty.SHOWHIDDENHANDLES) {
             return getShowHiddenHandles();
+        } else if (property == ConsoleProperty.USEDEPRECATEDLF) {
+            return getUseDeprecatedLF();
         } else {
             return super.getProperty(property);
         }
@@ -145,10 +153,25 @@ public final class Console extends GraphicObject {
     public UpdateStatus setProperty(Object property, Object value) {
         if (property == ConsoleProperty.SHOWHIDDENHANDLES) {
             setShowHiddenHandles((Boolean) value);
+        } else if (property == ConsoleProperty.USEDEPRECATEDLF) {
+            setUseDeprecatedLF((Boolean) value);
         } else {
             return super.setProperty(property, value);
         }
         return UpdateStatus.Success;
     }
 
+    public boolean getUseDeprecatedLF() {
+        return useDeprecatedLF;
+    }
+
+    public UpdateStatus setUseDeprecatedLF(boolean useDeprecatedLF) {
+        if (this.useDeprecatedLF == useDeprecatedLF) {
+            return UpdateStatus.NoChange;
+        }
+        this.useDeprecatedLF = useDeprecatedLF;
+        return UpdateStatus.Success;
+    }
+
+
 }
index 6367f0a..b48ad6e 100755 (executable)
@@ -329,68 +329,69 @@ public class GraphicObjectProperties {
     public static final int __GO_UI_ICON__ = 306;
     public static final int __GO_CONSOLE__ = 307;
     public static final int __GO_SHOWHIDDENHANDLES__ = 308;
-    public static final int __GO_WAITBAR__ = 309;
-    public static final int __GO_PROGRESSIONBAR__ = 310;
-    public static final int __GO_UI_MESSAGE__ = 311;
-    public static final int __GO_UI_MESSAGE_SIZE__ = 312;
-    public static final int __GO_DATATIP__ = 313;
-    public static final int __GO_DATATIP_DATA__ = 314;
-    public static final int __GO_DATATIP_ORIENTATION__ = 315;
-    public static final int __GO_DATATIP_3COMPONENT__ = 316;
-    public static final int __GO_DATATIP_AUTOORIENTATION__ = 317;
-    public static final int __GO_DATATIP_INTERP_MODE__ = 318;
-    public static final int __GO_DATATIP_DISPLAY_FNC__ = 319;
-    public static final int __GO_DATATIP_BOX_MODE__ = 320;
-    public static final int __GO_DATATIP_LABEL_MODE__ = 321;
-    public static final int __GO_AMBIENTCOLOR__ = 322;
-    public static final int __GO_DIFFUSECOLOR__ = 323;
-    public static final int __GO_SPECULARCOLOR__ = 324;
-    public static final int __GO_COLOR_MATERIAL__ = 325;
-    public static final int __GO_MATERIAL_SHININESS__ = 326;
-    public static final int __GO_LIGHT__ = 327;
-    public static final int __GO_LIGHT_TYPE__ = 328;
-    public static final int __GO_DATATIPS__ = 329;
-    public static final int __GO_DATATIPS_COUNT__ = 330;
-    public static final int __GO_DATATIP_INDEXES__ = 331;
-    public static final int __GO_DATA_MODEL_DISPLAY_FUNCTION__ = 332;
-    public static final int __GO_DATA_MODEL_DISPLAY_FUNCTION_SIZE__ = 333;
-    public static final int __GO_RESIZE__ = 334;
-    public static final int __GO_TOOLBAR__ = 335;
-    public static final int __GO_TOOLBAR_VISIBLE__ = 336;
-    public static final int __GO_MENUBAR__ = 337;
-    public static final int __GO_MENUBAR_VISIBLE__ = 338;
-    public static final int __GO_INFOBAR_VISIBLE__ = 339;
-    public static final int __GO_DOCKABLE__ = 340;
-    public static final int __GO_LAYOUT__ = 341;
-    public static final int __GO_LAYOUT_SET__ = 342;
-    public static final int __GO_UI_TAB__ = 343;
-    public static final int __GO_UI_GRIDBAG_GRID__ = 344;
-    public static final int __GO_UI_GRIDBAG_WEIGHT__ = 345;
-    public static final int __GO_UI_GRIDBAG_FILL__ = 346;
-    public static final int __GO_UI_GRIDBAG_ANCHOR__ = 347;
-    public static final int __GO_UI_GRIDBAG_PADDING__ = 348;
-    public static final int __GO_UI_GRID_GRID__ = 349;
-    public static final int __GO_UI_GRID_PADDING__ = 350;
-    public static final int __GO_UI_BORDER_POSITION__ = 351;
-    public static final int __GO_GRID_OPT_GRID__ = 352;
-    public static final int __GO_GRID_OPT_PADDING__ = 353;
-    public static final int __GO_BORDER_OPT_PADDING__ = 354;
-    public static final int __GO_UI_FRAME_BORDER__ = 355;
-    public static final int __GO_UI_FRAME_BORDER_COLOR__ = 356;
-    public static final int __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__ = 357;
-    public static final int __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__ = 358;
-    public static final int __GO_UI_FRAME_BORDER_IN_BORDER__ = 359;
-    public static final int __GO_UI_FRAME_BORDER_JUSTIFICATION__ = 360;
-    public static final int __GO_UI_FRAME_BORDER_OUT_BORDER__ = 361;
-    public static final int __GO_UI_FRAME_BORDER_ROUNDED__ = 362;
-    public static final int __GO_UI_FRAME_BORDER_SHADOW_IN__ = 363;
-    public static final int __GO_UI_FRAME_BORDER_SHADOW_OUT__ = 364;
-    public static final int __GO_UI_FRAME_BORDER_TITLE__ = 365;
-    public static final int __GO_UI_FRAME_BORDER_POSITION__ = 366;
-    public static final int __GO_UI_FRAME_BORDER_STYLE__ = 367;
-    public static final int __GO_UI_GROUP_NAME__ = 368;
-    public static final int __GO_UI_TITLE_POSITION__ = 369;
-    public static final int __GO_UI_TITLE_SCROLL__ = 370;
-    public static final int __GO_UI_FRAME_BORDER_TYPE__ = 371;
+    public static final int __GO_USEDEPRECATEDLF__ = 309;
+    public static final int __GO_WAITBAR__ = 310;
+    public static final int __GO_PROGRESSIONBAR__ = 311;
+    public static final int __GO_UI_MESSAGE__ = 312;
+    public static final int __GO_UI_MESSAGE_SIZE__ = 313;
+    public static final int __GO_DATATIP__ = 314;
+    public static final int __GO_DATATIP_DATA__ = 315;
+    public static final int __GO_DATATIP_ORIENTATION__ = 316;
+    public static final int __GO_DATATIP_3COMPONENT__ = 317;
+    public static final int __GO_DATATIP_AUTOORIENTATION__ = 318;
+    public static final int __GO_DATATIP_INTERP_MODE__ = 319;
+    public static final int __GO_DATATIP_DISPLAY_FNC__ = 320;
+    public static final int __GO_DATATIP_BOX_MODE__ = 321;
+    public static final int __GO_DATATIP_LABEL_MODE__ = 322;
+    public static final int __GO_AMBIENTCOLOR__ = 323;
+    public static final int __GO_DIFFUSECOLOR__ = 324;
+    public static final int __GO_SPECULARCOLOR__ = 325;
+    public static final int __GO_COLOR_MATERIAL__ = 326;
+    public static final int __GO_MATERIAL_SHININESS__ = 327;
+    public static final int __GO_LIGHT__ = 328;
+    public static final int __GO_LIGHT_TYPE__ = 329;
+    public static final int __GO_DATATIPS__ = 330;
+    public static final int __GO_DATATIPS_COUNT__ = 331;
+    public static final int __GO_DATATIP_INDEXES__ = 332;
+    public static final int __GO_DATA_MODEL_DISPLAY_FUNCTION__ = 333;
+    public static final int __GO_DATA_MODEL_DISPLAY_FUNCTION_SIZE__ = 334;
+    public static final int __GO_RESIZE__ = 335;
+    public static final int __GO_TOOLBAR__ = 336;
+    public static final int __GO_TOOLBAR_VISIBLE__ = 337;
+    public static final int __GO_MENUBAR__ = 338;
+    public static final int __GO_MENUBAR_VISIBLE__ = 339;
+    public static final int __GO_INFOBAR_VISIBLE__ = 340;
+    public static final int __GO_DOCKABLE__ = 341;
+    public static final int __GO_LAYOUT__ = 342;
+    public static final int __GO_LAYOUT_SET__ = 343;
+    public static final int __GO_UI_TAB__ = 344;
+    public static final int __GO_UI_GRIDBAG_GRID__ = 345;
+    public static final int __GO_UI_GRIDBAG_WEIGHT__ = 346;
+    public static final int __GO_UI_GRIDBAG_FILL__ = 347;
+    public static final int __GO_UI_GRIDBAG_ANCHOR__ = 348;
+    public static final int __GO_UI_GRIDBAG_PADDING__ = 349;
+    public static final int __GO_UI_GRID_GRID__ = 350;
+    public static final int __GO_UI_GRID_PADDING__ = 351;
+    public static final int __GO_UI_BORDER_POSITION__ = 352;
+    public static final int __GO_GRID_OPT_GRID__ = 353;
+    public static final int __GO_GRID_OPT_PADDING__ = 354;
+    public static final int __GO_BORDER_OPT_PADDING__ = 355;
+    public static final int __GO_UI_FRAME_BORDER__ = 356;
+    public static final int __GO_UI_FRAME_BORDER_COLOR__ = 357;
+    public static final int __GO_UI_FRAME_BORDER_HIGHLIGHT_IN__ = 358;
+    public static final int __GO_UI_FRAME_BORDER_HIGHLIGHT_OUT__ = 359;
+    public static final int __GO_UI_FRAME_BORDER_IN_BORDER__ = 360;
+    public static final int __GO_UI_FRAME_BORDER_JUSTIFICATION__ = 361;
+    public static final int __GO_UI_FRAME_BORDER_OUT_BORDER__ = 362;
+    public static final int __GO_UI_FRAME_BORDER_ROUNDED__ = 363;
+    public static final int __GO_UI_FRAME_BORDER_SHADOW_IN__ = 364;
+    public static final int __GO_UI_FRAME_BORDER_SHADOW_OUT__ = 365;
+    public static final int __GO_UI_FRAME_BORDER_TITLE__ = 366;
+    public static final int __GO_UI_FRAME_BORDER_POSITION__ = 367;
+    public static final int __GO_UI_FRAME_BORDER_STYLE__ = 368;
+    public static final int __GO_UI_GROUP_NAME__ = 369;
+    public static final int __GO_UI_TITLE_POSITION__ = 370;
+    public static final int __GO_UI_TITLE_SCROLL__ = 371;
+    public static final int __GO_UI_FRAME_BORDER_TYPE__ = 372;
 
 }
index a76bc92..b9eaa23 100644 (file)
@@ -255,6 +255,7 @@ public class Uicontrol extends GraphicObject {
         }
     }
 
+    protected static final String NONE_RELIEF   = "";
     protected static final String FLAT_RELIEF   = "flat";
     protected static final String RAISED_RELIEF = "raised";
     protected static final String SUNKEN_RELIEF = "sunken";
@@ -262,43 +263,43 @@ public class Uicontrol extends GraphicObject {
     protected static final String RIDGE_RELIEF  = "ridge";
     protected static final String SOLID_RELIEF  = "solid";
 
-    private static final double DEFAULT_RED_BACKGROUND = 0.8;
-    private static final double DEFAULT_GREEN_BACKGROUND = 0.8;
-    private static final double DEFAULT_BLUE_BACKGROUND = 0.8;
+    protected static final double DEFAULT_RED_BACKGROUND = 0.8;
+    protected static final double DEFAULT_GREEN_BACKGROUND = 0.8;
+    protected static final double DEFAULT_BLUE_BACKGROUND = 0.8;
 
     private static final double DEFAULT_X = 20.0;
     private static final double DEFAULT_Y = 40.0;
     private static final double DEFAULT_WIDTH = 40.0;
     private static final double DEFAULT_HEIGHT = 20.0;
 
-    private static final double DEFAULTFONTSIZE = 10;
-    private static final String DEFAULTFONTNAME = "helvetica";
-    private static final String DEFAULTFONTWEIGHT = "normal";
-    private static final String DEFAULTFONTANGLE = DEFAULTFONTWEIGHT;
+    protected static final double DEFAULTFONTSIZE = 10;
+    protected static final String DEFAULTFONTNAME = "helvetica";
+    protected static final String DEFAULTFONTWEIGHT = "normal";
+    protected static final String DEFAULTFONTANGLE = "normal";
     private static final String STRING_SEPARATOR = "|";
 
     private UicontrolStyle style;
-    private Double[] backgroundColor = {DEFAULT_RED_BACKGROUND, DEFAULT_GREEN_BACKGROUND, DEFAULT_BLUE_BACKGROUND};
+    private Double[] backgroundColor = { -1.0, -1.0, -1.0};
     private boolean enable = true;
-    private String fontAngle = DEFAULTFONTANGLE;
-    private String fontName = DEFAULTFONTNAME;
-    private double fontSize = DEFAULTFONTSIZE;
+    private String fontAngle = "";
+    private String fontName = "";
+    private double fontSize = 0;
     private String fontUnits = "points";
-    private String fontWeight = DEFAULTFONTWEIGHT;
+    private String fontWeight = "";
     private Double[] foregroundColor = {0.0, 0.0, 0.0};
-    private String horizontalAlignment = "center";
+    private String horizontalAlignment = "";
     private Integer[] listboxTop;
     private double max = 1.0;
     private double min;
     private Double[] position = {DEFAULT_X, DEFAULT_Y, DEFAULT_WIDTH, DEFAULT_HEIGHT};
-    private String relief = RAISED_RELIEF;
+    private String relief = NONE_RELIEF;
     private Double[] sliderStep = {0.01, 0.1};
     private String[] string = {""};
     private int stringColNb = 1; // Used for tables
     private String[] tooltipString = {""};
     private String units = "pixels";
     private Double[] value;
-    private String verticalAlignment = "middle";
+    private String verticalAlignment = "";
     private LayoutType layout = LayoutType.NONE;
     private Double[] margins = new Double[] {0.0, 0.0, 0.0, 0.0};
     private Integer[] gridbagGrid = new Integer[] {0, 0, 0, 0};
index 07d3d10..9fcb7dd 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.checkbox;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_CHECKBOX__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,12 +28,27 @@ public class CheckBox extends Uicontrol {
     public CheckBox() {
         super();
         setStyle(__GO_UI_CHECKBOX__);
-        setRelief(FLAT_RELIEF);
 
         // Default value is the min value (not checked)
         Double[] value = new Double[1];
         value[0] = getMin();
         setUiValue(value);
-    }
 
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(FLAT_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
+    }
 }
index ce5a345..efb65c0 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.edit;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_EDIT__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,7 +28,22 @@ public class Edit extends Uicontrol {
     public Edit() {
         super();
         setStyle(__GO_UI_EDIT__);
-        setRelief(SUNKEN_RELIEF);
-    }
 
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(SUNKEN_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
+    }
 }
index 31d35d4..1f5c28f 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.frame;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,7 +28,24 @@ public class Frame extends Uicontrol {
     public Frame() {
         super();
         setStyle(__GO_UI_FRAME__);
-        setRelief(RIDGE_RELIEF);
-    }
+        if (Console.getConsole().getUseDeprecatedLF()) {
+
+            if (Console.getConsole().getUseDeprecatedLF()) {
+                setRelief(RIDGE_RELIEF);
+                setBackgroundColor(new Double[] {
+                                       DEFAULT_RED_BACKGROUND,
+                                       DEFAULT_GREEN_BACKGROUND,
+                                       DEFAULT_BLUE_BACKGROUND
+                                   });
 
+                setHorizontalAlignment("center");
+                setVerticalAlignment("middle");
+
+                setFontName(DEFAULTFONTNAME);
+                setFontSize(DEFAULTFONTSIZE);
+                setFontAngle(DEFAULTFONTANGLE);
+                setFontWeight(DEFAULTFONTWEIGHT);
+            }
+        }
+    }
 }
index 950ce13..8dbdbd0 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.listbox;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_LISTBOX__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,12 +28,28 @@ public class ListBox extends Uicontrol {
     public ListBox() {
         super();
         setStyle(__GO_UI_LISTBOX__);
-        setRelief(FLAT_RELIEF);
 
         // Default value is the min value
         Double[] value = new Double[1];
         value[0] = getMin();
         setUiValue(value);
+
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(FLAT_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
     }
 
 }
index 25cf5eb..251d614 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.popupmenu;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_POPUPMENU__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,7 +28,24 @@ public class PopupMenu extends Uicontrol {
     public PopupMenu() {
         super();
         setStyle(__GO_UI_POPUPMENU__);
-        setRelief(FLAT_RELIEF);
+
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(FLAT_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
+
     }
 
 }
index b77d162..9467515 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.pushbutton;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_PUSHBUTTON__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -31,7 +32,24 @@ public class PushButton extends Uicontrol {
     public PushButton() {
         super();
         setStyle(__GO_UI_PUSHBUTTON__);
-        setBackgroundColor(new Double[] {BUTTON_RED_BACKGROUND, BUTTON_GREEN_BACKGROUND, BUTTON_BLUE_BACKGROUND});
+
+
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(RAISED_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   BUTTON_RED_BACKGROUND,
+                                   BUTTON_GREEN_BACKGROUND,
+                                   BUTTON_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
     }
 
 }
index 58e348e..8eeb6e5 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.radiobutton;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_RADIOBUTTON__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,12 +28,27 @@ public class RadioButton extends Uicontrol {
     public RadioButton() {
         super();
         setStyle(__GO_UI_RADIOBUTTON__);
-        setRelief(FLAT_RELIEF);
 
         // Default value is the min value (not checked)
         Double[] value = new Double[1];
         value[0] = getMin();
         setUiValue(value);
-    }
 
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(FLAT_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
+    }
 }
index f5f34ea..7e94848 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.slider;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDER__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,12 +28,27 @@ public class Slider extends Uicontrol {
     public Slider() {
         super();
         setStyle(__GO_UI_SLIDER__);
-        setRelief(FLAT_RELIEF);
 
         // Default value is the min value
         Double[] value = new Double[1];
         value[0] = getMin();
         setUiValue(value);
-    }
 
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(FLAT_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
+    }
 }
index 6388c2c..6b2a644 100644 (file)
@@ -13,7 +13,7 @@
 package org.scilab.modules.graphic_objects.uicontrol.uiimage;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_IMAGE__;
-
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -29,6 +29,22 @@ public class UiImage extends Uicontrol {
         setStyle(__GO_UI_IMAGE__);
         Double[] imageInfos = {1.0, 1.0, 0.0, 0.0, 0.0}; // {XScale, YScale, XShear, YShear, RotationAngle}
         setUiValue(imageInfos);
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(RAISED_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
     }
 
 }
index 7345334..0795aa9 100644 (file)
@@ -14,6 +14,7 @@ package org.scilab.modules.graphic_objects.uicontrol.uitext;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TEXT__;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
 
 /**
@@ -27,7 +28,22 @@ public class UiText extends Uicontrol {
     public UiText() {
         super();
         setStyle(__GO_UI_TEXT__);
-        setRelief(FLAT_RELIEF);
-    }
 
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            setRelief(FLAT_RELIEF);
+            setBackgroundColor(new Double[] {
+                                   DEFAULT_RED_BACKGROUND,
+                                   DEFAULT_GREEN_BACKGROUND,
+                                   DEFAULT_BLUE_BACKGROUND
+                               });
+
+            setHorizontalAlignment("center");
+            setVerticalAlignment("middle");
+
+            setFontName(DEFAULTFONTNAME);
+            setFontSize(DEFAULTFONTSIZE);
+            setFontAngle(DEFAULTFONTANGLE);
+            setFontWeight(DEFAULTFONTWEIGHT);
+        }
+    }
 }
index d7e8c7f..9ff1511 100644 (file)
@@ -66,3 +66,5 @@ SetUicontrolString
 SetUicontrolTooltipString
 SetUimenuLabel
 SetUiobjectEnable
+GetConsoleUseDeprecatedLF
+SetConsoleUseDeprecatedLF
index 61d1192..a2dac01 100755 (executable)
@@ -1030,6 +1030,7 @@ function %h_p(h)
             t=[t;
             "Children: "+fmtchildren(h.children)
             "ShowHiddenHandles: "+sci2exp(h.showhiddenhandles)
+            "UseDeprecatedSkin: "+sci2exp(h.usedeprecatedskin)
             ]
             // Light
             // =====================================================================
index ff58abb..506e312 100755 (executable)
@@ -210,6 +210,7 @@ static getHashTableCouple propertyGetTable[] =
     {"anti_aliasing", get_anti_aliasing_property},
     {"UID", get_UID},
     {"showhiddenhandles", GetConsoleShowHiddenHandles},
+    {"usedeprecatedskin", GetConsoleUseDeprecatedLF},
     {"resizefcn", get_figure_resizefcn_property},
     {"tooltipstring", GetUicontrolTooltipString},
     {"closerequestfcn", get_figure_closerequestfcn_property},
index e3edaf1..40e0094 100755 (executable)
@@ -211,6 +211,7 @@ static setHashTableCouple propertySetTable[] =
     {"grid_position", set_grid_position_property},
     {"anti_aliasing", set_anti_aliasing_property},
     {"showhiddenhandles", SetConsoleShowHiddenHandles},
+    {"usedeprecatedskin", SetConsoleUseDeprecatedLF},
     {"resizefcn", set_figure_resizefcn_property},
     {"tooltipstring", SetUicontrolTooltipString},
     {"closerequestfcn", set_figure_closerequestfcn_property},
index d82a355..08cb87a 100644 (file)
  */
 GUI_IMPEXP int GetConsoleShowHiddenHandles(void* _pvCtx, int iObjUID);
 
+/**
+ * Get UseDeprecatedSkin property of the console
+ *
+ * @param pobj Scilab object corresponding to the console
+ * @return true if the get has been correcty done
+ */
+GUI_IMPEXP int GetConsoleUseDeprecatedLF(void* _pvCtx, int iObjUID);
+
 #endif /* !__GETCONSOLESHOWHIDDENHANDLES_H__ */
index eb60561..3390641 100644 (file)
  * @return true if the set has been correcty done
  */
 GUI_IMPEXP int SetConsoleShowHiddenHandles(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol);
+/**
+ * Set UseDeprecatedSkin property of the console
+ *
+ * @param pobj Scilab object corresponding to the console
+ * @param stackPointer position on the stack of the status to set
+ * @param valueType type of the value on stack
+ * @param nbRow number of rows of the value on stack
+ * @param nbCol number of columns of the value on stack
+ * @return true if the set has been correcty done
+ */
+GUI_IMPEXP int SetConsoleUseDeprecatedLF(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol);
 
 #endif /* !__SETCONSOLESHOWHIDDENHANDLES_H__ */
index 77051ee..dffdce4 100644 (file)
@@ -46,3 +46,27 @@ int GetConsoleShowHiddenHandles(void* _pvCtx, int iObjUID)
         return sciReturnString(_pvCtx, "off");
     }
 }
+
+int GetConsoleUseDeprecatedLF(void* _pvCtx, int iObjUID)
+{
+    int iUseDeprecatedLF = 0;
+    int *piUseDeprecatedLF = &iUseDeprecatedLF;
+
+    getGraphicObjectProperty(iObjUID, __GO_USEDEPRECATEDLF__, jni_bool, (void **)&piUseDeprecatedLF);
+
+    if (piUseDeprecatedLF == NULL)
+    {
+        Scierror(999, const_cast < char *>(_("'%s' property does not exist for this handle.\n")), "UseDeprecatedSkin");
+
+        return FALSE;
+    }
+
+    if (iUseDeprecatedLF == TRUE)
+    {
+        return sciReturnString(_pvCtx, "on");
+    }
+    else
+    {
+        return sciReturnString(_pvCtx, "off");
+    }
+}
index 39034b8..6aaeae2 100644 (file)
@@ -46,3 +46,30 @@ int SetConsoleShowHiddenHandles(void* _pvCtx, int iObjUID, void* _pvData, int va
         return SET_PROPERTY_ERROR;
     }
 }
+int SetConsoleUseDeprecatedLF(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol)
+{
+    int b = (int)FALSE;
+    BOOL status = FALSE;
+
+    b = tryGetBooleanValueFromStack(_pvData, valueType, nbRow, nbCol, const_cast < char *>("UseDeprecatedSkin"));
+
+    if (b == NOT_A_BOOLEAN_VALUE)
+    {
+        return SET_PROPERTY_ERROR;
+    }
+
+    status = setGraphicObjectProperty(iObjUID, __GO_USEDEPRECATEDLF__, &b, jni_bool, 1);
+
+    if (status == TRUE)
+    {
+        return SET_PROPERTY_SUCCEED;
+    }
+    else
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "UseDeprecatedSkin");
+        return SET_PROPERTY_ERROR;
+    }
+}
+
+
+
index ffd4616..c03f858 100644 (file)
@@ -107,6 +107,7 @@ import org.scilab.modules.gui.bridge.menuitem.SwingScilabMenuItem;
 import org.scilab.modules.gui.bridge.popupmenu.SwingScilabPopupMenu;
 import org.scilab.modules.gui.bridge.pushbutton.SwingScilabPushButton;
 import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
+import org.scilab.modules.gui.bridge.slider.SwingScilabScroll;
 import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
 import org.scilab.modules.gui.bridge.tab.SwingScilabCommonPanel;
 import org.scilab.modules.gui.bridge.tab.SwingScilabDockablePanel;
@@ -237,13 +238,13 @@ public final class SwingView implements GraphicView {
     };
 
     private static final Set<Integer> managedTypes = new HashSet<Integer>(Arrays.asList(
-            GraphicObjectProperties.__GO_FIGURE__,
-            GraphicObjectProperties.__GO_UICONTEXTMENU__,
-            GraphicObjectProperties.__GO_UIMENU__,
-            GraphicObjectProperties.__GO_CONSOLE__,
-            GraphicObjectProperties.__GO_PROGRESSIONBAR__,
-            GraphicObjectProperties.__GO_WAITBAR__,
-            GraphicObjectProperties.__GO_UICONTROL__
+                GraphicObjectProperties.__GO_FIGURE__,
+                GraphicObjectProperties.__GO_UICONTEXTMENU__,
+                GraphicObjectProperties.__GO_UIMENU__,
+                GraphicObjectProperties.__GO_CONSOLE__,
+                GraphicObjectProperties.__GO_PROGRESSIONBAR__,
+                GraphicObjectProperties.__GO_WAITBAR__,
+                GraphicObjectProperties.__GO_UICONTROL__
             ));
 
     @Override
@@ -488,10 +489,17 @@ public final class SwingView implements GraphicView {
                 setDefaultProperties(radioButton, id);
                 return radioButton;
             case Slider:
-                SwingScilabSlider slider = new SwingScilabSlider();
-                slider.setId(id);
-                setDefaultProperties(slider, id);
-                return slider;
+                if (Console.getConsole().getUseDeprecatedLF()) {
+                    SwingScilabScroll slider = new SwingScilabScroll();
+                    slider.setId(id);
+                    setDefaultProperties(slider, id);
+                    return slider;
+                } else {
+                    SwingScilabSlider slider = new SwingScilabSlider();
+                    slider.setId(id);
+                    setDefaultProperties(slider, id);
+                    return slider;
+                }
             case Table:
                 SwingScilabUiTable table = new SwingScilabUiTable();
                 table.setId(id);
@@ -551,21 +559,21 @@ public final class SwingView implements GraphicView {
      */
     private void setMenuDefaultProperties(Widget uiMenuObject, Integer id) {
         SwingViewMenu.update(uiMenuObject, __GO_CHILDREN__,
-                GraphicController.getController().getProperty(id, __GO_CHILDREN__));
+                             GraphicController.getController().getProperty(id, __GO_CHILDREN__));
         SwingViewMenu.update(uiMenuObject, __GO_CALLBACK__,
-                GraphicController.getController().getProperty(id, __GO_CALLBACK__));
+                             GraphicController.getController().getProperty(id, __GO_CALLBACK__));
         SwingViewMenu.update(uiMenuObject, __GO_CALLBACKTYPE__,
-                GraphicController.getController().getProperty(id, __GO_CALLBACKTYPE__));
+                             GraphicController.getController().getProperty(id, __GO_CALLBACKTYPE__));
         SwingViewMenu.update(uiMenuObject, __GO_UI_CHECKED__,
-                GraphicController.getController().getProperty(id, __GO_UI_CHECKED__));
+                             GraphicController.getController().getProperty(id, __GO_UI_CHECKED__));
         SwingViewMenu.update(uiMenuObject, __GO_UI_ENABLE__,
-                GraphicController.getController().getProperty(id, __GO_UI_ENABLE__));
+                             GraphicController.getController().getProperty(id, __GO_UI_ENABLE__));
         SwingViewMenu.update(uiMenuObject, __GO_UI_FOREGROUNDCOLOR__,
-                GraphicController.getController().getProperty(id, __GO_UI_FOREGROUNDCOLOR__));
+                             GraphicController.getController().getProperty(id, __GO_UI_FOREGROUNDCOLOR__));
         SwingViewMenu.update(uiMenuObject, __GO_UI_LABEL__,
-                GraphicController.getController().getProperty(id, __GO_UI_LABEL__));
+                             GraphicController.getController().getProperty(id, __GO_UI_LABEL__));
         SwingViewMenu.update(uiMenuObject, __GO_UI_ICON__,
-                GraphicController.getController().getProperty(id, __GO_UI_ICON__));
+                             GraphicController.getController().getProperty(id, __GO_UI_ICON__));
     }
 
     /**
@@ -576,35 +584,35 @@ public final class SwingView implements GraphicView {
     private void setDefaultProperties(Widget uiControlObject, Integer id) {
         /* Visible property is set first to avoid to see the object rendered before all its properties to be set (See bug #10346) */
         SwingViewWidget.update(uiControlObject, __GO_VISIBLE__,
-                GraphicController.getController().getProperty(id, __GO_VISIBLE__));
+                               GraphicController.getController().getProperty(id, __GO_VISIBLE__));
         SwingViewWidget.update(uiControlObject, __GO_UI_BACKGROUNDCOLOR__,
-                GraphicController.getController().getProperty(id, __GO_UI_BACKGROUNDCOLOR__));
+                               GraphicController.getController().getProperty(id, __GO_UI_BACKGROUNDCOLOR__));
         SwingViewWidget.update(uiControlObject, __GO_UI_ENABLE__,
-                GraphicController.getController().getProperty(id, __GO_UI_ENABLE__));
+                               GraphicController.getController().getProperty(id, __GO_UI_ENABLE__));
         SwingViewWidget.update(uiControlObject, __GO_UI_FONTANGLE__,
-                GraphicController.getController().getProperty(id, __GO_UI_FONTANGLE__));
+                               GraphicController.getController().getProperty(id, __GO_UI_FONTANGLE__));
         SwingViewWidget.update(uiControlObject, __GO_UI_FONTNAME__,
-                GraphicController.getController().getProperty(id, __GO_UI_FONTNAME__));
+                               GraphicController.getController().getProperty(id, __GO_UI_FONTNAME__));
         SwingViewWidget.update(uiControlObject, __GO_UI_FONTUNITS__,
-                GraphicController.getController().getProperty(id, __GO_UI_FONTUNITS__));
+                               GraphicController.getController().getProperty(id, __GO_UI_FONTUNITS__));
         SwingViewWidget.update(uiControlObject, __GO_UI_FONTSIZE__,
-                GraphicController.getController().getProperty(id, __GO_UI_FONTSIZE__));
+                               GraphicController.getController().getProperty(id, __GO_UI_FONTSIZE__));
         SwingViewWidget.update(uiControlObject, __GO_UI_FONTWEIGHT__,
-                GraphicController.getController().getProperty(id, __GO_UI_FONTWEIGHT__));
+                               GraphicController.getController().getProperty(id, __GO_UI_FONTWEIGHT__));
         SwingViewWidget.update(uiControlObject, __GO_UI_FOREGROUNDCOLOR__,
-                GraphicController.getController().getProperty(id, __GO_UI_FOREGROUNDCOLOR__));
+                               GraphicController.getController().getProperty(id, __GO_UI_FOREGROUNDCOLOR__));
         SwingViewWidget.update(uiControlObject, __GO_UI_HORIZONTALALIGNMENT__,
-                GraphicController.getController().getProperty(id, __GO_UI_HORIZONTALALIGNMENT__));
+                               GraphicController.getController().getProperty(id, __GO_UI_HORIZONTALALIGNMENT__));
         SwingViewWidget.update(uiControlObject, __GO_UI_RELIEF__,
-                GraphicController.getController().getProperty(id, __GO_UI_RELIEF__));
+                               GraphicController.getController().getProperty(id, __GO_UI_RELIEF__));
         SwingViewWidget.update(uiControlObject, __GO_UI_STRING__,
-                GraphicController.getController().getProperty(id, __GO_UI_STRING__));
+                               GraphicController.getController().getProperty(id, __GO_UI_STRING__));
         SwingViewWidget.update(uiControlObject, __GO_UI_VERTICALALIGNMENT__,
-                GraphicController.getController().getProperty(id, __GO_UI_VERTICALALIGNMENT__));
+                               GraphicController.getController().getProperty(id, __GO_UI_VERTICALALIGNMENT__));
         SwingViewWidget.update(uiControlObject, __GO_POSITION__,
-                GraphicController.getController().getProperty(id, __GO_POSITION__));
+                               GraphicController.getController().getProperty(id, __GO_POSITION__));
         SwingViewWidget.update(uiControlObject, __GO_LAYOUT__,
-                GraphicController.getController().getProperty(id, __GO_LAYOUT__));
+                               GraphicController.getController().getProperty(id, __GO_LAYOUT__));
     }
 
     public void deleteObject(Integer id) {
@@ -761,9 +769,9 @@ public final class SwingView implements GraphicView {
             final Integer[] newChildren = (Integer[]) GraphicController.getController().getProperty(id, __GO_CHILDREN__);
 
             switch (type) {
-                /*
-                 * FIGURE CHILDREN UPDATE
-                 */
+                    /*
+                     * FIGURE CHILDREN UPDATE
+                     */
                 case __GO_FIGURE__ :
                     updateFigureChildren(registeredObject, newChildren);
                     break;
index ea63407..d0ac7b8 100644 (file)
@@ -68,6 +68,7 @@ import org.scilab.modules.gui.bridge.groupmanager.GroupManager;
 import org.scilab.modules.gui.bridge.listbox.SwingScilabListBox;
 import org.scilab.modules.gui.bridge.popupmenu.SwingScilabPopupMenu;
 import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
+import org.scilab.modules.gui.bridge.slider.SwingScilabScroll;
 import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
 import org.scilab.modules.gui.bridge.uiimage.SwingScilabUiImage;
 import org.scilab.modules.gui.bridge.uitable.SwingScilabUiTable;
@@ -116,9 +117,20 @@ public final class SwingViewWidget {
         switch (property) {
             case __GO_UI_BACKGROUNDCOLOR__ :
                 allColors = ((Double[]) value);
-                uiControl.setBackground(new Color((int) (allColors[0] * COLORS_COEFF),
-                                                  (int) (allColors[1] * COLORS_COEFF),
-                                                  (int) (allColors[2] * COLORS_COEFF)));
+                if (allColors[0] != -1) {
+                    if (uiControl instanceof SwingScilabListBox) {
+                        ((SwingScilabListBox)uiControl).setListBackground(new Color((int) (allColors[0] * COLORS_COEFF),
+                                (int) (allColors[1] * COLORS_COEFF),
+                                (int) (allColors[2] * COLORS_COEFF)));
+                    } else {
+                        uiControl.setBackground(new Color((int) (allColors[0] * COLORS_COEFF),
+                                                          (int) (allColors[1] * COLORS_COEFF),
+                                                          (int) (allColors[2] * COLORS_COEFF)));
+                    }
+                } else {
+                    // Do not set BackgroundColor for widgets
+                    // rely on Look and Feel
+                }
                 break;
             case __GO_CALLBACK__ :
                 int cbType = (Integer) controller.getProperty(uid, __GO_CALLBACKTYPE__);
@@ -138,83 +150,97 @@ public final class SwingViewWidget {
             case __GO_UI_ENABLE__ :
                 uiControl.setEnabled(((Boolean) value).booleanValue());
                 break;
-            case __GO_UI_FONTANGLE__ :
-                font = uiControl.getFont();
-                if (font != null) {
-                    String angle = (String) value;
+            case __GO_UI_FONTANGLE__ : {
+                String angle = (String) value;
+                if (angle.equals("") == false) {
+                    font = uiControl.getFont();
+                    if (font != null) {
 
-                    if (angle.equalsIgnoreCase(ITALICFONT) || angle.equalsIgnoreCase(OBLIQUEFONT)) {
-                        if (font.isBold()) {
-                            font = new Font(font.getName(), Font.ITALIC + Font.BOLD, font.getSize());
-                        } else {
-                            font = new Font(font.getName(), Font.ITALIC, font.getSize());
-                        }
-                    } else {
-                        if (font.isBold()) {
-                            font = new Font(font.getName(), Font.BOLD, font.getSize());
+                        if (angle.equalsIgnoreCase(ITALICFONT) || angle.equalsIgnoreCase(OBLIQUEFONT)) {
+                            if (font.isBold()) {
+                                font = new Font(font.getName(), Font.ITALIC + Font.BOLD, font.getSize());
+                            } else {
+                                font = new Font(font.getName(), Font.ITALIC, font.getSize());
+                            }
                         } else {
-                            font = new Font(font.getName(), Font.PLAIN, font.getSize());
+                            if (font.isBold()) {
+                                font = new Font(font.getName(), Font.BOLD, font.getSize());
+                            } else {
+                                font = new Font(font.getName(), Font.PLAIN, font.getSize());
+                            }
                         }
-                    }
 
-                    uiControl.setFont(font);
+                        uiControl.setFont(font);
+                    }
                 }
                 break;
-            case __GO_UI_FONTNAME__ :
-                font = uiControl.getFont();
-                if (font != null) {
-                    String name = (String) value;
+            }
+            case __GO_UI_FONTNAME__ : {
+                String name = (String) value;
+                if (name.equals("") == false) {
+                    font = uiControl.getFont();
+                    if (font != null) {
 
-                    font = new Font(name, font.getStyle(), font.getSize());
+                        font = new Font(name, font.getStyle(), font.getSize());
 
-                    uiControl.setFont(font);
+                        uiControl.setFont(font);
+                    }
                 }
                 break;
-            case __GO_UI_FONTSIZE__ :
-                UicontrolUnits fontUnitsProperty = UnitsConverter.stringToUnitsEnum((String) controller
-                                                   .getProperty(uid, __GO_UI_FONTUNITS__));
-                Double dblFontSize = UnitsConverter.convertToPoint((Double) value, fontUnitsProperty, uiControl, false);
-                font = uiControl.getFont();
-                if (font != null) {
-                    int size = dblFontSize.intValue();
-                    font = new Font(font.getName(), font.getStyle(), size);
-                    uiControl.setFont(font);
+            }
+            case __GO_UI_FONTSIZE__ : {
+                if ((Double)value != 0.0) {
+                    UicontrolUnits fontUnitsProperty = UnitsConverter.stringToUnitsEnum((String) controller.getProperty(uid, __GO_UI_FONTUNITS__));
+                    Double dblFontSize = UnitsConverter.convertToPoint((Double) value, fontUnitsProperty, uiControl, false);
+                    font = uiControl.getFont();
+                    if (font != null) {
+                        int size = dblFontSize.intValue();
+                        font = new Font(font.getName(), font.getStyle(), size);
+                        uiControl.setFont(font);
+                    }
                 }
                 break;
+            }
             case __GO_UI_FONTUNITS__ :
                 /* Nothing to do here, this property is used when setting position */
                 break;
-            case __GO_UI_FONTWEIGHT__ :
-                font = uiControl.getFont();
-                if (font != null) {
-                    String weight = (String) value;
-
-                    if (weight.equalsIgnoreCase(BOLDFONT)) {
-                        if (font.isItalic()) {
-                            font = new Font(font.getName(), Font.ITALIC + Font.BOLD, font.getSize());
-                        } else {
-                            font = new Font(font.getName(), Font.BOLD, font.getSize());
-                        }
-                    } else {
-                        if (font.isItalic()) {
-                            font = new Font(font.getName(), Font.ITALIC, font.getSize());
+            case __GO_UI_FONTWEIGHT__ : {
+                String weight = (String) value;
+                if (weight.equals("") == false) {
+                    font = uiControl.getFont();
+                    if (font != null) {
+                        if (weight.equalsIgnoreCase(BOLDFONT)) {
+                            if (font.isItalic()) {
+                                font = new Font(font.getName(), Font.ITALIC + Font.BOLD, font.getSize());
+                            } else {
+                                font = new Font(font.getName(), Font.BOLD, font.getSize());
+                            }
                         } else {
-                            font = new Font(font.getName(), Font.PLAIN, font.getSize());
+                            if (font.isItalic()) {
+                                font = new Font(font.getName(), Font.ITALIC, font.getSize());
+                            } else {
+                                font = new Font(font.getName(), Font.PLAIN, font.getSize());
+                            }
                         }
-                    }
 
-                    uiControl.setFont(font);
+                        uiControl.setFont(font);
+                    }
                 }
                 break;
+            }
             case __GO_UI_FOREGROUNDCOLOR__ :
                 allColors = ((Double[]) value);
                 uiControl.setForeground(new Color((int) (allColors[0] * COLORS_COEFF),
                                                   (int) (allColors[1] * COLORS_COEFF),
                                                   (int) (allColors[2] * COLORS_COEFF)));
                 break;
-            case __GO_UI_HORIZONTALALIGNMENT__ :
-                uiControl.setHorizontalAlignment((String) value);
+            case __GO_UI_HORIZONTALALIGNMENT__ : {
+                String align = (String)value;
+                if (align.equals("") == false) {
+                    uiControl.setHorizontalAlignment((String) value);
+                }
                 break;
+            }
             case __GO_UI_LISTBOXTOP__ :
                 if (uiControl instanceof SwingScilabListBox) {
                     Integer[] listboxtopValue = ((Integer[]) value);
@@ -230,7 +256,18 @@ public final class SwingViewWidget {
                     return;
                 }
                 double uicontrolValue = allValues[0];
-                if (uiControl instanceof SwingScilabSlider) {
+                if (uiControl instanceof SwingScilabScroll) {
+                    // Update the slider properties
+                    double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
+                    ((SwingScilabScroll) uiControl).setMaximumValue(maxValue);
+                    Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
+                    double minorSliderStep = sliderStep[0].doubleValue();
+                    double majorSliderStep = sliderStep[1].doubleValue();
+                    if (minValue <= maxValue) {
+                        ((SwingScilabScroll) uiControl).setMinorTickSpacing(minorSliderStep);
+                        ((SwingScilabScroll) uiControl).setMajorTickSpacing(majorSliderStep);
+                    }
+                } else if (uiControl instanceof SwingScilabSlider) {
                     // Update the slider properties
                     double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
                     ((SwingScilabSlider) uiControl).setMaximumValue(maxValue);
@@ -255,7 +292,18 @@ public final class SwingViewWidget {
                 break;
             case __GO_UI_MIN__ :
                 double minValue = ((Double) value);
-                if (uiControl instanceof SwingScilabSlider) {
+                if (uiControl instanceof SwingScilabScroll) {
+                    // Update the slider properties
+                    maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
+                    ((SwingScilabScroll) uiControl).setMinimumValue(minValue);
+                    Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
+                    double minorSliderStep = sliderStep[0].doubleValue();
+                    double majorSliderStep = sliderStep[1].doubleValue();
+                    if (minValue <= maxValue) {
+                        ((SwingScilabScroll) uiControl).setMinorTickSpacing(minorSliderStep);
+                        ((SwingScilabScroll) uiControl).setMajorTickSpacing(majorSliderStep);
+                    }
+                } else if (uiControl instanceof SwingScilabSlider) {
                     // Update the slider properties
                     maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
                     ((SwingScilabSlider) uiControl).setMinimumValue(minValue);
@@ -281,7 +329,13 @@ public final class SwingViewWidget {
                 uiControl.setDims(new Size(dblValues[WIDTH_INDEX].intValue(), dblValues[HEIGHT_INDEX].intValue()));
                 uiControl.setPosition(new Position(dblValues[X_INDEX].intValue(), dblValues[Y_INDEX].intValue()));
                 // Manage sliders orientation
-                if (uiControl instanceof SwingScilabSlider) {
+                if (uiControl instanceof SwingScilabScroll) {
+                    if (dblValues[WIDTH_INDEX].intValue() > dblValues[HEIGHT_INDEX].intValue()) {
+                        ((SwingScilabScroll) uiControl).setHorizontal();
+                    } else {
+                        ((SwingScilabScroll) uiControl).setVertical();
+                    }
+                } else if (uiControl instanceof SwingScilabSlider) {
                     if (dblValues[WIDTH_INDEX].intValue() > dblValues[HEIGHT_INDEX].intValue()) {
                         ((SwingScilabSlider) uiControl).setHorizontal();
                     } else {
@@ -294,7 +348,13 @@ public final class SwingViewWidget {
                 break;
             case __GO_UI_SLIDERSTEP__ :
                 Double[] sliderStep = ((Double[]) value);
-                if (uiControl instanceof SwingScilabSlider) {
+                if (uiControl instanceof SwingScilabScroll) {
+                    // Update the slider properties
+                    double minorSliderStep = sliderStep[0].doubleValue();
+                    double majorSliderStep = sliderStep[1].doubleValue();
+                    ((SwingScilabScroll) uiControl).setMinorTickSpacing(minorSliderStep);
+                    ((SwingScilabScroll) uiControl).setMajorTickSpacing(majorSliderStep);
+                } else if (uiControl instanceof SwingScilabSlider) {
                     // Update the slider properties
                     double minorSliderStep = sliderStep[0].doubleValue();
                     double majorSliderStep = sliderStep[1].doubleValue();
@@ -394,6 +454,9 @@ public final class SwingViewWidget {
                     // Check the radiobutton if the value is equal to MAX property
                     maxValue = ((Double) controller.getProperty(uid, __GO_UI_MAX__)).intValue();
                     ((SwingScilabRadioButton) uiControl).setChecked(maxValue == intValue[0]);
+                } else if (uiControl instanceof SwingScilabScroll) {
+                    // Update the slider value
+                    ((SwingScilabScroll) uiControl).setUserValue(doubleValue[0]);
                 } else if (uiControl instanceof SwingScilabSlider) {
                     // Update the slider value
                     ((SwingScilabSlider) uiControl).setUserValue(doubleValue[0]);
@@ -436,9 +499,13 @@ public final class SwingViewWidget {
                     ((SwingScilabUiImage) uiControl).setRotate(imageParams[4]);
                 }
                 break;
-            case __GO_UI_VERTICALALIGNMENT__ :
-                uiControl.setVerticalAlignment((String) value);
+            case __GO_UI_VERTICALALIGNMENT__ : {
+                String align = (String)value;
+                if (align.equals("") == false) {
+                    uiControl.setVerticalAlignment((String) value);
+                }
                 break;
+            }
             case __GO_VISIBLE__ :
                 uiControl.setVisible(((Boolean) value).booleanValue());
                 break;
index 2fe4a99..2546f72 100644 (file)
@@ -281,7 +281,9 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
index d4a4aba..887ef9f 100644 (file)
@@ -14,6 +14,7 @@
 
 package org.scilab.modules.gui.bridge.editbox;
 
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 
 import java.awt.event.ActionEvent;
@@ -24,6 +25,7 @@ import java.awt.event.FocusListener;
 import javax.swing.JTextField;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
+import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorderType;
 import org.scilab.modules.gui.SwingView;
 import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.SwingViewObject;
@@ -212,7 +214,9 @@ public class SwingScilabEditBox extends JTextField implements SwingViewObject, S
      * @param alignment the value for the alignment (See ScilabAlignment.java)
      */
     public void setHorizontalAlignment(String alignment) {
-        setHorizontalAlignment(ScilabAlignment.toSwingAlignment(alignment));
+        if (alignment.equals("") == false) {
+            setHorizontalAlignment(ScilabAlignment.toSwingAlignment(alignment));
+        }
     }
 
     /**
@@ -220,7 +224,9 @@ public class SwingScilabEditBox extends JTextField implements SwingViewObject, S
      * @param alignment the value for the alignment (See ScilabAlignment.java)
      */
     public void setVerticalAlignment(String alignment) {
-        // NOTHING TO DO HERE UNTIL WE HAVE MULTI-LINE EDIT UICONTROLS
+        if (alignment.equals("") == false) {
+            // NOTHING TO DO HERE UNTIL WE HAVE MULTI-LINE EDIT UICONTROLS
+        }
     }
 
     /**
@@ -228,7 +234,9 @@ public class SwingScilabEditBox extends JTextField implements SwingViewObject, S
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
index 65da5f7..13a59ea 100644 (file)
@@ -15,6 +15,7 @@ package org.scilab.modules.gui.bridge.frame;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ENABLE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 
 import java.awt.BorderLayout;
@@ -30,6 +31,7 @@ import javax.swing.JPanel;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicModel.GraphicModel;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
+import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorderType;
 import org.scilab.modules.gui.SwingView;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.SwingViewWidget;
@@ -41,7 +43,7 @@ import org.scilab.modules.gui.bridge.label.SwingScilabLabel;
 import org.scilab.modules.gui.bridge.listbox.SwingScilabListBox;
 import org.scilab.modules.gui.bridge.pushbutton.SwingScilabPushButton;
 import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
-import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
+import org.scilab.modules.gui.bridge.slider.SwingScilabScroll;
 import org.scilab.modules.gui.bridge.tab.SwingScilabDockablePanel;
 import org.scilab.modules.gui.bridge.tab.SwingScilabTabGroup;
 import org.scilab.modules.gui.bridge.textbox.SwingScilabTextBox;
@@ -465,7 +467,7 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
      */
     public int addMember(Slider member) {
         //              FIXME replace member with member.getAsSimpleSlider() when ready
-        return this.addMember((SwingScilabSlider) member);
+        return this.addMember((SwingScilabScroll) member);
     }
 
     /**
@@ -473,7 +475,7 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
      * @param member the member to add
      * @return index of member in ArrayList
      */
-    private int addMember(SwingScilabSlider member) {
+    private int addMember(SwingScilabScroll member) {
         this.add(member);
         return this.getComponentZOrder(member);
     }
@@ -637,7 +639,9 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        //setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (org.scilab.modules.graphic_objects.console.Console.getConsole().getUseDeprecatedLF()) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
index de81bcf..905ffbe 100644 (file)
@@ -13,6 +13,8 @@
  */
 package org.scilab.modules.gui.bridge.label;
 
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
+
 import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Font;
@@ -33,6 +35,8 @@ import javax.swing.text.html.HTMLDocument;
 import javax.swing.text.html.StyleSheet;
 
 import org.scilab.modules.console.utils.ScilabSpecialTextUtilities;
+import org.scilab.modules.graphic_objects.graphicController.GraphicController;
+import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorderType;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
@@ -263,7 +267,9 @@ public class SwingScilabLabel extends JScrollPane implements SwingViewObject, Si
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
@@ -368,7 +374,7 @@ public class SwingScilabLabel extends JScrollPane implements SwingViewObject, Si
             JTextPane newLabel = new JTextPane();
             newLabel.addHyperlinkListener(urlOpener);
             newLabel.setContentType("text/html");
-            newLabel.setEditable(false);         
+            newLabel.setEditable(false);
             StyleSheet styleSheet = ((HTMLDocument) newLabel.getDocument()).getStyleSheet();
             styleSheet.addRule("body {font-family:" + font.getName() + ";}");
             styleSheet.addRule("body {font-size:" + font.getSize() + "pt;}");
@@ -410,45 +416,45 @@ public class SwingScilabLabel extends JScrollPane implements SwingViewObject, Si
         gbc.gridheight = 1;
 
         switch (ScilabAlignment.toSwingAlignment(horizontalAlignment)) {
-        case SwingConstants.LEFT:
-            switch (ScilabAlignment.toSwingAlignment(verticalAlignment)) {
-            case SwingConstants.TOP:
-                gbc.anchor = GridBagConstraints.NORTHWEST;
-                break;
-            case SwingConstants.CENTER:
-                gbc.anchor = GridBagConstraints.WEST;
-                break;
-            default: // SwingConstants.BOTTOM
-            gbc.anchor = GridBagConstraints.SOUTHWEST;
-            break;
-            }
-            break;
-        case SwingConstants.CENTER:
-            switch (ScilabAlignment.toSwingAlignment(verticalAlignment)) {
-            case SwingConstants.TOP:
-                gbc.anchor = GridBagConstraints.NORTH;
+            case SwingConstants.LEFT:
+                switch (ScilabAlignment.toSwingAlignment(verticalAlignment)) {
+                    case SwingConstants.TOP:
+                        gbc.anchor = GridBagConstraints.NORTHWEST;
+                        break;
+                    case SwingConstants.CENTER:
+                        gbc.anchor = GridBagConstraints.WEST;
+                        break;
+                    default: // SwingConstants.BOTTOM
+                        gbc.anchor = GridBagConstraints.SOUTHWEST;
+                        break;
+                }
                 break;
             case SwingConstants.CENTER:
-                gbc.anchor = GridBagConstraints.CENTER;
-                break;
-            default: // SwingConstants.BOTTOM
-            gbc.anchor = GridBagConstraints.SOUTH;
-            break;
-            }
-            break;
-        default: // SwingConstants.RIGHT
-            switch (ScilabAlignment.toSwingAlignment(verticalAlignment)) {
-            case SwingConstants.TOP:
-                gbc.anchor = GridBagConstraints.NORTHEAST;
+                switch (ScilabAlignment.toSwingAlignment(verticalAlignment)) {
+                    case SwingConstants.TOP:
+                        gbc.anchor = GridBagConstraints.NORTH;
+                        break;
+                    case SwingConstants.CENTER:
+                        gbc.anchor = GridBagConstraints.CENTER;
+                        break;
+                    default: // SwingConstants.BOTTOM
+                        gbc.anchor = GridBagConstraints.SOUTH;
+                        break;
+                }
                 break;
-            case SwingConstants.CENTER:
-                gbc.anchor = GridBagConstraints.EAST;
+            default: // SwingConstants.RIGHT
+                switch (ScilabAlignment.toSwingAlignment(verticalAlignment)) {
+                    case SwingConstants.TOP:
+                        gbc.anchor = GridBagConstraints.NORTHEAST;
+                        break;
+                    case SwingConstants.CENTER:
+                        gbc.anchor = GridBagConstraints.EAST;
+                        break;
+                    default: // SwingConstants.BOTTOM
+                        gbc.anchor = GridBagConstraints.SOUTHEAST;
+                        break;
+                }
                 break;
-            default: // SwingConstants.BOTTOM
-            gbc.anchor = GridBagConstraints.SOUTHEAST;
-            break;
-            }
-            break;
         }
 
         alignmentLayout.setConstraints(label, gbc);
index 6ebde32..805d39c 100644 (file)
@@ -29,6 +29,7 @@ import javax.swing.JList;
 import javax.swing.JScrollPane;
 import javax.swing.ListSelectionModel;
 
+import org.scilab.modules.graphic_objects.console.Console;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.SwingViewObject;
@@ -130,7 +131,7 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
      * To set the Background color of the element.
      * @param color the Color
      */
-    public void setBackground(Color color) {
+    public void setListBackground(Color color) {
         getList().setBackground(color);
     }
 
@@ -439,7 +440,9 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
index b8998a1..2a2e6df 100644 (file)
@@ -305,7 +305,9 @@ public class SwingScilabPopupMenu extends JComboBox implements SwingViewObject,
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
index e58c006..9fc25c6 100644 (file)
@@ -14,6 +14,8 @@
 
 package org.scilab.modules.gui.bridge.pushbutton;
 
+//import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
+
 import java.awt.Dimension;
 import java.awt.Font;
 import java.beans.PropertyChangeEvent;
@@ -24,6 +26,9 @@ import javax.swing.ImageIcon;
 import javax.swing.JButton;
 
 import org.scilab.modules.console.utils.ScilabSpecialTextUtilities;
+import org.scilab.modules.graphic_objects.console.Console;
+//import org.scilab.modules.graphic_objects.graphicController.GraphicController;
+//import org.scilab.modules.graphic_objects.uicontrol.frame.border.FrameBorderType;
 import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
@@ -61,9 +66,12 @@ public class SwingScilabPushButton extends JButton implements SwingViewObject, S
         super();
         setFocusable(false);
 
-        /* Avoid the L&F to erase user background settings */
-        setContentAreaFilled(false);
-        setOpaque(true);
+        if (Console.getConsole().getUseDeprecatedLF()) {
+            /* Avoid the L&F to erase user background settings */
+            setContentAreaFilled(false);
+            setOpaque(true);
+        }
+
         addPropertyChangeListener(ICON_CHANGED_PROPERTY, new PropertyChangeListener() {
             public void propertyChange(PropertyChangeEvent evt) {
                 final Icon newIcon = (Icon) evt.getNewValue();
@@ -253,7 +261,9 @@ public class SwingScilabPushButton extends JButton implements SwingViewObject, S
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
index b24e6da..2c3e9ea 100644 (file)
@@ -20,13 +20,9 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.util.Collection;
 import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
 
 import javax.swing.AbstractButton;
-import javax.swing.ButtonGroup;
 import javax.swing.JRadioButton;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
@@ -287,7 +283,9 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabScroll.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabScroll.java
new file mode 100644 (file)
index 0000000..0ce69e1
--- /dev/null
@@ -0,0 +1,359 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2007 - INRIA - Vincent Couvert
+ * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+ *
+ */
+
+package org.scilab.modules.gui.bridge.slider;
+
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
+
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+
+import javax.swing.JScrollBar;
+
+import org.scilab.modules.graphic_objects.graphicController.GraphicController;
+import org.scilab.modules.gui.SwingViewWidget;
+import org.scilab.modules.gui.SwingViewObject;
+import org.scilab.modules.gui.events.callback.CommonCallBack;
+import org.scilab.modules.gui.menubar.MenuBar;
+import org.scilab.modules.gui.slider.SimpleSlider;
+import org.scilab.modules.gui.textbox.TextBox;
+import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.utils.Position;
+import org.scilab.modules.gui.utils.PositionConverter;
+import org.scilab.modules.gui.utils.ScilabRelief;
+import org.scilab.modules.gui.utils.ScilabSwingUtilities;
+import org.scilab.modules.gui.utils.Size;
+
+/**
+ * Swing implementation for Scilab Slider in GUIs
+ * @author Vincent COUVERT
+ * @author Marouane BEN JELLOUL
+ */
+public class SwingScilabScroll extends JScrollBar implements SwingViewObject, SimpleSlider {
+
+    private static final long serialVersionUID = -4262320156090829309L;
+
+    private static final int MIN_KNOB_SIZE = 40;
+
+    private static final int MINIMUM_VALUE = 0;
+    private static final int MAXIMUM_VALUE = 10000;
+
+    private Integer uid;
+
+    private CommonCallBack callback;
+
+    private AdjustmentListener adjustmentListener;
+
+    /**
+     * Constructor
+     */
+    public SwingScilabScroll() {
+        super();
+        // needed to have slider working with GLCanvas
+        setOpaque(true);
+        setFocusable(true); /* Enable to manage the slider using keyboard (See bug #10840) */
+        setMinimum(MINIMUM_VALUE);
+        setMaximum(MAXIMUM_VALUE + getVisibleAmount());
+        adjustmentListener = new AdjustmentListener() {
+            public void adjustmentValueChanged(AdjustmentEvent arg0) {
+                updateModel();
+                if (callback != null) {
+                    callback.actionPerformed(null);
+                }
+            }
+        };
+        addAdjustmentListener(adjustmentListener);
+    }
+
+    /**
+     * Draws a swing Scilab Slider
+     * @see org.scilab.modules.gui.UIElement#draw()
+     */
+    public void draw() {
+        this.setVisible(true);
+        this.doLayout();
+    }
+
+    /**
+     * Gets the dimensions (width and height) of a swing Scilab Slider
+     * @return the dimensions of the Slider
+     * @see org.scilab.modules.gui.uielement.UIElement#getDims()
+     */
+    public Size getDims() {
+        return new Size(super.getSize().width, super.getSize().height);
+    }
+
+    /**
+     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab Slider
+     * @return the position of the Slider
+     * @see org.scilab.modules.gui.uielement.UIElement#getPosition()
+     */
+    public Position getPosition() {
+        return PositionConverter.javaToScilab(getLocation(), getSize(), getParent());
+    }
+
+    /**
+     * Sets the dimensions (width and height) of a swing Scilab Slider
+     * @param newSize the dimensions to set to the Slider
+     * @see org.scilab.modules.gui.uielement.UIElement#setDims(org.scilab.modules.gui.utils.Size)
+     */
+    public void setDims(Size newSize) {
+        super.setSize(newSize.getWidth(), newSize.getHeight());
+        super.doLayout(); // Usefull in case of resize
+    }
+
+    /**
+     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab Slider
+     * @param newPosition the position to set to the Slider
+     * @see org.scilab.modules.gui.uielement.UIElement#setPosition(org.scilab.modules.gui.utils.Position)
+     */
+    public void setPosition(Position newPosition) {
+        Position javaPosition = PositionConverter.scilabToJava(newPosition, getDims(), getParent());
+        setLocation(javaPosition.getX(), javaPosition.getY());
+    }
+
+    /**
+     * Add a callback to the Slider
+     * @param cb the callback to set.
+     */
+    public void setCallback(CommonCallBack cb) {
+        /* Create a callback */
+        callback = cb;
+    }
+
+    /**
+     * Setter for MenuBar
+     * @param menuBarToAdd the MenuBar associated to the Tab.
+     */
+    public void addMenuBar(MenuBar menuBarToAdd) {
+        /* Unimplemented for CheckBoxes */
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Setter for ToolBar
+     * @param toolBarToAdd the ToolBar associated to the Tab.
+     */
+    public void addToolBar(ToolBar toolBarToAdd) {
+        /* Unimplemented for CheckBoxes */
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Getter for MenuBar
+     * @return MenuBar: the MenuBar associated to the Tab.
+     */
+    public MenuBar getMenuBar() {
+        /* Unimplemented for CheckBoxes */
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Getter for ToolBar
+     * @return ToolBar: the ToolBar associated to the Tab.
+     */
+    public ToolBar getToolBar() {
+        /* Unimplemented for CheckBoxes */
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Get the text of the Slider
+     * @return the text
+     * @see org.scilab.modules.gui.widget.Widget#getText()
+     */
+    public String getText() {
+        return this.getName();
+    }
+
+    /**
+     * Set the text of the Slider
+     * @param text the text to set to the Slider
+     * @see org.scilab.modules.gui.widget.Widget#setText(java.lang.String)
+     */
+    public void setText(String text) {
+        this.setName(text);
+    }
+
+    /**
+     * Set the horizontal alignment for the Slider text
+     * @param alignment the value for the alignment (See ScilabAlignment.java)
+     */
+    public void setHorizontalAlignment(String alignment) {
+        // Nothing to do here
+    }
+
+    /**
+     * Set the vertical alignment for the Slider text
+     * @param alignment the value for the alignment (See ScilabAlignment.java)
+     */
+    public void setVerticalAlignment(String alignment) {
+        // Nothing to do here
+    }
+
+    /**
+     * Set the minimum value of a Slider
+     * @param value the minimum value
+     */
+    public void setMinimumValue(double value) {
+        updateModel(); /* Update the model according to the knob position */
+    }
+
+    /**
+     * Set the maximum value of a Slider
+     * @param value the maximum value
+     */
+    public void setMaximumValue(double value) {
+        updateModel(); /* Update the model according to the knob position */
+    }
+
+    /**
+     * Set the Relief of the Slider
+     * @param reliefType the type of the relief to set (See ScilabRelief.java)
+     */
+    public void setRelief(String reliefType) {
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
+    }
+
+    /**
+     * Set the major tick spacing for a Slider
+     * @param space the increment value
+     */
+    public void setMajorTickSpacing(double space) {
+        /* Remove the listener to avoid the callback to be executed */
+        removeAdjustmentListener(adjustmentListener);
+
+        double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+        double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+        setBlockIncrement((int) (space * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
+        int oldMax = getMaximum() - getVisibleAmount();
+        setVisibleAmount(Math.max((int) ((MAXIMUM_VALUE - MINIMUM_VALUE) / space), MIN_KNOB_SIZE));
+        setMaximum(oldMax + getVisibleAmount());
+
+        System.out.println("old major = " + (int) (space * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
+        /* Put back the listener */
+        addAdjustmentListener(adjustmentListener);
+    }
+
+    /**
+     * Set the minor tick spacing for a Slider
+     * @param space the increment value
+     */
+    public void setMinorTickSpacing(double space) {
+        /* Remove the listener to avoid the callback to be executed */
+        removeAdjustmentListener(adjustmentListener);
+
+        double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+        double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+        setUnitIncrement((int) (space * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
+        System.out.println("old minor = " + (int) (space * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
+
+        /* Put back the listener */
+        addAdjustmentListener(adjustmentListener);
+    }
+
+    /**
+     * Set the slider orientation to vertical
+     */
+    public void setVertical() {
+        setOrientation(JScrollBar.VERTICAL);
+    }
+
+    /**
+     * Set the slider orientation to horizontal
+     */
+    public void setHorizontal() {
+        setOrientation(JScrollBar.HORIZONTAL);
+    }
+
+    /**
+     * Destroy the Slider
+     */
+    public void destroy() {
+        ScilabSwingUtilities.removeFromParent(this);
+    }
+
+    /**
+     * Setter for InfoBar
+     * @param infoBarToAdd the InfoBar associated to the Slider.
+     */
+    public void addInfoBar(TextBox infoBarToAdd) {
+        /* Unimplemented for Sliders */
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Getter for InfoBar
+     * @return the InfoBar associated to the Slider.
+     */
+    public TextBox getInfoBar() {
+        /* Unimplemented for Sliders */
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Set the current value of the Slider
+     * @param value the new value
+     */
+    public void setUserValue(double value) {
+        /* Remove the listener to avoid the callback to be executed */
+        removeAdjustmentListener(adjustmentListener);
+
+        double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+        double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+        super.setValue(MINIMUM_VALUE + (int) ((value - userMin) * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
+
+        /* Put back the listener */
+        addAdjustmentListener(adjustmentListener);
+    }
+
+    /**
+     * Set the UID
+     * @param id the UID
+     */
+    public void setId(Integer id) {
+        uid = id;
+    }
+
+    /**
+     * Get the UID
+     * @return the UID
+     */
+    public Integer getId() {
+        return uid;
+    }
+
+    /**
+     * Generic update method
+     * @param property property name
+     * @param value property value
+     */
+    public void update(int property, Object value) {
+        SwingViewWidget.update(this, property, value);
+    }
+
+    /**
+     * Update values in the model when needed
+     */
+    private void updateModel() {
+        Double[] value = new Double[1];
+        double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+        double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+        value[0] = userMin + ((getValue() - MINIMUM_VALUE) * (userMax - userMin) / (MAXIMUM_VALUE - MINIMUM_VALUE));
+        GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, value);
+    }
+}
index f1922f5..1d38c47 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Vincent Couvert
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
+ * Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
  *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
@@ -15,16 +14,21 @@ package org.scilab.modules.gui.bridge.slider;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDERSTEP__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 
-import java.awt.event.AdjustmentEvent;
-import java.awt.event.AdjustmentListener;
+import java.awt.event.ActionEvent;
 
+import javax.swing.AbstractAction;
 import javax.swing.JScrollBar;
+import javax.swing.JSlider;
+import javax.swing.KeyStroke;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
-import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.SwingViewObject;
+import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.slider.SimpleSlider;
@@ -41,12 +45,10 @@ import org.scilab.modules.gui.utils.Size;
  * @author Vincent COUVERT
  * @author Marouane BEN JELLOUL
  */
-public class SwingScilabSlider extends JScrollBar implements SwingViewObject, SimpleSlider {
+public class SwingScilabSlider extends JSlider implements SwingViewObject, SimpleSlider {
 
     private static final long serialVersionUID = -4262320156090829309L;
 
-    private static final int MIN_KNOB_SIZE = 40;
-
     private static final int MINIMUM_VALUE = 0;
     private static final int MAXIMUM_VALUE = 10000;
 
@@ -54,7 +56,67 @@ public class SwingScilabSlider extends JScrollBar implements SwingViewObject, Si
 
     private CommonCallBack callback;
 
-    private AdjustmentListener adjustmentListener;
+    private ChangeListener changeListener;
+
+    class CtrlLeftAction extends AbstractAction {
+        private static final long serialVersionUID = -3289281207742516486L;
+
+        public void actionPerformed(ActionEvent arg0) {
+            double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+            double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+            Double[] step = (Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__);
+            int value = SwingScilabSlider.this.getValue();
+
+            double ratio = (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin);
+            int newValue = Math.max(MINIMUM_VALUE, value - (int)(step[1] * ratio));
+            setValue(newValue);
+        }
+    }
+
+    class LeftAction extends AbstractAction {
+        private static final long serialVersionUID = 2099826485447918397L;
+
+        public void actionPerformed(ActionEvent arg0) {
+            double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+            double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+            Double[] step = (Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__);
+            int value = SwingScilabSlider.this.getValue();
+
+            double ratio = (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin);
+            int newValue = Math.max(MINIMUM_VALUE, value - (int)(step[0] * ratio));
+            setValue(newValue);
+        }
+    }
+
+    class RightAction extends AbstractAction {
+        private static final long serialVersionUID = 8666161246122371904L;
+
+        public void actionPerformed(ActionEvent arg0) {
+            double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+            double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+            Double[] step = (Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__);
+            int value = SwingScilabSlider.this.getValue();
+
+            double ratio = (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin);
+            int newValue = Math.min(MAXIMUM_VALUE, value + (int)(step[0] * ratio));
+            setValue(newValue);
+        }
+    }
+
+    class CtrlRightAction extends AbstractAction {
+        private static final long serialVersionUID = -1364255463511656338L;
+
+        public void actionPerformed(ActionEvent arg0) {
+            double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
+            double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
+            Double[] step = (Double[]) GraphicController.getController().getProperty(uid, __GO_UI_SLIDERSTEP__);
+            int value = SwingScilabSlider.this.getValue();
+
+            double ratio = (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin);
+            int newValue = Math.min(MAXIMUM_VALUE, value + (int)(step[1] * ratio));
+            setValue(newValue);
+        }
+    }
 
     /**
      * Constructor
@@ -63,18 +125,34 @@ public class SwingScilabSlider extends JScrollBar implements SwingViewObject, Si
         super();
         // needed to have slider working with GLCanvas
         setOpaque(true);
-        setFocusable(true); /* Enable to manage the slider using keyboard (See bug #10840) */
         setMinimum(MINIMUM_VALUE);
-        setMaximum(MAXIMUM_VALUE + getVisibleAmount());
-        adjustmentListener = new AdjustmentListener() {
-            public void adjustmentValueChanged(AdjustmentEvent arg0) {
+        setMaximum(MAXIMUM_VALUE);
+        setValue(0);
+
+        /* some keys binding */
+        getInputMap().put(KeyStroke.getKeyStroke("DOWN"), "LeftAction");
+        getInputMap().put(KeyStroke.getKeyStroke("LEFT"), "LeftAction");
+        getActionMap().put("LeftAction", new LeftAction());
+        getInputMap().put(KeyStroke.getKeyStroke("UP"), "RightAction");
+        getInputMap().put(KeyStroke.getKeyStroke("RIGHT"), "RightAction");
+        getActionMap().put("RightAction", new RightAction());
+        getInputMap().put(KeyStroke.getKeyStroke("control UP"), "CtrlRightAction");
+        getInputMap().put(KeyStroke.getKeyStroke("control RIGHT"), "CtrlRightAction");
+        getActionMap().put("CtrlRightAction", new CtrlRightAction());
+        getInputMap().put(KeyStroke.getKeyStroke("control DOWN"), "CtrlLeftAction");
+        getInputMap().put(KeyStroke.getKeyStroke("control LEFT"), "CtrlLeftAction");
+        getActionMap().put("CtrlLeftAction", new CtrlLeftAction());
+
+
+        changeListener = new ChangeListener() {
+            public void stateChanged(ChangeEvent arg0) {
                 updateModel();
                 if (callback != null) {
                     callback.actionPerformed(null);
                 }
             }
         };
-        addAdjustmentListener(adjustmentListener);
+        addChangeListener(changeListener);
     }
 
     /**
@@ -224,7 +302,9 @@ public class SwingScilabSlider extends JScrollBar implements SwingViewObject, Si
      * @param reliefType the type of the relief to set (See ScilabRelief.java)
      */
     public void setRelief(String reliefType) {
-        setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        if (reliefType.equals("") == false) {
+            setBorder(ScilabRelief.getBorderFromRelief(reliefType));
+        }
     }
 
     /**
@@ -232,18 +312,13 @@ public class SwingScilabSlider extends JScrollBar implements SwingViewObject, Si
      * @param space the increment value
      */
     public void setMajorTickSpacing(double space) {
-        /* Remove the listener to avoid the callback to be executed */
-        removeAdjustmentListener(adjustmentListener);
-
         double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
         double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
-        setBlockIncrement((int) (space * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
-        int oldMax = getMaximum() - getVisibleAmount();
-        setVisibleAmount(Math.max((int) ((MAXIMUM_VALUE - MINIMUM_VALUE) / space), MIN_KNOB_SIZE));
-        setMaximum(oldMax + getVisibleAmount());
 
-        /* Put back the listener */
-        addAdjustmentListener(adjustmentListener);
+        double ratio = (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin);
+        int newspace = (int)(space * ratio);
+        System.out.println("major : " + newspace);
+        super.setMajorTickSpacing(newspace);
     }
 
     /**
@@ -251,15 +326,13 @@ public class SwingScilabSlider extends JScrollBar implements SwingViewObject, Si
      * @param space the increment value
      */
     public void setMinorTickSpacing(double space) {
-        /* Remove the listener to avoid the callback to be executed */
-        removeAdjustmentListener(adjustmentListener);
-
         double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
         double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
-        setUnitIncrement((int) (space * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
 
-        /* Put back the listener */
-        addAdjustmentListener(adjustmentListener);
+        double ratio = (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin);
+        int newspace = (int)(space * ratio);
+        System.out.println("minor : " + newspace);
+        super.setMinorTickSpacing(newspace);
     }
 
     /**
@@ -307,14 +380,14 @@ public class SwingScilabSlider extends JScrollBar implements SwingViewObject, Si
      */
     public void setUserValue(double value) {
         /* Remove the listener to avoid the callback to be executed */
-        removeAdjustmentListener(adjustmentListener);
+        removeChangeListener(changeListener);
 
         double userMin = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MIN__);
         double userMax = (Double) GraphicController.getController().getProperty(uid, __GO_UI_MAX__);
-        super.setValue(MINIMUM_VALUE + (int) ((value - userMin) * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
+        setValue(MINIMUM_VALUE + (int) ((value - userMin) * (MAXIMUM_VALUE - MINIMUM_VALUE) / (userMax - userMin)));
 
         /* Put back the listener */
-        addAdjustmentListener(adjustmentListener);
+        addChangeListener(changeListener);
     }
 
     /**
index e1249ce..80dcb2d 100644 (file)
@@ -73,7 +73,7 @@ import org.scilab.modules.gui.bridge.menubar.SwingScilabMenuBar;
 import org.scilab.modules.gui.bridge.popupmenu.SwingScilabPopupMenu;
 import org.scilab.modules.gui.bridge.pushbutton.SwingScilabPushButton;
 import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
-import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
+import org.scilab.modules.gui.bridge.slider.SwingScilabScroll;
 import org.scilab.modules.gui.bridge.toolbar.SwingScilabToolBar;
 import org.scilab.modules.gui.bridge.tree.SwingScilabTree;
 import org.scilab.modules.gui.bridge.uidisplaytree.SwingScilabUiDisplayTree;
@@ -125,7 +125,7 @@ import org.scilab.modules.gui.utils.Size;
 
 public class SwingScilabDockablePanel extends View implements SimpleTab, FocusListener, KeyListener, SwingScilabPanel {
 
-    
+
 
     private static final Image SCILAB_ICON = new ImageIcon(ScilabSwingUtilities.findIcon("scilab", "256x256")).getImage();
 
@@ -975,7 +975,7 @@ public class SwingScilabDockablePanel extends View implements SimpleTab, FocusLi
      * @return index of member in ArrayList
      */
     public int addMember(Slider member) {
-        return this.addMember((SwingScilabSlider) member.getAsSimpleSlider());
+        return this.addMember((SwingScilabScroll) member.getAsSimpleSlider());
     }
 
     /**
@@ -983,7 +983,7 @@ public class SwingScilabDockablePanel extends View implements SimpleTab, FocusLi
      * @param member the member to add
      * @return index of member in ArrayList
      */
-    private int addMember(SwingScilabSlider member) {
+    private int addMember(SwingScilabScroll member) {
         return contentPane.addWidget(member);
     }
 
@@ -993,14 +993,14 @@ public class SwingScilabDockablePanel extends View implements SimpleTab, FocusLi
      */
     @Override
     public void removeMember(Slider member) {
-        this.removeMember((SwingScilabSlider) member.getAsSimpleSlider());
+        this.removeMember((SwingScilabScroll) member.getAsSimpleSlider());
     }
 
     /**
      * Remove a Slider from its container
      * @param member the Slider to remove
      */
-    private void removeMember(SwingScilabSlider member) {
+    private void removeMember(SwingScilabScroll member) {
         contentPane.removeWidget(member);
     }
 
@@ -1482,7 +1482,7 @@ public class SwingScilabDockablePanel extends View implements SimpleTab, FocusLi
             input.dispatchEvent(new KeyEvent(input, KeyEvent.KEY_TYPED, System.currentTimeMillis(), e.getModifiers(), e.getKeyCode(), e.getKeyChar(), e.getKeyLocation()));
         }
     }
-    
+
     public JLayeredPane getWidgetPane() {
         return uiContentPane;
     }
index 02e77f7..84dff63 100644 (file)
@@ -62,7 +62,7 @@ public class SwingScilabDockingWindow extends SwingScilabWindow {
                 ClosingOperationsManager.startClosingOperation(SwingScilabDockingWindow.this);
             }
         });
-
+        setVisible(true);
     }
 
     /**
index 5d93298..e45d5bb 100644 (file)
@@ -16,7 +16,7 @@ package org.scilab.modules.gui.slider;
 import java.awt.Color;
 import java.awt.Font;
 
-import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
+import org.scilab.modules.gui.bridge.slider.SwingScilabScroll;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
@@ -40,7 +40,7 @@ public class ScilabSliderBridge {
      * @return the created Slider
      */
     public static SimpleSlider createSlider() {
-        return new SwingScilabSlider();
+        return new SwingScilabScroll();
     }
 
     /**