Package bibliothek.gui.dock.perspective

Examples of bibliothek.gui.dock.perspective.Perspective


     */
    public void writeXML( XElement root, CPerspective perspective, boolean includeWorkingAreas ){
      perspective.storeLocations();
     
      DockFrontendPerspective frontend = conversion( perspective, includeWorkingAreas );
      Perspective conversion = frontend.getPerspective();
     
      Map<String, DockLayoutComposition> stations = new HashMap<String, DockLayoutComposition>();
      for( String key : perspective.getStationKeys() ){
        CStationPerspective station = perspective.getStation( key );
        if( station.asDockable() == null || station.asDockable().getParent() == null ){
          stations.put( key, conversion.convert( station.intern() ));
        }
      }
     
      conversion.getSituation().writeCompositionsXML( stations, root.addElement( "stations" ) );
     
      // Store the last location of all known elements
      XElement xinvisible = root.addElement( "invisible" );
      PropertyTransformer transformer = frontend.getPropertyTransformer();
      for( String key : perspective.getDockableKeys() ){
        CDockablePerspective dockable = perspective.getDockable( key );
        Location location = getInvisibleLocation( dockable );
       
        if( location != null ){
          XElement xdockable = xinvisible.addElement( "dockable" );
        xdockable.addString( "key", key );
       
          if( dockable.getParent() == null ){
            conversion.getSituation().writeCompositionXML( conversion.convert( dockable.intern() ), xdockable.addElement( "content" ) );
          }
         
          XElement xlocation = xdockable.addElement( "location" );
          xlocation.addString( "root", location.getRoot() );
          xlocation.addString( "mode", dockable.getLocationHistory().getLastMode().getModeIdentifier().toString() );
View Full Code Here


    public void write( DataOutputStream out, CPerspective perspective, boolean includeWorkingAreas ) throws IOException{
      perspective.storeLocations();
      Version.write( out, Version.VERSION_1_1_1a );
     
      DockFrontendPerspective frontend = conversion( perspective, includeWorkingAreas );
      Perspective conversion = frontend.getPerspective();
     
      Map<String, DockLayoutComposition> stations = new HashMap<String, DockLayoutComposition>();
      for( String key : perspective.getStationKeys() ){
        CStationPerspective station = perspective.getStation( key );
        stations.put( key, conversion.convert( station.intern() ));
      }
     
      conversion.getSituation().writeCompositions( stations, out );
     
      // Store the last location of all known elements
      String[] keys = perspective.getDockableKeys();
      out.writeInt( keys.length );
      PropertyTransformer transformer = frontend.getPropertyTransformer();
     
      for( String key : keys ){
        CDockablePerspective dockable = perspective.getDockable( key );
        Location location = getInvisibleLocation( dockable );
       
        if( location != null ){
          out.writeBoolean( true );
          out.writeUTF( key );
         
          if( dockable.getParent() == null ){
            out.writeBoolean( true );
            conversion.getSituation().writeComposition( conversion.convert( dockable.intern() ), out );
          }
          else{
            out.writeBoolean( false );
          }
         
View Full Code Here

    public CPerspective readXML( XElement root, boolean includeWorkingAreas ) throws XException{
      CPerspective perspective = createEmptyPerspective();
     
      PerspectiveElementFactory factory = new PerspectiveElementFactory( perspective );
      DockFrontendPerspective frontend = wrap( perspective, includeWorkingAreas, factory );
      Perspective conversion = frontend.getPerspective();
     
      for( Map.Entry<String, MultipleCDockableFactory<?, ?>> item : control.getRegister().getFactories().entrySet() ){
        conversion.getSituation().add( new CommonMultipleDockableFactory( item.getKey(), item.getValue(), control, perspective ) );
      }
     
      XElement xstations = root.getElement( "stations" );
      if( xstations == null ){
        throw new XException( "missing element 'stations'" );
      }
     
      Map<String, DockLayoutComposition> stations = conversion.getSituation().readCompositionsXML( xstations );
      factory.setStations( stations );
     
      for( DockLayoutComposition composition : stations.values() ){
        PerspectiveElement station = conversion.convert( composition );
        if( station instanceof CommonElementPerspective ){
          CStationPerspective stationPerspective = ((CommonElementPerspective)station).getElement().asStation();
          if( stationPerspective != null ){
            perspective.addStation( stationPerspective );
          }
        }
      }
     
      perspective.storeLocations();
     
      // read the last known location of all elements
      XElement xinvisible = root.getElement( "invisible" );
      if( xinvisible != null ){
        PropertyTransformer transformer = frontend.getPropertyTransformer();
        for( XElement xdockable : xinvisible.getElements( "dockable" )){
          String key = xdockable.getString( "key" );
          CDockablePerspective dockable = perspective.getDockable( key );
          if( dockable == null ){
            XElement xcontent = xdockable.getElement( "content" );
            if( xcontent != null ){
              PerspectiveElement element = conversion.convert( conversion.getSituation().readCompositionXML( xcontent ) );
                if( element instanceof CommonElementPerspective ){
                  dockable = ((CommonElementPerspective)element).getElement().asDockable();
                  if( dockable != null ){
                    perspective.putDockable( dockable );
                  }
View Full Code Here

     
      CPerspective perspective = createEmptyPerspective();
     
      PerspectiveElementFactory factory = new PerspectiveElementFactory( perspective );
      DockFrontendPerspective frontend = wrap( perspective, includeWorkingAreas, factory );
      Perspective conversion = frontend.getPerspective();
     
      for( Map.Entry<String, MultipleCDockableFactory<?, ?>> item : control.getRegister().getFactories().entrySet() ){
        conversion.getSituation().add( new CommonMultipleDockableFactory( item.getKey(), item.getValue(), control, perspective ) );
      }
     
      Map<String, DockLayoutComposition> stations = conversion.getSituation().readCompositions( in );
      factory.setStations( stations );
     
      for( DockLayoutComposition composition : stations.values() ){
        PerspectiveElement station = conversion.convert( composition );
        if( station instanceof CommonElementPerspective ){
          CStationPerspective stationPerspective = ((CommonElementPerspective)station).getElement().asStation();
          if( stationPerspective != null ){
            perspective.addStation( stationPerspective );
          }
        }
      }
     
      if( version111a ){
        perspective.storeLocations();
        PropertyTransformer transformer = frontend.getPropertyTransformer();
        for( int i = 0, n = in.readInt(); i<n; i++ ){
          if( in.readBoolean() ){
            String key = in.readUTF();
            DockLayoutComposition composition = null;
            if( in.readBoolean() ){
               composition = conversion.getSituation().readComposition( in );
            }
           
            CDockablePerspective dockable = perspective.getDockable( key );
            if( dockable == null && composition != null ){
              PerspectiveElement element = conversion.convert( composition );
                if( element instanceof CommonElementPerspective ){
                  dockable = ((CommonElementPerspective)element).getElement().asDockable();
                  if( dockable != null ){
                    perspective.putDockable( dockable );
                  }
View Full Code Here

   
    private CSetting convert( CPerspective perspective, boolean includeWorkingAreas ){
      perspective.storeLocations();
     
      DockFrontendPerspective frontend = conversion( perspective, includeWorkingAreas );
      Perspective conversion = frontend.getPerspective();
      CSetting setting = new CSetting();
     
      // layout
      for( String key : perspective.getStationKeys() ){
        CStationPerspective station = perspective.getStation( key );
        if( station.asDockable() == null || station.asDockable().getParent() == null ){
          setting.putRoot( key, conversion.convert( station.intern() ) );
        }
      }
     
      // invisible items (storing location of visible items as well)
      for( String key : perspective.getDockableKeys() ){
View Full Code Here

    private CPerspective convert( CSetting setting, boolean includeWorkingAreas ){
      CPerspective cperspective = createEmptyPerspective();
     
      PerspectiveElementFactory factory = new PerspectiveElementFactory( cperspective );
      DockFrontendPerspective frontend = wrap( cperspective, includeWorkingAreas, factory );
      Perspective conversion = frontend.getPerspective();
     
      for( Map.Entry<String, MultipleCDockableFactory<?, ?>> item : control.getRegister().getFactories().entrySet() ){
        conversion.getSituation().add( new CommonMultipleDockableFactory( item.getKey(), item.getValue(), control, cperspective ) );
      }
     
      // registered dockables
      Map<String, DockLayoutComposition> stations = new HashMap<String, DockLayoutComposition>();
      for( String root : setting.getRootKeys() ){
        stations.put( root, setting.getRoot( root ) );
      }
     
      factory.setStations( stations );
     
      for( DockLayoutComposition composition : stations.values() ){
        PerspectiveElement station = conversion.convert( composition );
        if( station instanceof CommonElementPerspective ){
          CStationPerspective stationPerspective = ((CommonElementPerspective)station).getElement().asStation();
          if( stationPerspective != null ){
            cperspective.addStation( stationPerspective );
          }
        }
      }
     
      // invisible dockables
      for( int i = 0, n = setting.getInvisibleCount(); i < n; i++ ){
        DockLayoutComposition composition = setting.getInvisibleLayout( i );
        if( composition != null ){
          PerspectiveElement element = conversion.convert( composition );
          if( element instanceof CommonElementPerspective ){
            CDockablePerspective dockable = ((CommonElementPerspective)element).getElement().asDockable();
            if( dockable != null ){
              DockableProperty location = setting.getInvisibleLocation( i );
              String root = setting.getInvisibleRoot( i );
View Full Code Here

      return wrap( perspective, includeWorkingAreas, factory );
    }
   
    private DockFrontendPerspective wrap( CPerspective perspective, boolean includeWorkingAreas, PerspectiveElementFactory factory ){
      DockFrontendPerspective frontend = control.getOwner().intern().getPerspective( !includeWorkingAreas, factory );
      Perspective inner = frontend.getPerspective();
     
      factory.setBasePerspective( inner );
     
      CommonSingleDockableFactory singleDockableFactory = new CommonSingleDockableFactory( control.getOwner(), perspective );
      inner.getSituation().add( singleDockableFactory );
      inner.getSituation().add( new CommonDockStationFactory( control.getOwner(), factory, singleDockableFactory ) );
     
      return frontend;
    }
View Full Code Here

TOP

Related Classes of bibliothek.gui.dock.perspective.Perspective

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.