Пример #1
0
 public void addSavable() {
   if (!dataObject.isModified()) {
     dataObject
         .getLookup()
         .lookup(InstanceContent.class)
         .add(new SceneSavable(lSystem, dataObject));
     //            ic.add(saverr);
     dataObject.setModified(true);
   }
 }
Пример #2
0
  public LayoutScene(LayoutViewElement mve, LayoutDataObject obj) {
    super();

    this.dataObject = obj;

    multiview = mve;
    this.projectPath =
        FileOwnerQuery.getOwner(obj.getPrimaryFile()).getProjectDirectory().getPath();
    this.lSystem = LayoutParser.parse(obj);
    //        addSaveAsCapable();

    LayoutDocument ld = lSystem.getDocument();
    ld.addPropertyChangeListener(new DocumentDPIChangeListener());

    // paper layer
    this.paperWidget = new PaperWidget(this, ld);
    // add paper biar bisa diedit2
    ic.add(ld);
    paperLayer.addChild(paperWidget);

    layerController = LayerFactory.createLayer(this, lSystem.getLayers());
    // init em listener
    ExplorerManager em = layerController.getExplorerManager();
    em.addPropertyChangeListener(new NodeSelectionListener());
    // main layer, where sublayout widgets will be added
    mainLayer = layerController.getRootWidget();
    addChild(mainLayer);

    // selection layer, directly above the main layer
    selectionLayer = new LayerWidget(this);
    selectionWrapperWidget = new SelectionWrapperWidget(this);
    selectionLayer.addChild(selectionWrapperWidget);
    addChild(selectionLayer);

    //        getPriorActions().addAction(new KeySwitchToolAction());
    // scene's actions, applied to all selected widgets
    // key move tool, always available
    getActions().addAction(KEY_MOVE_ACTION);
    // move tool
    createActions(FREE_MOVE_TOOL).addAction(MOVE_ACTION);
    createActions(ON_AXIS_MOVE_TOOL).addAction(ON_AXIS_MOVE_ACTION);
    setActiveTool(FREE_MOVE_TOOL);
    // rotate on outside of selectedwrapper border
    createActions(SelectionWrapperWidget.TRANSFORM_TOOL).addAction(ROTATE_ACTION);
    // mirror selected layer, only on transform mode
    createActions(SelectionWrapperWidget.TRANSFORM_TOOL).addAction(MIRROR_ACTION);
    // show popup under right click to show layers under cursor
    getActions().addAction(SELECT_ACTION);
    getPriorActions().addAction(SCROLL_MODIFIER_ACTION);
    initLookup();

    createView();
  }
Пример #3
0
 private void switchNodeInLookup(boolean includeDataNodeLookup) {
   if (settingLookup) {
     return;
   }
   Lookup[] lookups = lookup.getSubLookups();
   int index = lookups.length - 1;
   boolean dataNodeLookup = (lookups[index] != Lookup.EMPTY);
   if (includeDataNodeLookup != dataNodeLookup) {
     lookups[index] =
         includeDataNodeLookup ? dataObject.getNodeDelegate().getLookup() : Lookup.EMPTY;
     try {
       settingLookup = true; // avoid re-entrant call
       lookup.setSubLookups(lookups);
     } finally {
       settingLookup = false;
     }
   }
 }
Пример #4
0
  private void initLookup() {
    Lookup explorerLookup; // lookup for EpxlorerManager
    Lookup plainContentLookup; // general util using ic
    Lookup dataObjectLookup; // to make sure DO is in lookup WHEN no node selected
    if (lookup == null) {
      lookup = new FormProxyLookup();

      explorerLookup = null;

      // general utility content
      // add itself (for satellite view)
      ic.add(this);
      // add calibrated zoom
      ic.add(new FixCenterCalibratedZoom(0.1));
      ic.add(new FixCenterCalibratedZoom(0.25));
      ic.add(new FixCenterCalibratedZoom(0.5));
      ic.add(new FixCenterCalibratedZoom(0.75));
      ic.add(new FixCenterCalibratedZoom(1));
      ic.add(new FixCenterCalibratedZoom(2));
      ic.add(new FixCenterCalibratedZoom(4));
      ic.add(new FixCenterCalibratedZoom(8));
      ic.add(new FixCenterCalibratedZoom(16));
      plainContentLookup = new AbstractLookup(ic);

      dataObjectLookup = null;
    } else {
      Lookup[] lookups = lookup.getSubLookups();
      explorerLookup = lookups[0];
      plainContentLookup = lookups[1];
      dataObjectLookup = lookups[2];
    }
    if (dataObjectLookup == null) {
      dataObjectLookup = dataObject.getNodeDelegate().getLookup();
    }
    if (explorerLookup == null) {
      ActionMap map = new ActionMap();
      explorerLookup = ExplorerUtils.createLookup(layerController.getExplorerManager(), map);
    }
    lookup.setSubLookups(new Lookup[] {explorerLookup, plainContentLookup, dataObjectLookup});
  }