Search in sources :

Example 1 with SwingRuntimeWindow

use of com.servoy.j2db.smart.SwingRuntimeWindow in project servoy-client by Servoy.

the class DataTextEditor method prepareForTextToolbarHandling.

private void prepareForTextToolbarHandling() {
    addFocusListener(new FocusListener() {

        public void focusLost(FocusEvent e) {
            setTextToolBarComponent(null);
        }

        public void focusGained(FocusEvent e) {
            if (eventExecutor.getValidationEnabled()) {
                setTextToolBarComponent(enclosedComponent);
            }
        // else find mode...
        }
    });
    addHierarchyListener(new HierarchyListener() {

        public void hierarchyChanged(HierarchyEvent e) {
            if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) == HierarchyEvent.PARENT_CHANGED) {
                // get the new text toolbar to be used
                Container parent = getParent();
                while (parent != null && !(parent instanceof MainPanel)) {
                    parent = parent.getParent();
                }
                if (parent instanceof MainPanel) {
                    parentWindow = (SwingRuntimeWindow) application.getRuntimeWindowManager().getWindow(((MainPanel) parent).getContainerName());
                } else {
                    parentWindow = null;
                }
            }
        }
    });
}
Also used : Container(java.awt.Container) MainPanel(com.servoy.j2db.smart.MainPanel) HierarchyEvent(java.awt.event.HierarchyEvent) SwingRuntimeWindow(com.servoy.j2db.smart.SwingRuntimeWindow) FocusListener(java.awt.event.FocusListener) FocusEvent(java.awt.event.FocusEvent) HierarchyListener(java.awt.event.HierarchyListener)

Aggregations

MainPanel (com.servoy.j2db.smart.MainPanel)1 SwingRuntimeWindow (com.servoy.j2db.smart.SwingRuntimeWindow)1 Container (java.awt.Container)1 FocusEvent (java.awt.event.FocusEvent)1 FocusListener (java.awt.event.FocusListener)1 HierarchyEvent (java.awt.event.HierarchyEvent)1 HierarchyListener (java.awt.event.HierarchyListener)1