/** * Creates a new info * @param data the data of this info */ public DockLayoutInfo( DockLayout<?> data ){ setData( data ); }
/** * Creates a new info. * @param data the data of this info */ public DockLayoutInfo( XElement data ){ setData( data ); }
/** * Creates a new info. * @param data the data of this info */ public DockLayoutInfo( byte[] data ){ setData( data ); }
/** * Creates a new info. * @param data the data of this info */ public DockLayoutInfo( byte[] data ){ setData( data ); }
/** * Creates a new info * @param data the data of this info */ public DockLayoutInfo( DockLayout<?> data ){ setData( data ); }
/** * Creates a new info. */ public DockLayoutInfo(){ setData( null ); }
/** * Creates a new info. */ public DockLayoutInfo(){ setData( null ); }
/** * Creates a new info. * @param data the data of this info */ public DockLayoutInfo( XElement data ){ setData( data ); }
/** * Creates a new layout. * @param id the unique identifier of the described {@link CommonDockStation}, might be <code>null</code> * @param root whether the {@link CStation} is a root station * @param factoryId the unique identifier of the {@link DockFactory} that is used to read or write the actual * layout * @param layout the layout that was loaded by the factory <code>factoryId</code> */ public CommonDockStationLayout( String id, boolean root, String factoryId, DockLayout<?> layout ){ if( factoryId == null ){ throw new IllegalArgumentException( "factoryId must not be null" ); } this.id = id; this.root = root; this.factoryId = factoryId; if( layout != null ){ this.layout.setData( layout ); } }
/** * Creates a new layout. * @param id the unique identifier of the described {@link CommonDockStation}, might be <code>null</code> * @param root whether the {@link CStation} is a root station * @param factoryId the unique identifier of the {@link DockFactory} that is used to read or write the actual * layout * @param layout the layout that might be loaded by the factory <code>factoryId</code> */ public CommonDockStationLayout( String id, boolean root, String factoryId, byte[] layout ){ if( factoryId == null ){ throw new IllegalArgumentException( "factoryId must not be null" ); } this.id = id; this.root = root; this.factoryId = factoryId; if( layout != null ){ this.layout.setData( layout ); } }
/** * Creates a new layout. * @param id the unique identifier of the described {@link CommonDockStation}, might be <code>null</code> * @param root whether the {@link CStation} is a root station * @param factoryId the unique identifier of the {@link DockFactory} that is used to read or write the actual * layout * @param layout the layout that might be loaded by the factory <code>factoryId</code> */ public CommonDockStationLayout( String id, boolean root, String factoryId, XElement layout ){ if( factoryId == null ){ throw new IllegalArgumentException( "factoryId must not be null" ); } this.id = id; this.root = root; this.factoryId = factoryId; if( layout != null ){ this.layout.setData( layout ); } }
/** * Creates a new layout. * @param id the unique identifier of the described {@link CommonDockStation}, might be <code>null</code> * @param root whether the {@link CStation} is a root station * @param factoryId the unique identifier of the {@link DockFactory} that is used to read or write the actual * layout * @param layout the layout that might be loaded by the factory <code>factoryId</code> */ public CommonDockStationLayout( String id, boolean root, String factoryId, XElement layout ){ if( factoryId == null ){ throw new IllegalArgumentException( "factoryId must not be null" ); } this.id = id; this.root = root; this.factoryId = factoryId; if( layout != null ){ this.layout.setData( layout ); } }
/** * Creates a new layout. * @param id the unique identifier of the described {@link CommonDockStation}, might be <code>null</code> * @param root whether the {@link CStation} is a root station * @param factoryId the unique identifier of the {@link DockFactory} that is used to read or write the actual * layout * @param layout the layout that was loaded by the factory <code>factoryId</code> */ public CommonDockStationLayout( String id, boolean root, String factoryId, DockLayout<?> layout ){ if( factoryId == null ){ throw new IllegalArgumentException( "factoryId must not be null" ); } this.id = id; this.root = root; this.factoryId = factoryId; if( layout != null ){ this.layout.setData( layout ); } }
/** * Creates a new layout. * @param id the unique identifier of the described {@link CommonDockStation}, might be <code>null</code> * @param root whether the {@link CStation} is a root station * @param factoryId the unique identifier of the {@link DockFactory} that is used to read or write the actual * layout * @param layout the layout that might be loaded by the factory <code>factoryId</code> */ public CommonDockStationLayout( String id, boolean root, String factoryId, byte[] layout ){ if( factoryId == null ){ throw new IllegalArgumentException( "factoryId must not be null" ); } this.id = id; this.root = root; this.factoryId = factoryId; if( layout != null ){ this.layout.setData( layout ); } }
/** * Updates the contents of the internal {@link DockLayoutInfo} using <code>factory</code> to read * a byte array or an {@link XElement}. * @param factory the factory used to read the layout * @param placeholders the placeholders that may be used */ public void updateLayout( DockFactory<?, ?, Object> factory, PlaceholderStrategy placeholders ){ try{ Object data = null; switch( layout.getKind() ){ case BYTE: data = factory.read( new DataInputStream( new ByteArrayInputStream( layout.getDataByte() ) ), placeholders ); break; case XML: data = factory.read( layout.getDataXML(), placeholders ); break; } if( data != null ){ layout.setData( new DockLayout<Object>( factory.getID(), data ) ); } } catch( IOException e ){ // since a ByteArrayInputStream never throws an IOException this should never happen throw new IllegalStateException( e ); } }
/** * Updates the contents of the internal {@link DockLayoutInfo} using <code>factory</code> to read * a byte array or an {@link XElement}. * @param factory the factory used to read the layout * @param placeholders the placeholders that may be used */ public void updateLayout( DockFactory<?, ?, Object> factory, PlaceholderStrategy placeholders ){ try{ Object data = null; switch( layout.getKind() ){ case BYTE: data = factory.read( new DataInputStream( new ByteArrayInputStream( layout.getDataByte() ) ), placeholders ); break; case XML: data = factory.read( layout.getDataXML(), placeholders ); break; } if( data != null ){ layout.setData( new DockLayout<Object>( factory.getID(), data ) ); } } catch( IOException e ){ // since a ByteArrayInputStream never throws an IOException this should never happen throw new IllegalStateException( e ); } }