// =============================================================================
// <-- TEST WITH GRAPHIC -->
function fig = createFigure(layout)
- fig = scf();
+ fig = figure("dockable", "off" ,"infobar_visible", "off", "toolbar_visible", "off", "menubar_visible", "off", "default_axes", "off")
fig.layout = layout;
- fig.toolbar_visible = "off";
- fig.menubar_visible = "off";
- fig.infobar_visible = "off";
endfunction
//constraints
//no border
createFigure("none");
c = createConstraints("nolayout");
-u = uicontrol("constraints", c);
+u = uicontrol("constraints", c, "string", "button", "position", [10 10 100 30]);
assert_checkequal(u.constraints, c);
delete(gcf());
//border layout
createFigure("border");
c = createConstraints("border", "center");
-u = uicontrol("constraints", c, "string", "center");
+u = uicontrol("constraints", c, "string", "center [-1 -1]");
assert_checkequal(u.constraints, c);
-c = createConstraints("border", "left");
-u = uicontrol("constraints", c, "string", "left");
+c = createConstraints("border", "left", [150 150]);
+u = uicontrol("constraints", c, "string", "left [150 150]");
assert_checkequal(u.constraints, c);
-c = createConstraints("border", "right");
-u = uicontrol("constraints", c, "string", "right");
+c = createConstraints("border", "right", [250 250]);
+u = uicontrol("constraints", c, "string", "right [250 250]");
assert_checkequal(u.constraints, c);
-c = createConstraints("border", "top");
-u = uicontrol("constraints", c, "string", "top");
+c = createConstraints("border", "top", [50 50]);
+u = uicontrol("constraints", c, "string", "top [50 50]");
assert_checkequal(u.constraints, c);
-c = createConstraints("border", "bottom");
-u = uicontrol("constraints", c, "string", "bottom");
+c = createConstraints("border", "bottom", [100, 100]);
+u = uicontrol("constraints", c, "string", "bottom [100 100]");
assert_checkequal(u.constraints, c);
delete(gcf());
//grid layout
-createFigure("grid");
-c = createConstraints("grid");
-u = uicontrol("constraints", c);
-assert_checkequal(u.constraints, c);
+f = createFigure("grid");
+f.layout_options = createLayoutOptions("grid", [3 4], [10 10]);
+uicontrol("constraints", c, "string", "11");
+uicontrol("constraints", c, "string", "12");
+uicontrol("constraints", c, "string", "13");
+uicontrol("constraints", c, "string", "14");
+uicontrol("constraints", c, "string", "21");
+uicontrol("constraints", c, "string", "22");
+uicontrol("constraints", c, "string", "23");
+uicontrol("constraints", c, "string", "24");
+uicontrol("constraints", c, "string", "31");
+uicontrol("constraints", c, "string", "32");
+uicontrol("constraints", c, "string", "33");
+uicontrol("constraints", c, "string", "34");
delete(gcf());
//gridbag layout
-createFigure("gridbag");
-c = createConstraints("gridbag", [1 2 3 4]);
-u = uicontrol("constraints", c);
+f = createFigure("gridbag");
+c = createConstraints("gridbag", [1 1 1 1]);
+u = uicontrol("constraints", c, "string", "text1");
+assert_checkequal(u.constraints, c);
+c = createConstraints("gridbag", [2 1 1 1], [1.0 1.0]);
+u = uicontrol("constraints", c, "string", "text2");
assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1]);
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [1 2 2 1], [1.0 1.0], "vertical");
+u = uicontrol("constraints", c, "string", "text3");
assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both");
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [3 1 1 2], [1.0 1.0], "both", "lower_left", [0 0]);
+u = uicontrol("constraints", c, "string", "text4");
assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both", "lower_left");
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [1 4 3 2], [1.0 1.0], "both", "center", [0 0], [-1 -1]);
+u = uicontrol("constraints", c, "string", "text5");
assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both", "lower_left", [10 20]);
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [1 6 3 2], [1.0 1.0], "both", "center", [0 0], [200 200]);
+u = uicontrol("constraints", c, "string", "text6");
assert_checkequal(u.constraints, c);
delete(gcf());
// options
createFigure("grid");
f = gcf();
assert_checkequal(f.layout_options, createLayoutOptions("grid"));
-f.layout_options = createLayoutOptions("grid", [30,40]);
-assert_checkequal(f.layout_options, createLayoutOptions("grid", [30,40]));
-f.layout_options = createLayoutOptions("grid", [10,20], [30,40]);
-assert_checkequal(f.layout_options, createLayoutOptions("grid", [10,20], [30,40]));
+f.layout_options = createLayoutOptions("grid", [5,3]);
+assert_checkequal(f.layout_options, createLayoutOptions("grid", [5,3]));
+f.layout_options = createLayoutOptions("grid", [5,3], [30,40]);
+assert_checkequal(f.layout_options, createLayoutOptions("grid", [5,3], [30,40]));
delete(gcf());
function fig = createFigure(layout)
- fig = scf();
+ fig = figure("dockable", "off" ,"infobar_visible", "off", "toolbar_visible", "off", "menubar_visible", "off", "default_axes", "off")
fig.layout = layout;
- fig.toolbar_visible = "off";
- fig.menubar_visible = "off";
- fig.infobar_visible = "off";
endfunction
//constraints
createFigure("none");
c = createConstraints("nolayout");
-u = uicontrol("constraints", c);
+u = uicontrol("constraints", c, "string", "button", "position", [10 10 100 30]);
assert_checkequal(u.constraints, c);
delete(gcf());
createFigure("border");
c = createConstraints("border", "center");
-u = uicontrol("constraints", c, "string", "center");
+u = uicontrol("constraints", c, "string", "center [-1 -1]");
assert_checkequal(u.constraints, c);
-c = createConstraints("border", "left");
-u = uicontrol("constraints", c, "string", "left");
+c = createConstraints("border", "left", [150 150]);
+u = uicontrol("constraints", c, "string", "left [150 150]");
assert_checkequal(u.constraints, c);
-c = createConstraints("border", "right");
-u = uicontrol("constraints", c, "string", "right");
+c = createConstraints("border", "right", [250 250]);
+u = uicontrol("constraints", c, "string", "right [250 250]");
assert_checkequal(u.constraints, c);
-c = createConstraints("border", "top");
-u = uicontrol("constraints", c, "string", "top");
+c = createConstraints("border", "top", [50 50]);
+u = uicontrol("constraints", c, "string", "top [50 50]");
assert_checkequal(u.constraints, c);
-c = createConstraints("border", "bottom");
-u = uicontrol("constraints", c, "string", "bottom");
+c = createConstraints("border", "bottom", [100, 100]);
+u = uicontrol("constraints", c, "string", "bottom [100 100]");
assert_checkequal(u.constraints, c);
delete(gcf());
//grid layout
-createFigure("grid");
-
-c = createConstraints("grid");
-u = uicontrol("constraints", c);
-assert_checkequal(u.constraints, c);
+f = createFigure("grid");
+f.layout_options = createLayoutOptions("grid", [3 4], [10 10]);
+uicontrol("constraints", c, "string", "11");
+uicontrol("constraints", c, "string", "12");
+uicontrol("constraints", c, "string", "13");
+uicontrol("constraints", c, "string", "14");
+uicontrol("constraints", c, "string", "21");
+uicontrol("constraints", c, "string", "22");
+uicontrol("constraints", c, "string", "23");
+uicontrol("constraints", c, "string", "24");
+uicontrol("constraints", c, "string", "31");
+uicontrol("constraints", c, "string", "32");
+uicontrol("constraints", c, "string", "33");
+uicontrol("constraints", c, "string", "34");
delete(gcf());
//gridbag layout
-createFigure("gridbag");
+f = createFigure("gridbag");
+
+c = createConstraints("gridbag", [1 1 1 1]);
+u = uicontrol("constraints", c, "string", "text1");
+assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4]);
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [2 1 1 1], [1.0 1.0]);
+u = uicontrol("constraints", c, "string", "text2");
assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1]);
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [1 2 2 1], [1.0 1.0], "vertical");
+u = uicontrol("constraints", c, "string", "text3");
assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both");
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [3 1 1 2], [1.0 1.0], "both", "lower_left", [0 0]);
+u = uicontrol("constraints", c, "string", "text4");
assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both", "lower_left");
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [1 4 3 2], [1.0 1.0], "both", "center", [0 0], [-1 -1]);
+u = uicontrol("constraints", c, "string", "text5");
assert_checkequal(u.constraints, c);
-c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both", "lower_left", [10 20]);
-u = uicontrol("constraints", c);
+c = createConstraints("gridbag", [1 6 3 2], [1.0 1.0], "both", "center", [0 0], [200 200]);
+u = uicontrol("constraints", c, "string", "text6");
assert_checkequal(u.constraints, c);
delete(gcf());
f = gcf();
assert_checkequal(f.layout_options, createLayoutOptions("grid"));
-f.layout_options = createLayoutOptions("grid", [30,40]);
-assert_checkequal(f.layout_options, createLayoutOptions("grid", [30,40]));
+f.layout_options = createLayoutOptions("grid", [5,3]);
+assert_checkequal(f.layout_options, createLayoutOptions("grid", [5,3]));
-f.layout_options = createLayoutOptions("grid", [10,20], [30,40]);
-assert_checkequal(f.layout_options, createLayoutOptions("grid", [10,20], [30,40]));
+f.layout_options = createLayoutOptions("grid", [5,3], [30,40]);
+assert_checkequal(f.layout_options, createLayoutOptions("grid", [5,3], [30,40]));
delete(gcf());
public Boolean isLayerActive(Component layer) {
Integer index = getLayerIndex(layer);
+ System.out.println("isLayerActive : " + index);
if (index == -1) {
return false;
}
- return isLayerActive(index);
+ return isLayerActive(getComponentCount() - (index - 1));
}
SwingViewObject previousFrame = (SwingViewObject)getLayerFromIndex(previous);
SwingViewObject nextFrame = (SwingViewObject) getLayerFromIndex(next);
+ System.out.println("previous : " + previous);
+ System.out.println("next : " + next);
String name = null;
if (previousFrame != null) {
+ System.out.println("visible false : " + previousFrame.getId());
GraphicController.getController().setProperty(previousFrame.getId(), __GO_VISIBLE__, false);
}
if (nextFrame != null) {
+ System.out.println("visible true : " + nextFrame.getId());
GraphicController.getController().setProperty(nextFrame.getId(), __GO_VISIBLE__, true);
name = (String)GraphicController.getController().getProperty(nextFrame.getId(), __GO_TAG__);
}
//4 layers
delete(gcf());
layer = create_layer(4);
-visible1 = ['off' 'off' 'off' 'on'];
-visible2 = ['off' 'off' 'on' 'off'];
-visible3 = ['off' 'on' 'off' 'off'];
-visible4 = ['on' 'off' 'off' 'off'];
+visible1 = ['on' 'off' 'off' 'off'];
+visible2 = ['off' 'on' 'off' 'off'];
+visible3 = ['off' 'off' 'on' 'off'];
+visible4 = ['off' 'off' 'off' 'on'];
assert_checkequal(layer.value, 1);
assert_checkequal(layer.children.visible, visible1);
layer.value = 2;
delete(gcf());
layer = create_layer(4);
-visible1 = ['off' 'off' 'off' 'on'];
-visible2 = ['off' 'off' 'on' 'off'];
-visible3 = ['off' 'on' 'off' 'off'];
-visible4 = ['on' 'off' 'off' 'off'];
+visible1 = ['on' 'off' 'off' 'off'];
+visible2 = ['off' 'on' 'off' 'off'];
+visible3 = ['off' 'off' 'on' 'off'];
+visible4 = ['off' 'off' 'off' 'on'];
assert_checkequal(layer.value, 1);
assert_checkequal(layer.children.visible, visible1);