1124.diff
src/com/goldencode/p2j/ui/MenuWidget.java 2015-11-23 07:48:49 +0000 | ||
---|---|---|
14 | 14 |
** added initialization code. |
15 | 15 |
** 003 VIG 20150501 Implemented CommonHandleTree interface. |
16 | 16 |
** 004 VIG 20150823 Fixed firstChild and lastChild methods. |
17 |
** 005 VIG 20151123 Added setVisible methods showing the "not setable" error. |
|
17 | 18 |
*/ |
18 | 19 | |
19 | 20 |
package com.goldencode.p2j.ui; |
... | ... | |
130 | 131 |
} |
131 | 132 |
|
132 | 133 |
/** |
134 |
* Set the VISIBLE writable attribute. |
|
135 |
* |
|
136 |
* @param visible |
|
137 |
* The new value for the VISIBLE attribute. |
|
138 |
*/ |
|
139 |
@Override |
|
140 |
public void setVisible(logical visible) |
|
141 |
{ |
|
142 |
String name = dynamic().getValue() ? "widget" : name().getValue(); |
|
143 |
ErrorManager.recordOrShowError(4052, |
|
144 |
"VISIBLE is not a setable attribute for MENU " + name, false); |
|
145 |
} |
|
146 | ||
147 |
/** |
|
148 |
* Set the VISIBLE writable attribute. |
|
149 |
* |
|
150 |
* @param visible |
|
151 |
* The new value for the VISIBLE attribute. |
|
152 |
*/ |
|
153 |
@Override |
|
154 |
public void setVisible(boolean visible) |
|
155 |
{ |
|
156 |
String name = dynamic().getValue() ? "widget" : name().getValue(); |
|
157 |
ErrorManager.recordOrShowError(4052, |
|
158 |
"VISIBLE is not a setable attribute for MENU " + name, false); |
|
159 |
} |
|
160 | ||
161 |
/** |
|
133 | 162 |
* Finds menu-item in this menu tree. It can appear on different levels. |
134 | 163 |
* Menu-item is searched using some sort of depth-first algorithm. |
135 | 164 |
* See {@link #findMenuItemInt(String)} |
src/com/goldencode/p2j/ui/chui/ThinClient.java 2015-11-24 16:29:34 +0000 | ||
---|---|---|
2184 | 2184 |
** marked as HIDDEN, do not show the window. |
2185 | 2185 |
** More fixes related to working with HIDDEN frame/widgets and resolving |
2186 | 2186 |
** the window when nested frames are viewed directly. |
2187 |
** VIG 20151118 Fixed MENUBAR repaint for dynamic case. |
|
2187 | 2188 |
*/ |
2188 | 2189 | |
2189 | 2190 |
package com.goldencode.p2j.ui.chui; |
... | ... | |
10661 | 10662 |
} |
10662 | 10663 | |
10663 | 10664 |
wnd.getMenubar().setVisible(true); |
10665 |
wnd.doLayout(); |
|
10664 | 10666 |
|
10665 | 10667 |
eventDrawingBracket(wnd, new Runnable() |
10666 | 10668 |
{ |
10667 | 10669 |
@Override |
10668 | 10670 |
public void run() |
10669 | 10671 |
{ |
10670 |
wnd.getMenubar().repaint();
|
|
10672 |
wnd.repaint(); |
|
10671 | 10673 |
} |
10672 | 10674 |
}); |
10673 | 10675 |
} |
src/com/goldencode/p2j/ui/client/Menu.java 2015-11-24 16:32:57 +0000 | ||
---|---|---|
16 | 16 |
** 004 VIG 20150618 Moved setVisible method from ChUI implementation. |
17 | 17 |
** 005 VIG 20150905 Fixed event processing. |
18 | 18 |
** 006 VIG 20151027 Changed isMenubarElement to return false instead of throwing exception |
19 |
** in cases when specified component is not MenuItem or SubMenu. |
|
19 |
** in cases when specified component is not MenuItem or SubMenu. |
|
20 |
** 007 VIG 20151124 Fixed showPopupMenu and hasFocus. |
|
20 | 21 |
*/ |
21 | 22 | |
22 | 23 |
package com.goldencode.p2j.ui.client; |
... | ... | |
83 | 84 |
@SuppressWarnings({ "unchecked", "rawtypes" }) |
84 | 85 |
public static void showPopupMenu(Menu<?> menu, Widget<?> src) |
85 | 86 |
{ |
87 |
Window wnd = (Window) src.ancestor(); |
|
86 | 88 |
if (menu.parent() == null) |
87 | 89 |
{ |
88 |
((Window) src.ancestor()).getContentPane().add(menu);
|
|
90 |
wnd.getContentPane().add(menu);
|
|
89 | 91 |
} |
90 | 92 | |
91 | 93 |
if (!menu.isVisible()) |
92 | 94 |
{ |
93 | 95 |
menu.setVisible(true); |
94 |
menu.firstFocus(); |
|
95 | 96 |
} |
96 | 97 | |
97 | 98 |
menu.repaint(); |
... | ... | |
270 | 271 |
{ |
271 | 272 |
if (config.popupOnly && config.visible) |
272 | 273 |
{ |
273 |
Widget<?> owner = screen().getRegistry().getComponent(config.ownerId); |
|
274 |
return (owner == null || |
|
275 |
(owner instanceof Container && ((Container<?>)owner).focus() != this)) ? |
|
276 |
false : owner.hasFocus(); |
|
277 |
|
|
274 |
return true; |
|
278 | 275 |
} |
279 | 276 |
|
280 | 277 |
return super.hasFocus(); |
src/com/goldencode/p2j/ui/client/Window.java 2015-11-24 16:34:29 +0000 | ||
---|---|---|
243 | 243 |
** CA 20151106 A fix for HIDDEN attribute: distinguish between HIDE statement and |
244 | 244 |
** setting the HIDDEN attribute to true. |
245 | 245 |
** HC 20151112 Implemented THREE-D runtime support. |
246 |
** VIG 20151123 Fixed afterConfigUpdate: added menu reset case and support of dynamic |
|
247 |
** menu assigning: make menubar visible if window is already visible. |
|
248 |
** Added currentFocus override: if opened pop-up menu exists in the |
|
249 |
** content pane - get current focused widget from it. |
|
246 | 250 |
*/ |
247 | 251 | |
248 | 252 |
package com.goldencode.p2j.ui.client; |
... | ... | |
1080 | 1084 |
} |
1081 | 1085 |
|
1082 | 1086 |
/** |
1087 |
* Get widget which is in focus. If some pop-up menu is opened |
|
1088 |
* than get the current focused widget from it. |
|
1089 |
* |
|
1090 |
* @return focused widget. |
|
1091 |
* |
|
1092 |
* @throws IllegalStateException |
|
1093 |
* If currentPopupMenu is set, but not visible. |
|
1094 |
*/ |
|
1095 |
@Override |
|
1096 |
public Widget<O> currentFocus() |
|
1097 |
{ |
|
1098 |
for(Widget<O> w : getContentPane().widgets()) |
|
1099 |
{ |
|
1100 |
if (w instanceof Menu && ((Menu<O>) w).config().popupOnly && w.isVisible()) |
|
1101 |
{ |
|
1102 |
return ((Menu<O>) w).currentFocus(); |
|
1103 |
} |
|
1104 |
} |
|
1105 |
|
|
1106 |
return super.currentFocus(); |
|
1107 |
} |
|
1108 |
|
|
1109 |
/** |
|
1083 | 1110 |
* A window's "window" is itself. |
1084 | 1111 |
* |
1085 | 1112 |
* @return This window instance. |
... | ... | |
2254 | 2281 |
{ |
2255 | 2282 |
menubar = (Menu<O>) this.screen().getRegistry().getComponent(config.menubarId); |
2256 | 2283 |
|
2257 |
if (menubar != null) |
|
2284 |
if (menubar != null && menubar.parent() == null)
|
|
2258 | 2285 |
{ |
2259 |
if (menubar.parent() == null) |
|
2260 |
{ |
|
2261 |
getContentPane().add(menubar); |
|
2262 |
} |
|
2286 |
getContentPane().add(menubar); |
|
2263 | 2287 |
} |
2264 | 2288 |
|
2265 |
// We must set MENUBAR visible only after check if enabled frames are exist. |
|
2266 |
if (ThinClient.getInstance().isChui()) |
|
2289 |
// We must set MENUBAR visible only after check if enabled frames are exist a start |
|
2290 |
// or if this window already realized to support dynamic MENUBAR assigning in trigger. |
|
2291 |
if (isVisible()) |
|
2267 | 2292 |
{ |
2268 | 2293 |
menubar.setVisible(true); |
2269 | 2294 |
} |
... | ... | |
2273 | 2298 | |
2274 | 2299 |
if (config.menubarId == 0 && beforeUpdate.menubarId != 0) |
2275 | 2300 |
{ |
2301 |
if (menubar != null) |
|
2302 |
{ |
|
2303 |
getContentPane().remove(menubar); |
|
2304 |
} |
|
2305 |
|
|
2276 | 2306 |
menubar = null; |
2277 | 2307 |
|
2278 | 2308 |
layout = true; |
src/com/goldencode/p2j/ui/client/gui/SubMenuGuiImpl.java 2015-11-24 11:42:59 +0000 | ||
---|---|---|
21 | 21 |
** handle processing to modal windows. |
22 | 22 |
** 006 CA 20151026 Enclose driver API calls in select/releaseWindow(). |
23 | 23 |
** VIG 20151027 Added "pressed" state transferring to neighbor MENUBAR element. |
24 |
** Added mouseEntered=false to hideBody(..) and fixed javadoc. |
|
24 | 25 |
*/ |
25 | 26 | |
26 | 27 |
package com.goldencode.p2j.ui.client.gui; |
... | ... | |
592 | 593 |
parent().repaint(); |
593 | 594 | |
594 | 595 |
setSubmenusPressed(false, true); |
596 |
mouseEntered = false; |
|
595 | 597 |
|
596 | 598 |
super.hideBody(recursive); |
597 | 599 |
|
... | ... | |
1137 | 1139 |
* |
1138 | 1140 |
* @param pressed |
1139 | 1141 |
* <code>true</code> means pressed, <code>false</code - means not pressed. |
1142 |
* @param recursive |
|
1143 |
* <code>true</code> denotes recursive processing of nested sub-menus. |
|
1140 | 1144 |
*/ |
1141 | 1145 |
protected void setSubmenusPressed(boolean pressed, boolean recursive) |
1142 | 1146 |
{ |
src/com/goldencode/p2j/ui/client/gui/WindowLayout.java 2015-11-23 08:00:40 +0000 | ||
---|---|---|
45 | 45 |
** 025 HC 20151027 Implemented WINDOW MESSAGE-AREA and STATUS-AREA attributes. |
46 | 46 |
** CA 20151029 If workspace is resized, ensure the new window dimension includes the |
47 | 47 |
** decorations and the border. |
48 |
** 026 VIG 20151122 Added isVisible check for menubar layout. |
|
48 | 49 |
*/ |
49 | 50 | |
50 | 51 |
package com.goldencode.p2j.ui.client.gui; |
... | ... | |
232 | 233 |
if (window instanceof Window) |
233 | 234 |
{ |
234 | 235 |
Menu<?> menubar = ((Window<?>) window).getMenubar(); |
235 |
if (menubar != null) |
|
236 |
if (menubar != null && menubar.isVisible())
|
|
236 | 237 |
{ |
237 | 238 |
menubar.doLayout(); |
238 | 239 |
mbarHeight = c.heightToNative(menubar.height()); |
... | ... | |
301 | 302 |
if (window instanceof WindowGuiImpl) |
302 | 303 |
{ |
303 | 304 |
Menu<GuiOutputManager> menubar = ((WindowGuiImpl)window).getMenubar(); |
304 |
if (menubar != null) |
|
305 |
if (menubar != null && menubar.isVisible())
|
|
305 | 306 |
{ |
306 | 307 |
MenuConfig mc = menubar.config(); |
307 | 308 |
menubar.setPhysicalLocation(x, y); |