Changeset 5558
- Timestamp:
- 09/30/08 11:13:49 (3 months ago)
- Location:
- trunk/src/com/itmill/toolkit
- Files:
-
- 5 modified
-
terminal/gwt/server/CommunicationManager.java (modified) (1 diff)
-
ui/AbstractField.java (modified) (2 diffs)
-
ui/Component.java (modified) (1 diff)
-
ui/Upload.java (modified) (3 diffs)
-
ui/Window.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
r5528 r5558 480 480 } 481 481 482 // add meta instruction for client to set focus if it is set483 final Paintable f = (Paintable) application.consumeFocus();484 if (f != null) {485 if (metaOpen) {486 outWriter.write(",");487 }488 outWriter.write("\"focus\":\"" + getPaintableId(f) + "\"");489 }490 491 482 outWriter.print("}, \"resources\" : {"); 492 483 -
trunk/src/com/itmill/toolkit/ui/AbstractField.java
r5490 r5558 926 926 } 927 927 928 /** 929 * Asks the terminal to place the cursor to this field. 928 /* 929 * (non-Javadoc) 930 * 931 * @see com.itmill.toolkit.ui.Component.Focusable#focus() 930 932 */ 931 933 public void focus() { 932 934 final Application app = getApplication(); 933 935 if (app != null) { 934 app.setFocusedComponent(this); 936 getWindow().setFocusedComponent(this); 937 delayedFocus = false; 935 938 } else { 936 939 delayedFocus = true; … … 1014 1017 super.attach(); 1015 1018 if (delayedFocus) { 1016 1017 delayedFocus = false;1018 1019 focus(); 1019 1020 } -
trunk/src/com/itmill/toolkit/ui/Component.java
r5513 r5558 402 402 * Interface implemented by components which can obtain input focus. 403 403 */ 404 public interface Focusable {404 public interface Focusable extends Component { 405 405 406 406 /** -
trunk/src/com/itmill/toolkit/ui/Upload.java
r5281 r5558 846 846 } 847 847 848 /* *849 * Sets the focus to this component.848 /* 849 * (non-Javadoc) 850 850 * 851 851 * @see com.itmill.toolkit.ui.Component.Focusable#focus() … … 854 854 final Application app = getApplication(); 855 855 if (app != null) { 856 app.setFocusedComponent(this); 856 getWindow().setFocusedComponent(this); 857 delayedFocus = false; 857 858 } else { 858 859 delayedFocus = true; … … 999 1000 super.attach(); 1000 1001 if (delayedFocus) { 1001 delayedFocus = false;1002 1002 focus(); 1003 1003 } -
trunk/src/com/itmill/toolkit/ui/Window.java
r5552 r5558 112 112 113 113 private boolean centerRequested = false; 114 115 private Focusable pendingFocus; 114 116 115 117 /* ********************************************************************* */ … … 541 543 } 542 544 545 if (pendingFocus != null) { 546 // ensure focused component is still attached to this main window 547 if (pendingFocus.getWindow() == this 548 || (pendingFocus.getWindow() != null && pendingFocus 549 .getWindow().getParent() == this)) { 550 target.paintReference(pendingFocus, "focused"); 551 } 552 pendingFocus = null; 553 } 554 543 555 } 544 556 … … 1192 1204 notifications.add(notification); 1193 1205 requestRepaint(); 1206 } 1207 1208 /** 1209 * This method is used by Component.Focusable objects to request focus to 1210 * themselves. Focus renders must be handled at window level (instead of 1211 * Component.Focusable) due we want the last focused component to be focused 1212 * in client too. Not the one that is rendered last (the case we'd get if 1213 * implemented in Focusable only). 1214 * 1215 * To focus component from Toolkit application, use Focusable.focus(). See 1216 * {@link Focusable}. 1217 * 1218 * @param focusable 1219 * to be focused on next paint 1220 */ 1221 void setFocusedComponent(Focusable focusable) { 1222 if (getParent() != null) { 1223 // focus is handled by main windows 1224 ((Window) getParent()).setFocusedComponent(focusable); 1225 } else { 1226 pendingFocus = focusable; 1227 requestRepaint(); 1228 } 1194 1229 } 1195 1230
