/** * Sets the {@link Dockable} which should have the focus. This is identical of calling * {@link #setFocusedDockable(FocusRequest)} with a new {@link DefaultFocusRequest}. * @param focusedDockable the element with the focus or <code>null</code> * @param force <code>true</code> if this controller must ensure * that all properties are correct, <code>false</code> if some * optimizations are allowed. Clients normally can set this argument * to <code>false</code>. */ public void setFocusedDockable( Dockable focusedDockable, boolean force ) { setFocusedDockable( new DefaultFocusRequest( focusedDockable, force ) ); }
public FocusVeto setFocusedDockable( DockElementRepresentative source, Component component, boolean force, boolean ensureFocusSet, boolean ensureDockableFocused ){ DefaultFocusRequest request = new DefaultFocusRequest( source, component, force, ensureFocusSet, ensureDockableFocused ); focus( request ); return request.getVeto(); }
@Override public void dockableUnregistered( DockController controller, Dockable dockable ){ if( dockable == controller.getFocusedDockable() ) controller.setFocusedDockable( new DefaultFocusRequest( null, null, false )); }
/** * Close the currently open popup window and changes the focused * {@link Dockable} to <code>dockable</code>. * @param dockable the element that will own the focus */ public void stop( Dockable dockable ){ close(); controller.setFocusedDockable( new DefaultFocusRequest( dockable, null, false )); }
@Override public void dockableUnregistered( DockController controller, Dockable dockable ){ if( dockable == controller.getFocusedDockable() ) controller.setFocusedDockable( new DefaultFocusRequest( null, null, false )); }
public FocusVeto setFocusedDockable( DockElementRepresentative source, Component component, boolean force, boolean ensureFocusSet, boolean ensureDockableFocused ){ DefaultFocusRequest request = new DefaultFocusRequest( source, component, force, ensureFocusSet, ensureDockableFocused ); focus( request ); return request.getVeto(); }
/** * Close the currently open popup window and changes the focused * {@link Dockable} to <code>dockable</code>. * @param dockable the element that will own the focus */ public void stop( Dockable dockable ){ close(); controller.setFocusedDockable( new DefaultFocusRequest( dockable, null, false )); }
/** * Sets the {@link Dockable} which should have the focus. * @param focusedDockable the element with the focus or <code>null</code> * @param component the {@link Component} which should receive the focus, can be <code>null</code>. * See {@link FocusController#setFocusedDockable(DockElementRepresentative, Component, boolean, boolean, boolean)}. * @param force <code>true</code> if this controller must ensure * that all properties are correct, <code>false</code> if some * optimizations are allowed. Clients normally can set this argument * to <code>false</code>. * @deprecated clients should use {@link #setFocusedDockable(FocusRequest)} instead */ @Deprecated @Todo( compatibility=Compatibility.BREAK_MAJOR, description="remove this method", priority=Todo.Priority.ENHANCEMENT, target=Version.VERSION_1_1_3) public void setFocusedDockable( Dockable focusedDockable, Component component, boolean force ) { setFocusedDockable( new DefaultFocusRequest( focusedDockable, component, force ) ); }
/** * Sets the {@link Dockable} which should have the focus. * @param focusedDockable the element with the focus or <code>null</code> * @param component the {@link Component} which should receive the focus, can be <code>null</code>. * See {@link FocusController#setFocusedDockable(DockElementRepresentative, Component, boolean, boolean, boolean)}. * @param force <code>true</code> if this controller must ensure * that all properties are correct, <code>false</code> if some * optimizations are allowed. Clients normally can set this argument * to <code>false</code>. * @param ensureFocusSet if <code>true</code>, then this method should make sure that either <code>focusedDockable</code> * itself or one of its {@link DockElementRepresentative} is the focus owner * @param ensureDockableFocused if <code>true</code>, then this method should make sure that <code>focusedDockable</code> * is the focus owner. This parameter is stronger that <code>ensureFocusSet</code> * @deprecated clients should use {@link #setFocusedDockable(FocusRequest)} instead */ @Deprecated @Todo( compatibility=Compatibility.BREAK_MAJOR, description="remove this method", priority=Todo.Priority.ENHANCEMENT, target=Version.VERSION_1_1_3) public void setFocusedDockable( Dockable focusedDockable, Component component, boolean force, boolean ensureFocusSet, boolean ensureDockableFocused ) { setFocusedDockable( new DefaultFocusRequest( focusedDockable, component, force, ensureFocusSet, ensureDockableFocused ) ); }
/** * Sets the focused {@link Dockable}. Nothing happens if <code>focusedDockable</code> * is a station and one of its children already has the focus. * @param focusedDockable the element which should have the focus * @param component the {@link Component} which should receive the focus, can be <code>null</code>. * See {@link FocusController#setFocusedDockable(DockElementRepresentative, Component, boolean, boolean, boolean)}. * @see #isOnFocusing() */ public void setAtLeastFocusedDockable( Dockable focusedDockable, Component component ) { Dockable current = getFocusedDockable(); if( current == null ){ setFocusedDockable( new DefaultFocusRequest( focusedDockable, component, false ) ); } else if( !DockUtilities.isAncestor( focusedDockable, current )){ setFocusedDockable( new DefaultFocusRequest( focusedDockable, component, false ) ); } }
public void setSelectedAndGetFocus() { UIManager.DOCKING_CONTROL.getController() .setFocusedDockable(new DefaultFocusRequest(dockable.intern(), this, false, true, false)); }
@Override public void dockableAdded( DockStation station, Dockable dockable ){ if( !controller.getRelocator().isOnPut() ){ Dockable focusedDockable = controller.getFocusedDockable(); if( dockable == focusedDockable || focusedDockable == null ){ if( dockable.isDockableShowing() ){ controller.setFocusedDockable( new DefaultFocusRequest( dockable, null, true )); } } } }
public void run(){ DockElementRepresentative element = getDockable( component, event ); if( element != null ){ Dockable dock = element.getElement().asDockable(); if( dock != null ){ controller.setFocusedDockable( new DefaultFocusRequest( dock, component, false, ensureFocus, element.shouldTransfersFocus() )); } } } });
public void run(){ DockElementRepresentative element = getDockable( component, event ); if( element != null ){ Dockable dock = element.getElement().asDockable(); if( dock != null ){ controller.setFocusedDockable( new DefaultFocusRequest( dock, component, false, ensureFocus, element.shouldTransfersFocus() )); } } } });
@Override public void dockableAdded( DockStation station, Dockable dockable ){ if( !controller.getRelocator().isOnPut() ){ Dockable focusedDockable = controller.getFocusedDockable(); if( dockable == focusedDockable || focusedDockable == null ){ if( dockable.isDockableShowing() ){ controller.setFocusedDockable( new DefaultFocusRequest( dockable, null, true )); } } } }
/** * Tries to focus this dockable, and then ensures that the {@link Component} <code>focus</code> actually gets the focus.<br> * The behavior of this method is not defined for the case where <code>focus</code> is not a child of <code>this</code>.<br> * There is no guarantee of success, this methods fails silently if the focus cannot be gained. * @param focus a child of this dockable, not <code>null</code> * @see #toFront() */ public void toFront( Component focus ){ if( isVisible() ){ FocusRequest request = new DefaultFocusRequest( intern(), focus, true, true, true, true ); control.getOwner().intern().getController().setFocusedDockable( request ); } }
/** * Tries to focus this dockable. In order to gain focus this dockable must at least be visible, additional * restrictions exist, like gaining focus takes some time during which no other dockable must ask for the * focus. This method is best used to highlight existing dockables, but not while building * a new layout (look at methods like {@link CGrid#select(double, double, double, double, CDockable) CGrid.select} * to select a dockable in a stack while building a layout).<br> * There is no guarantee of success, this methods fails silently if the focus cannot be gained. */ public void toFront(){ if( isVisible() ){ FocusRequest request = new DefaultFocusRequest( intern(), null, false, true, false, true ); control.getOwner().intern().getController().setFocusedDockable( request ); } }
/** * Tries to focus this dockable. In order to gain focus this dockable must at least be visible, additional * restrictions exist, like gaining focus takes some time during which no other dockable must ask for the * focus. This method is best used to highlight existing dockables, but not while building * a new layout (look at methods like {@link CGrid#select(double, double, double, double, CDockable) CGrid.select} * to select a dockable in a stack while building a layout).<br> * There is no guarantee of success, this methods fails silently if the focus cannot be gained. */ public void toFront(){ if( isVisible() ){ FocusRequest request = new DefaultFocusRequest( intern(), null, false, true, false, true ); control.getOwner().intern().getController().setFocusedDockable( request ); } }
public void selectionChanged( StackDockComponent stack ){ if( !ignoreSelectionChanges ){ DockController controller = getController(); if( controller != null && !updatingTheme ){ Dockable selection = getFrontDockable(); if( selection != null && !controller.getRelocator().isOnPut() ){ controller.setFocusedDockable( new DefaultFocusRequest( selection, null, false )); } fireDockableSelected(); } visibility.fire(); } }
@Override public void mouseReleased( MouseEvent e ){ if( dockable.getDockParent() == FlapDockStation.this ){ final int MASK = InputEvent.BUTTON1_DOWN_MASK | InputEvent.BUTTON2_DOWN_MASK | InputEvent.BUTTON3_DOWN_MASK; DisablingStrategy strategy = disablingStrategy.getValue(); boolean enabled = strategy == null || (!strategy.isDisabled( dockable ) && !strategy.isDisabled( FlapDockStation.this )); if( enabled && e.getButton() == MouseEvent.BUTTON1 && (e.getModifiersEx() & MASK ) == 0 ){ int index = indexOf( dockable ); if( index < 0 ) return; DockableHandle handle = handles.dockables().get( index ); DockTitle title = handle.getTitle(); if( getFrontDockable() == dockable && title.isActive() ){ getController().setFocusedDockable( new DefaultFocusRequest( FlapDockStation.this, null, true )); setFrontDockable( null ); } else getController().setFocusedDockable( new DefaultFocusRequest( dockable, null, true )); } } } }