1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["javax.swing.JComponent"], "javax.swing.JSplitPane", ["java.lang.Boolean", "$.IllegalArgumentException", "javax.swing.JButton", "$.UIManager"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 this.continuousLayout = false;
6 this.leftComponent = null;
7 this.rightComponent = null;
9 this.dividerSizeSet = false;
10 this.oneTouchExpandable = false;
11 this.oneTouchExpandableSet = false;
12 this.lastDividerLocation = 0;
13 this.resizeWeight = 0;
14 this.dividerLocation = 0;
15 Clazz.instantialize (this, arguments);
16 }, javax.swing, "JSplitPane", javax.swing.JComponent);
17 Clazz.makeConstructor (c$,
19 this.construct (1, false, new javax.swing.JButton (javax.swing.UIManager.getString ("SplitPane.leftButtonText")), new javax.swing.JButton (javax.swing.UIManager.getString ("SplitPane.rightButtonText")));
21 Clazz.makeConstructor (c$,
22 function (newOrientation) {
23 this.construct (newOrientation, false);
25 Clazz.makeConstructor (c$,
26 function (newOrientation, newContinuousLayout) {
27 this.construct (newOrientation, newContinuousLayout, null, null);
29 Clazz.makeConstructor (c$,
30 function (newOrientation, newLeftComponent, newRightComponent) {
31 this.construct (newOrientation, false, newLeftComponent, newRightComponent);
32 }, "~N,java.awt.Component,java.awt.Component");
33 Clazz.makeConstructor (c$,
34 function (newOrientation, newContinuousLayout, newLeftComponent, newRightComponent) {
35 Clazz.superConstructor (this, javax.swing.JSplitPane);
36 this.dividerLocation = -1;
37 this.setLayout (null);
38 this.setUIProperty ("opaque", Boolean.TRUE);
39 this.orientation = newOrientation;
40 if (this.orientation != 1 && this.orientation != 0) throw new IllegalArgumentException ("cannot create JSplitPane, orientation must be one of JSplitPane.HORIZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT");
41 this.continuousLayout = newContinuousLayout;
42 if (newLeftComponent != null) this.setLeftComponent (newLeftComponent);
43 if (newRightComponent != null) this.setRightComponent (newRightComponent);
45 }, "~N,~B,java.awt.Component,java.awt.Component");
46 Clazz.defineMethod (c$, "setUI",
49 Clazz.superCall (this, javax.swing.JSplitPane, "setUI", [ui]);
51 }}, "javax.swing.plaf.SplitPaneUI");
52 Clazz.overrideMethod (c$, "getUI",
56 Clazz.overrideMethod (c$, "updateUI",
58 this.setUI (javax.swing.UIManager.getUI (this));
61 Clazz.overrideMethod (c$, "getUIClassID",
65 Clazz.defineMethod (c$, "setDividerSize",
67 var oldSize = this.dividerSize;
68 this.dividerSizeSet = true;
69 if (oldSize != newSize) {
70 this.dividerSize = newSize;
71 this.firePropertyChangeInt ("dividerSize", oldSize, newSize);
73 Clazz.defineMethod (c$, "getDividerSize",
75 return this.dividerSize;
77 Clazz.defineMethod (c$, "setLeftComponent",
80 if (this.leftComponent != null) {
81 this.remove (this.leftComponent);
82 this.leftComponent = null;
84 this.add (comp, "left");
85 }}, "java.awt.Component");
86 Clazz.defineMethod (c$, "getLeftComponent",
88 return this.leftComponent;
90 Clazz.defineMethod (c$, "setTopComponent",
92 this.setLeftComponent (comp);
93 }, "java.awt.Component");
94 Clazz.defineMethod (c$, "getTopComponent",
96 return this.leftComponent;
98 Clazz.defineMethod (c$, "setRightComponent",
101 if (this.rightComponent != null) {
102 this.remove (this.rightComponent);
103 this.rightComponent = null;
105 this.add (comp, "right");
106 }}, "java.awt.Component");
107 Clazz.defineMethod (c$, "getRightComponent",
109 return this.rightComponent;
111 Clazz.defineMethod (c$, "setBottomComponent",
113 this.setRightComponent (comp);
114 }, "java.awt.Component");
115 Clazz.defineMethod (c$, "getBottomComponent",
117 return this.rightComponent;
119 Clazz.defineMethod (c$, "setOneTouchExpandable",
120 function (newValue) {
121 var oldValue = this.oneTouchExpandable;
122 this.oneTouchExpandable = newValue;
123 this.oneTouchExpandableSet = true;
124 this.firePropertyChangeBool ("oneTouchExpandable", oldValue, newValue);
127 Clazz.defineMethod (c$, "isOneTouchExpandable",
129 return this.oneTouchExpandable;
131 Clazz.defineMethod (c$, "setLastDividerLocation",
132 function (newLastLocation) {
133 var oldLocation = this.lastDividerLocation;
134 this.lastDividerLocation = newLastLocation;
135 this.firePropertyChangeInt ("lastDividerLocation", oldLocation, newLastLocation);
137 Clazz.defineMethod (c$, "getLastDividerLocation",
139 return this.lastDividerLocation;
141 Clazz.defineMethod (c$, "setOrientation",
142 function (orientation) {
143 if ((orientation != 0) && (orientation != 1)) {
144 throw new IllegalArgumentException ("JSplitPane: orientation must be one of JSplitPane.VERTICAL_SPLIT or JSplitPane.HORIZONTAL_SPLIT");
145 }var oldOrientation = this.orientation;
146 this.orientation = orientation;
147 this.firePropertyChangeInt ("orientation", oldOrientation, orientation);
149 Clazz.defineMethod (c$, "getOrientation",
151 return this.orientation;
153 Clazz.defineMethod (c$, "setContinuousLayout",
154 function (newContinuousLayout) {
155 var oldCD = this.continuousLayout;
156 this.continuousLayout = newContinuousLayout;
157 this.firePropertyChangeBool ("continuousLayout", oldCD, newContinuousLayout);
159 Clazz.defineMethod (c$, "isContinuousLayout",
161 return this.continuousLayout;
163 Clazz.defineMethod (c$, "setResizeWeight",
165 if (value < 0 || value > 1) {
166 throw new IllegalArgumentException ("JSplitPane weight must be between 0 and 1");
167 }var oldWeight = this.resizeWeight;
168 this.resizeWeight = value;
169 this.firePropertyChangeObject ("resizeWeight", new Double (oldWeight), new Double (value));
171 Clazz.defineMethod (c$, "getResizeWeight",
173 return this.resizeWeight;
175 Clazz.defineMethod (c$, "resetToPreferredSizes",
177 var ui = this.getUI ();
179 ui.resetToPreferredSizes (this);
181 Clazz.defineMethod (c$, "setDividerLocation",
182 function (proportionalLocation) {
183 if (proportionalLocation < 0.0 || proportionalLocation > 1.0) {
184 throw new IllegalArgumentException ("proportional location must be between 0.0 and 1.0.");
185 }if (this.getOrientation () == 0) {
186 this.setDividerLocation (Clazz.doubleToInt ((this.getHeight () - this.getDividerSize ()) * proportionalLocation));
188 this.setDividerLocation (Clazz.doubleToInt ((this.getWidth () - this.getDividerSize ()) * proportionalLocation));
190 Clazz.defineMethod (c$, "setDividerLocation",
191 function (location) {
192 var oldValue = this.dividerLocation;
193 this.dividerLocation = location;
194 var ui = this.getUI ();
196 ui.setDividerLocation (this, location);
197 }this.firePropertyChangeInt ("dividerLocation", oldValue, location);
198 this.setLastDividerLocation (oldValue);
200 Clazz.defineMethod (c$, "getDividerLocation",
202 return this.dividerLocation;
204 Clazz.defineMethod (c$, "getMinimumDividerLocation",
206 var ui = this.getUI ();
208 return ui.getMinimumDividerLocation (this);
211 Clazz.defineMethod (c$, "getMaximumDividerLocation",
213 var ui = this.getUI ();
215 return ui.getMaximumDividerLocation (this);
218 Clazz.defineMethod (c$, "remove",
219 function (component) {
220 if (component === this.leftComponent) {
221 this.leftComponent = null;
222 } else if (component === this.rightComponent) {
223 this.rightComponent = null;
224 }Clazz.superCall (this, javax.swing.JSplitPane, "remove", [component]);
227 }, "java.awt.Component");
228 Clazz.defineMethod (c$, "remove",
230 var comp = this.getComponent (index);
231 if (comp === this.leftComponent) {
232 this.leftComponent = null;
233 } else if (comp === this.rightComponent) {
234 this.rightComponent = null;
235 }Clazz.superCall (this, javax.swing.JSplitPane, "remove", [index]);
239 Clazz.defineMethod (c$, "removeAll",
241 this.leftComponent = this.rightComponent = null;
242 Clazz.superCall (this, javax.swing.JSplitPane, "removeAll", []);
246 Clazz.overrideMethod (c$, "isValidateRoot",
250 Clazz.overrideMethod (c$, "addImpl",
251 function (comp, constraints, index) {
253 if (constraints != null && !(Clazz.instanceOf (constraints, String))) {
254 throw new IllegalArgumentException ("cannot add to layout: constraint must be a string (or null)");
255 }if (constraints == null) {
256 if (this.getLeftComponent () == null) {
257 constraints = "left";
258 } else if (this.getRightComponent () == null) {
259 constraints = "right";
260 }}if (constraints != null && (constraints.equals ("left") || constraints.equals ("top"))) {
261 toRemove = this.getLeftComponent ();
262 if (toRemove != null) {
263 this.remove (toRemove);
264 }this.leftComponent = comp;
266 } else if (constraints != null && (constraints.equals ("right") || constraints.equals ("bottom"))) {
267 toRemove = this.getRightComponent ();
268 if (toRemove != null) {
269 this.remove (toRemove);
270 }this.rightComponent = comp;
272 } else if (constraints != null && constraints.equals ("divider")) {
274 }this.addImplSAEM (comp, constraints, index);
278 }, "java.awt.Component,~O,~N");
279 Clazz.defineMethod (c$, "paintChildren",
281 Clazz.superCall (this, javax.swing.JSplitPane, "paintChildren", [g]);
282 var ui = this.getUI ();
284 var tempG = g.createSwingJS ();
285 ui.finishedPaintingChildren (this, tempG);
287 }}, "java.awt.Graphics");
288 Clazz.defineMethod (c$, "setUIProperty",
289 function (propertyName, value) {
290 if (propertyName === "dividerSize") {
291 if (!this.dividerSizeSet) {
292 this.setDividerSize ((value).intValue ());
293 this.dividerSizeSet = false;
294 }} else if (propertyName === "oneTouchExpandable") {
295 if (!this.oneTouchExpandableSet) {
296 this.setOneTouchExpandable ((value).booleanValue ());
297 this.oneTouchExpandableSet = false;
299 Clazz.superCall (this, javax.swing.JSplitPane, "setUIProperty", [propertyName, value]);
301 Clazz.defineMethod (c$, "paramString",
303 var orientationString = (this.orientation == 1 ? "HORIZONTAL_SPLIT" : "VERTICAL_SPLIT");
304 var continuousLayoutString = (this.continuousLayout ? "true" : "false");
305 var oneTouchExpandableString = (this.oneTouchExpandable ? "true" : "false");
306 return Clazz.superCall (this, javax.swing.JSplitPane, "paramString", []) + ",continuousLayout=" + continuousLayoutString + ",dividerSize=" + this.dividerSize + ",lastDividerLocation=" + this.lastDividerLocation + ",oneTouchExpandable=" + oneTouchExpandableString + ",orientation=" + orientationString;
308 Clazz.defineStatics (c$,
309 "$uiClassID", "SplitPaneUI",
311 "HORIZONTAL_SPLIT", 1,
316 "DIVIDER", "divider",
317 "ORIENTATION_PROPERTY", "orientation",
318 "CONTINUOUS_LAYOUT_PROPERTY", "continuousLayout",
319 "DIVIDER_SIZE_PROPERTY", "dividerSize",
320 "ONE_TOUCH_EXPANDABLE_PROPERTY", "oneTouchExpandable",
321 "LAST_DIVIDER_LOCATION_PROPERTY", "lastDividerLocation",
322 "DIVIDER_LOCATION_PROPERTY", "dividerLocation",
323 "RESIZE_WEIGHT_PROPERTY", "resizeWeight");