private boolean contains( Path[] placeholders ){ for( Path path : placeholders ){ if( path.equals( placeholder )){ return true; } } return false; } });
private boolean contains( Path[] placeholders ){ for( Path path : placeholders ){ if( path.equals( placeholder )){ return true; } } return false; } });
public boolean contains( Path placeholder ){ for( Path item : placeholders ){ if( item.equals( placeholder )){ return true; } } return false; }
/** * Gets the index of <code>path</code>. * @param path the path of some model * @return the index or -1 if not found */ public int indexOf( Path path ){ int i = 0; for( Model check : models ){ if( check.path.equals( path ) ) return i; i++; } return -1; }
@Override public boolean equals( Object obj ){ if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ExtendedMode other = (ExtendedMode) obj; if (modeIdentifier == null) { if (other.modeIdentifier != null) return false; } else if (!modeIdentifier.equals( other.modeIdentifier )) return false; return true; } }
/** * Tells whether <code>placeholders</code> has the right format for this perspective to read it. * @param placeholders the map whose format needs checking * @return <code>true</code> if a call to {@link #setPlaceholders(PlaceholderMap)} will not result in an exception */ public boolean canRead( PlaceholderMap placeholders ){ return PlaceholderList.PLACEHOLDER_MAP_FORMAT.equals( placeholders.getFormat() ); }
private ModeHandle getAccess( Path path ){ for( ModeHandle mode : modes ){ if( mode.mode.getUniqueIdentifier().equals( path )) return mode; } return null; }
private ModeHandle getAccess( Path path ){ for( ModeHandle mode : modes ){ if( mode.mode.getUniqueIdentifier().equals( path )) return mode; } return null; }
/** * Gets the {@link ExtendedMode} whose identifier is equal to * <code>identifier</code>. * @param identifier some identifier of a mode * @return the mode or <code>null</code> if not found */ public ExtendedMode getMode( Path identifier ){ for( ExtendedMode mode : modes.keySet() ){ if( mode.getModeIdentifier().equals( identifier )){ return mode; } } return null; }
/** * Gets the {@link ExtendedMode} whose identifier is equal to * <code>identifier</code>. * @param identifier some identifier of a mode * @return the mode or <code>null</code> if not found */ public ExtendedMode getMode( Path identifier ){ for( ExtendedMode mode : modes.keySet() ){ if( mode.getModeIdentifier().equals( identifier )){ return mode; } } return null; }
public void setLayout( DockElement element, Path layout, Map<Integer, Dockable> children, PlaceholderStrategy placeholders ){ if( !(element instanceof CommonDockStation<?, ?>)){ throw new IllegalArgumentException( "expected the 'element' to be a '" + CommonDockStation.class.getSimpleName() + "', but instead it was a '" + element.getClass().getName() + "'.\n" + "The reason for this exception may be be:\n - a DockElement that was registered with the wrong unique identifier\n - the type of a DockElement was changed\n - a SingleCDockableFactory creating the wrong type of items.\n"+ "Type and toString of 'element': " + element.getClass().getName() + ",\n" + element); } CStation<?> station = ((CommonDockStation<?, ?>)element).getStation(); Path typeId = station.getTypeId(); if( typeId != null && !typeId.equals( layout )){ throw new IllegalArgumentException( "expected the 'element' to have type id '" + layout + "', but instead it was '" + typeId + "'.\n" + "The reason for this exception may be be:\n - a DockElement that was registered with the wrong unique identifier\n - the type of a DockElement was changed\n - a SingleCDockableFactory creating the wrong type of items.\n"+ "Type and toString of 'element': " + station.getClass().getName() + ",\n" + station); } }
public void setLayout( DockElement element, Path layout, Map<Integer, Dockable> children, PlaceholderStrategy placeholders ){ if( !(element instanceof CommonDockStation<?, ?>)){ throw new IllegalArgumentException( "expected the 'element' to be a '" + CommonDockStation.class.getSimpleName() + "', but instead it was a '" + element.getClass().getName() + "'.\n" + "The reason for this exception may be be:\n - a DockElement that was registered with the wrong unique identifier\n - the type of a DockElement was changed\n - a SingleCDockableFactory creating the wrong type of items.\n"+ "Type and toString of 'element': " + element.getClass().getName() + ",\n" + element); } CStation<?> station = ((CommonDockStation<?, ?>)element).getStation(); Path typeId = station.getTypeId(); if( typeId != null && !typeId.equals( layout )){ throw new IllegalArgumentException( "expected the 'element' to have type id '" + layout + "', but instead it was '" + typeId + "'.\n" + "The reason for this exception may be be:\n - a DockElement that was registered with the wrong unique identifier\n - the type of a DockElement was changed\n - a SingleCDockableFactory creating the wrong type of items.\n"+ "Type and toString of 'element': " + station.getClass().getName() + ",\n" + station); } }
/** * Sets the <code>location</code> that is to be used for <code>mode</code>. * @param mode the mode of the location * @param location the location to store */ public void add( ExtendedMode mode, Location location ){ if( !mode.getModeIdentifier().equals( location.getMode() )){ throw new IllegalArgumentException( "mode and location do not fit together" ); } locations.put( mode, location ); order.remove( mode ); order.add( mode ); }
/** * Sets the <code>location</code> that is to be used for <code>mode</code>. * @param mode the mode of the location * @param location the location to store */ public void add( ExtendedMode mode, Location location ){ if( !mode.getModeIdentifier().equals( location.getMode() )){ throw new IllegalArgumentException( "mode and location do not fit together" ); } locations.put( mode, location ); order.remove( mode ); order.add( mode ); }
/** * Sets the <code>location</code> that is to be used for <code>mode</code>. * @param index the location of the mode, where 0 represents the oldest entry * @param mode the mode of the location * @param location the location to store */ public void insert( int index, ExtendedMode mode, Location location ){ if( !mode.getModeIdentifier().equals( location.getMode() )){ throw new IllegalArgumentException( "mode and location do not fit together" ); } locations.put( mode, location ); int old = order.indexOf( mode ); if( old > 0 ){ if( old < index ){ index--; } order.remove( old ); } order.add( index, mode ); }
/** * Removes <code>mode</code> from this manager. Note that history information * about the mode remains. * @param mode the mode to remove */ public void removeMode( M mode ){ if( mode == null ) throw new IllegalArgumentException( "mode must not be null" ); for( ModeHandle handle : modes ){ if( handle.mode.getUniqueIdentifier().equals( mode.getUniqueIdentifier() )){ handle.mode = null; fireRemoved( handle.mode ); modes.remove( handle ); return; } } }
/** * Removes <code>mode</code> from this manager. Note that history information * about the mode remains. * @param mode the mode to remove */ public void removeMode( M mode ){ if( mode == null ) throw new IllegalArgumentException( "mode must not be null" ); for( ModeHandle handle : modes ){ if( handle.mode.getUniqueIdentifier().equals( mode.getUniqueIdentifier() )){ handle.mode = null; fireRemoved( handle.mode ); modes.remove( handle ); return; } } }
@Override public void setPlaceholders( ToolbarContainerDockStation station, PlaceholderMap map ){ if( !map.getFormat().equals( new Path( "dock.ToolbarContainerStation" ) ) ) { throw new IllegalArgumentException( "unknown format: " + map.getFormat() ); } if( map.getVersion() != 0 ) { throw new IllegalArgumentException( "unknown version: " + map.getVersion() ); } station.setPlaceholders( map.getMap( map.newKey( "content" ), "list" ) ); }
public Runnable onApply( final LocationModeEvent event, final Dockable replacement ){ if( event.isDone() ) return null; if( !event.getMode().getUniqueIdentifier().equals( normalModeIdentifier() )){ maximizedMode.unmaximize( getStation().getFullScreen(), event.getAffected() ); return new Runnable() { public void run(){ if( replacement != null && replacement.getDockParent() != null ){ maximizedMode.maximize( Maximal.this, replacement, event.getAffected() ); } } }; } return null; }
public Runnable onApply( final LocationModeEvent event, final Dockable replacement ){ if( event.isDone() ) return null; if( !event.getMode().getUniqueIdentifier().equals( normalModeIdentifier() )){ maximizedMode.unmaximize( getStation().getFullScreen(), event.getAffected() ); return new Runnable() { public void run(){ if( replacement != null && replacement.getDockParent() != null ){ maximizedMode.maximize( Maximal.this, replacement, event.getAffected() ); } } }; } return null; }