Пример #1
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();
  }
Пример #2
0
 @Override
 public void resultChanged(LookupEvent ev) {
   Collection lcs = lcResult.allInstances();
   if (lcs.isEmpty()) {
     setEnabled(false);
   } else {
     // assuming that there'll be only one layercontroller in context
     LayerController lc = (LayerController) lcs.iterator().next();
     if (delegate != null) {
       delegate.removePropertyChangeListener(this);
     }
     ExplorerManager em = lc.getExplorerManager();
     delegate = ExplorerUtils.actionDelete(em, false);
     delegate.addPropertyChangeListener(this);
     setEnabled(delegate.isEnabled());
   }
 }
Пример #3
0
  ImmutableLayoutScene(DataObject obj, LayoutLSystem lSystem) {
    super();
    this.projectPath =
        FileOwnerQuery.getOwner(obj.getPrimaryFile()).getProjectDirectory().getPath();
    LayoutLSystem lSclone = new LayoutLSystem(lSystem);
    LayoutDocument ld = lSclone.getDocument();

    // paper layer
    this.paperWidget = new PaperWidget(this, ld);
    paperWidget.drawShadow = false;
    paperLayer.addChild(paperWidget);

    LayerController layerController = LayerFactory.createLayer(this, lSclone.getLayers());
    // main layer, where sublayout widgets will be added
    addChild(layerController.getRootWidget());

    for (Object o : getObjects()) {
      Widget w = findWidget(o);
      if (w instanceof SubLayoutWidget) {
        SubLayoutWidget slw = (SubLayoutWidget) w;
        slw.showEmptySquares(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});
  }