Package org.woped.core.controller

Examples of org.woped.core.controller.IEditor


        // The selected element is not part of the currently edited net
        // We will try to open a corresponding sub-net and
        // see if we can select it there
        AbstractPetriNetElementModel parent = currentObject.getRootOwningContainer().getOwningElement();
        if (parent instanceof SubProcessModel) {
          IEditor newEditor = m_mediator.createSubprocessEditor(true, m_currentEditor, (SubProcessModel) parent);
          // Select in the new editor
          newEditor.getGraph().addSelectionCell(currentObject);
        }
      }
    }
    if (highlightOnly == false) {
      valueChangedActive = true;
View Full Code Here


  {
    checkSelection();
  }

  protected void checkSidebarDivider() {
    IEditor editor = am.getUi().getEditorFocus();
   
    if (editor != null) {
      editor.checkMainSplitPaneDivider();
    }
  }
View Full Code Here

  /**
   * Check what elements are selected and changes the status accordingly.
   */
  protected void checkSelection()
  {
    IEditor     editor = am.getUi().getEditorFocus();
    AbstractGraph   graph = null;
    Object       selectedCell = null, mainCell = null;
   
    if (isActive())
    { 
      graph = null;
      selectedCell = null;
      if (editor != null)
      {
        graph = editor.getGraph();
        selectedCell = graph.getSelectionCell();
        mainCell = selectedCell;
      }
     
      boolean noSelection = (selectedCell == null && !arcpointSelected);
      boolean routedArcSelected = false;
      boolean xorArcSelected = false;
      boolean unroutedArcSelected = false;
      boolean transitionSelected = false;
      boolean triggeredTransitionSelected = false;
      boolean noTimeTriggerSelected = false;
      boolean noMessageTriggerSelected = false;
      boolean noResourceTriggerSelected = false;
      boolean placeSelected = false;
      boolean tokenPlaceSelected = false;
      boolean subprocessSelected = false;
      boolean arcSelected = false;
      boolean nameSelected = false;
      boolean operatorSelected = false
      boolean groupSelected = false;
      boolean multipleSelected = false;
      int triggerType = TriggerModel.TRIGGER_NONE;
     
      while (selectedCell instanceof GroupModel)
      {
        selectedCell = ((GroupModel) selectedCell).getMainElement();
      }
     
      if (graph != null && graph.isGroup(mainCell) && ((GroupModel)mainCell).isUngroupable())
      {
        groupSelected = true;
      }
      else if (graph != null && graph.getSelectionCount() > 1)
      {
        multipleSelected = true;
      }
      else if (selectedCell instanceof ArcModel)
      {
        arcSelected = true;
        ArcModel a = (ArcModel)selectedCell;
        if (a.isXORsplit(editor.getModelProcessor()))
        {
          xorArcSelected = true;
        }
        if (((ArcModel) selectedCell).isRoute())
        {
          routedArcSelected = true;
        }
        else
        {
          unroutedArcSelected = true;
        }          
      }
      else if (selectedCell instanceof SubProcessModel)
      {
        subprocessSelected = true;
      }
      else if (selectedCell instanceof OperatorTransitionModel)
      {
        transitionSelected = true;
        operatorSelected = true;
       
        if (((OperatorTransitionModel) selectedCell).hasTrigger()) {
          triggerType = ((OperatorTransitionModel)selectedCell).getTriggerType();
          triggeredTransitionSelected = true;
        }
       
        if (triggerType != TriggerModel.TRIGGER_MESSAGE)
          noMessageTriggerSelected = true;
        if (triggerType != TriggerModel.TRIGGER_TIME)
          noTimeTriggerSelected = true;
        if (triggerType != TriggerModel.TRIGGER_RESOURCE)
          noResourceTriggerSelected = true;       

      }
      else if (selectedCell instanceof TransitionModel)
      {
        transitionSelected = true;
       
        if (((TransitionModel)selectedCell).hasTrigger()) {
          triggerType = ((TransitionModel)selectedCell).getTriggerType();
          triggeredTransitionSelected = true;
        }
         
        if (triggerType != TriggerModel.TRIGGER_MESSAGE)
          noMessageTriggerSelected = true;
        if (triggerType != TriggerModel.TRIGGER_TIME)
          noTimeTriggerSelected = true;
        if (triggerType != TriggerModel.TRIGGER_RESOURCE)
          noResourceTriggerSelected = true;       

      }  
      else if (selectedCell instanceof PlaceModel)
      {
        placeSelected = true;
        if (((PlaceModel) selectedCell).hasTokens())
        {
          tokenPlaceSelected = true;
        }
      }
      else if (selectedCell instanceof TriggerModel)
      {
        transitionSelected = true;
        triggeredTransitionSelected = true;
       
        triggerType = ((TriggerModel)selectedCell).getTriggertype();
       
        if (triggerType != TriggerModel.TRIGGER_MESSAGE)
          noMessageTriggerSelected = true;
        if (triggerType != TriggerModel.TRIGGER_TIME)
          noTimeTriggerSelected = true;
        if (triggerType != TriggerModel.TRIGGER_RESOURCE)
          noResourceTriggerSelected = true;
      }
      else if (selectedCell instanceof NameModel)
      {
        nameSelected = true;
      }
             
      setStatus(NO_SELECTION, noSelection);
      setStatus(ANY_SELECTION, !noSelection && !nameSelected && !arcpointSelected);
      setStatus(SUBPROCESS_SELECTION, subprocessSelected);
      setStatus(PLACE_SELECTION, placeSelected);
      setStatus(TOKEN_PLACE_SELECTION, tokenPlaceSelected);
      setStatus(ROUTED_ARC_SELECTION, routedArcSelected);
      setStatus(NODE_OR_XORARC_SELECTION, (transitionSelected | placeSelected | xorArcSelected) && !arcpointSelected);
      setStatus(UNROUTED_ARC_SELECTION, unroutedArcSelected);
      setStatus(TRANSITION_SELECTION, transitionSelected);
      setStatus(NODE_SELECTION, transitionSelected | placeSelected | subprocessSelected);
      setStatus(TRIGGERED_TRANSITION_SELECTION, triggeredTransitionSelected);
      setStatus(TIME_TRIGGER_SELECTION, noTimeTriggerSelected);
      setStatus(RESOURCE_TRIGGER_SELECTION, noResourceTriggerSelected);
      setStatus(MESSAGE_TRIGGER_SELECTION, noMessageTriggerSelected);
      setStatus(TRIGGERED_TRANSITION_SELECTION, triggeredTransitionSelected);
      setStatus(ARC_SELECTION, arcSelected && !arcpointSelected);
      setStatus(ARCPOINT_SELECTION, arcpointSelected);
      setStatus(OPERATOR_SELECTION, operatorSelected);
      setStatus(GROUP_SELECTION, groupSelected);
      setStatus(MULTIPLE_SELECTION, multipleSelected);
      setStatus(CAN_CUTCOPY, transitionSelected | placeSelected | multipleSelected | groupSelected | subprocessSelected);
      setStatus(CAN_PASTE, editor == null ? false : !editor.isClipboardEmpty());
      setStatus(CAN_RENAME, subprocessSelected);
    };   
  }
View Full Code Here

  protected void checkMode()
  {
    boolean tokengame = false;
    boolean drawMode = false;
    IEditor editor = am.getUi().getEditorFocus();
   
    if (editor != null) {
      tokengame = editor.isTokenGameEnabled();
      drawMode = !tokengame;
    }
    setStatus(TOKENGAME, tokengame);
    setStatus(DRAWMODE, drawMode);
  }
View Full Code Here

    // ! @param subProcess specifies the sub process element to be edited
    // ! @return reference to new editor object
    @Override
    public IEditor createSubprocessEditor(boolean undoSupport, IEditor parentEditor,
            SubProcessModel subProcess) {
        IEditor editor = null;

        List<IEditor> editors = getUi().getAllEditors();
        Iterator<IEditor> editorIter = editors.iterator();

        while (editorIter.hasNext()) {
            IEditor currentEditor = editorIter.next();

            if (currentEditor.getName().equals("Subprocess " + subProcess.getNameValue())) {
                editor = currentEditor;
            }
        }

        if (editor == null) {
View Full Code Here

        this.mediator = mediator;
    }

    public void processViewEvent(AbstractViewEvent event)
    {
        IEditor currentEditor;
        if (event.getSource() instanceof EditorVC)
        {
            currentEditor = (EditorVC) event.getSource();
        } else
        {
            currentEditor = getMediator().getUi().getEditorFocus();
        }
        switch (event.getOrder())
        {

        case AbstractViewEvent.DRAWMODE_PLACE:
          if (currentEditor.getCreateElementType() != AbstractPetriNetElementModel.PLACE_TYPE) {
            currentEditor.setDrawMode(AbstractPetriNetElementModel.PLACE_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;
        case AbstractViewEvent.DRAWMODE_TRANSITION:
          if (currentEditor.getCreateElementType() != AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE) {
            currentEditor.setDrawMode(AbstractPetriNetElementModel.TRANS_SIMPLE_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;
        case AbstractViewEvent.DRAWMODE_ANDJOIN:
          if (currentEditor.getCreateElementType() != OperatorTransitionModel.AND_JOIN_TYPE) {
            currentEditor.setDrawMode(OperatorTransitionModel.AND_JOIN_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;
        case AbstractViewEvent.DRAWMODE_ANDSPLIT:
          if (currentEditor.getCreateElementType() != OperatorTransitionModel.AND_SPLIT_TYPE) {
            currentEditor.setDrawMode(OperatorTransitionModel.AND_SPLIT_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;
        case AbstractViewEvent.DRAWMODE_ANDSPLITJOIN:
          if (currentEditor.getCreateElementType() != OperatorTransitionModel.AND_SPLITJOIN_TYPE) {
            currentEditor.setDrawMode(OperatorTransitionModel.AND_SPLITJOIN_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;
        case AbstractViewEvent.DRAWMODE_XORJOIN:
          if (currentEditor.getCreateElementType() != OperatorTransitionModel.XOR_JOIN_TYPE) {
            currentEditor.setDrawMode(OperatorTransitionModel.XOR_JOIN_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;
        case AbstractViewEvent.DRAWMODE_XORSPLIT:
          if (currentEditor.getCreateElementType() != OperatorTransitionModel.XOR_SPLIT_TYPE) {
            currentEditor.setDrawMode(OperatorTransitionModel.XOR_SPLIT_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;
        case AbstractViewEvent.DRAWMODE_XORSPLITJOIN:
          if (currentEditor.getCreateElementType() != OperatorTransitionModel.XOR_SPLITJOIN_TYPE) {
            currentEditor.setDrawMode(OperatorTransitionModel.XOR_SPLITJOIN_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;
        case AbstractViewEvent.DRAWMODE_ANDJOIN_XORSPLIT:
          if (currentEditor.getCreateElementType() != OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE) {
            currentEditor.setDrawMode(OperatorTransitionModel.ANDJOIN_XORSPLIT_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
          break;
        case AbstractViewEvent.DRAWMODE_XORJOIN_ANDSPLIT:
          if (currentEditor.getCreateElementType() != OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE) {
            currentEditor.setDrawMode(OperatorTransitionModel.XORJOIN_ANDSPLIT_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
          break;
        case AbstractViewEvent.DRAWMODE_SUB:
          if (currentEditor.getCreateElementType() != AbstractPetriNetElementModel.SUBP_TYPE) {
            currentEditor.setDrawMode(AbstractPetriNetElementModel.SUBP_TYPE, true);
          }
          else {
            currentEditor.setDrawMode(-1, false);
        }
            break;

        case AbstractViewEvent.CONFIG:
            ConfigVC config = ((ConfigVC) getMediator().getViewController(ConfigVC.ID_PREFIX));
            if (config == null)
            {
                config = (ConfigVC) getWopedMediator().createViewController(ApplicationMediator.VIEWCONTROLLER_CONFIG);
            }
            if (getMediator().getUi() != null)
            {
                config.setLocation(Utils.getCenterPoint(getMediator().getUi().getBounds(), config.getSize()));
            }
            config.setVisible(true);

            break;

        case AbstractViewEvent.EXIT:
            getMediator().getUi().quit();
            break;

        case AbstractViewEvent.UPDATE:
            for (Iterator<IEditor> iter = getMediator().getUi().getAllEditors().iterator(); iter.hasNext();)
            {
                currentEditor = ((EditorVC) iter.next());
                currentEditor.getGraph().setGridVisible(ConfigurationManager.getConfiguration().isShowGrid());
                for (Iterator<String> iterator = currentEditor.getModelProcessor().getElementContainer().getArcMap().keySet().iterator(); iterator.hasNext();)
                {
                    currentEditor.getModelProcessor().getElementContainer().getArcById(iterator.next()).initAttributes();
                }

                currentEditor.updateNet();
                VisualController.getInstance().propertyChange(new PropertyChangeEvent(this, "Update", null, null));
            }
            break;

        case AbstractViewEvent.CASCADE:
View Full Code Here

              iSB[i] = (IStatusBar) iVC[i];
          }

          PNMLImport pr = new PNMLImport(medi);
          OLDPNMLImport2 oldpr = new OLDPNMLImport2(medi);
          IEditor edit = null;
          IMetricsConfiguration metricsConfig = ConfigurationManager.getMetricsConfiguration();
      try{
        // Write top line with variable and algorithm names
        write = new BufferedWriter(new FileWriter(saveFile));
        List<String> metricsList = MetricsUIRequestHandler.getLayeredAlgoNames("ALL_METRICS");
        write.write("File name");
        for(String s:metricsList)
          write.write(","+s);
        write.write("\r\n");
       
        // Loop over all selected files to analyze them
        for(File f:filesToCheck){
          write.write(f.getName());
          if(pr.run(new FileInputStream(f),false))
            edit = pr.getEditor()[0];
          else if(oldpr.run(new FileInputStream(f),false))
            edit = oldpr.getEditor()[0];
          else continue;
          MetricsUIRequestHandler ui = new MetricsUIRequestHandler(edit);
          for(String metric:metricsList){
            StringPair result;
            if(metric != null)
              result = ui.calculateSingle(metricsConfig, metric);
            else
              result = new StringPair("","");
            write.write(","+result.getValue());
          }
          write.write("\r\n");
          edit.closeEditor();
          index++;
        }
      }catch(Exception e){e.printStackTrace();}
      try {
        write.close();
View Full Code Here

     *
     * @param file
     * @param filter
     */
    private IEditor openFile(File file, int filter) {
        IEditor editor = null;
        final PNMLImport pr;

        getMediator().getUi().getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        if (filter == FileFilterImpl.PNMLFilter || filter == FileFilterImpl.SAMPLEFilter) {

View Full Code Here

        getMediator().getUi().getComponent().setCursor(Cursor.getDefaultCursor());
        return editor;
    }
   
  private IEditor importApromore() {
    IEditor editor = null;
    final PNMLImport pr;

    pr = new PNMLImport((ApplicationMediator) getMediator());
    boolean loadSuccess = false;
View Full Code Here

    this.paraphrasingPanel = paraphrasingPanel;
  }
 

  public void run(){
    IEditor editor = paraphrasingPanel.getEditor();
    paraphrasingPanel.enableButtons(false);

    if(editor.getModelProcessor().getElementContainer().getRootElements().size() > 3){
      try{
       
        CurrentNetPnml currentNetPnml = new CurrentNetPnml(editor)
        currentNetPnml.setPnmlString();
       
View Full Code Here

TOP

Related Classes of org.woped.core.controller.IEditor

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.