@Override protected void rename( Dockable dock, String text ){ ((DefaultDockable)dock).setTitleText( text ); } }
public DefaultDockable layout( Object layout, PlaceholderStrategy placeholders ) { return new DefaultDockable(); }
protected TraverseResult shouldTraverse( Component component ) { if( component == getContentPane() ){ return TraverseResult.EXCLUDE_CHILDREN; } else{ return TraverseResult.INCLUDE_CHILDREN; } } };
/** * Constructs a new DefaultDockable, sets the icon and the title, and * places a component. * @param component the only child of the content pane * @param title the title, to be shown at various places * @param icon the icon, to be shown at various places * @param handling how to understand the <code>icon</code> parameter */ public DefaultDockable( Component component, String title, Icon icon, IconHandling handling ){ super( PropertyKey.DOCKABLE_TITLE, PropertyKey.DOCKABLE_TOOLTIP ); pane.setFocusable( false ); pane.setFocusTraversalPolicyProvider( true ); pane.setFocusTraversalPolicy( new LayoutFocusTraversalPolicy() ); pane.setBackground( background ); if( component != null ){ clientComponent = new WeakReference<Component>( component ); getContentPane().setLayout( new GridLayout( 1, 1 )); getContentPane().add( component ); } setTitleIconHandling( handling ); setTitleIcon( icon ); setTitleText( title ); }
@Override public void requestDockTitle( DockTitleRequest request ){ if( dockable.isTitleShown() ){ super.requestDockTitle( request ); } else{ DockTitleVersion version = request.getVersion(); boolean hide = version.getID().equals( SplitDockStation.TITLE_ID ) || version.getID().equals( StackDockStation.TITLE_ID ) || version.getID().equals( ScreenDockStation.TITLE_ID ) || version.getID().equals( FlapDockStation.WINDOW_TITLE_ID ); if( hide ){ request.answer( null ); } else{ super.requestDockTitle( request ); } } }
@Override public void requestDockTitle( DockTitleRequest request ){ if( dockable.isTitleShown() ){ super.requestDockTitle( request ); } else{ DockTitleVersion version = request.getVersion(); boolean hide = version.getID().equals( SplitDockStation.TITLE_ID ) || version.getID().equals( StackDockStation.TITLE_ID ) || version.getID().equals( ScreenDockStation.TITLE_ID ) || version.getID().equals( FlapDockStation.WINDOW_TITLE_ID ); if( hide ){ request.answer( null ); } else{ super.requestDockTitle( request ); } } }
@Override protected void rename( Dockable dock, String text ){ ((DefaultDockable)dock).setTitleText( text ); } }
/** * Gets the number of {@link Component}s on this dockable, this is equivalent of calling * <code>getContentPane().getComponentCount()</code>. * @return the number of components * @see #getContentPane() * @see Container#getComponentCount() */ public int getComponentCount(){ return getContentPane().getComponentCount(); }
public DefaultDockable layout( Object layout, Map<Integer, Dockable> children, PlaceholderStrategy placeholders ) { return new DefaultDockable(); }
/** * Adds <code>component</code> to the content pane. * @param component the new child */ public void add( Component component ){ getContentPane().add( component ); }
/** * Gets the index'th child of this {@link Dockable}, this is equivalent of calling * <code>getContentPane().getComponent( index )</code>. * @param index the index of the child * @return the component * @see #getContentPane() * @see Container#getComponent(int) */ public Component getComponent( int index ){ return getContentPane().getComponent( index ); }
/** * Removes <code>component</code> from the content pane. * @param component the child to remove */ public void remove( Component component ){ getContentPane().remove( component ); }
/** * Adds <code>component</code> to the content pane. * @param component the new child * @param constraints information for th {@link LayoutManager} */ public void add( Component component, Object constraints ){ getContentPane().add( component, constraints ); }
/** * Sets the layout of the content pane. The layout is normally a * {@link FlowLayout}, except the constructor has added a component to the * layout. In that case, the layout is a {@link GridLayout}. * @param layout the new layout of the content pane */ public void setLayout( LayoutManager layout ){ getContentPane().setLayout( layout ); }
/** * Gets the {@link Component} which was given to this {@link DefaultDockable} through the constructor. If the client * ever removes and the client component from the {@link #getContentPane() content-pane}, and then adds the component * again, then the result of this method gets unspecified.<br> * Please note: the implementation of how the client component is stored does not prevent the garbage collector from * deleting the client component. * @return the component that was given to this dockable through the constructor or <code>null</code> if that component * was removed from the {@link #getContentPane() content-pane} */ public Component getClientComponent(){ if( clientComponent == null ){ return null; } Component child = clientComponent.get(); if( child == null ){ clientComponent = null; return null; } if( child.getParent() != getContentPane() ){ clientComponent = null; return null; } return child; }