Package org.woped.qualanalysis.sidebar.assistant.components

Examples of org.woped.qualanalysis.sidebar.assistant.components.SimpleGridBagLayout


public class StartPage extends BeginnerPanel {

  public StartPage(SideBar sideBar) {
    super(null, sideBar, Messages.getString(PREFIX_BEGINNER + "Startpage"));

    SimpleGridBagLayout sgbl = new SimpleGridBagLayout();

    JPanel analysisPanel = new JPanel(sgbl);
    analysisPanel.setBackground(Color.WHITE);

    JLabel correctness = null;

    /*
     * Workflow
     */

    // add workflow-label
    JLabel workflowLabel = new JLabel(Messages.getString(PREFIX + "WorkflowAnalysis"));
    workflowLabel.setFont(SUBHEADER_FONT);
    workflowLabel.setBorder(BOTTOM_BORDER);
    sgbl.addComponent(analysisPanel, workflowLabel, 0, 0, 1, 1, 1, 0);

    // add workflow info
    if (qualanalysisService.isWorkflowNet()) {
      // create "correct"-icon
      correctness = new JLabel(Messages.getImageIcon(CORRECT_ICON));
    } else {
      // create workflow-page with further information
      WorkflowPage workflowPage = new WorkflowPage(this, sideBar);
      status = false;
      // create "incorrect"-icon
      correctness = new JLabel(Messages.getImageIcon(INCORRECT_ICON));
      // add detail-button
      JLabel workflowDetails = new JLabel(Messages.getImageIcon(DETAILS_ICON));
      workflowDetails.addMouseListener(new DetailsMouseListener(sideBar, workflowPage));
      workflowDetails.setBorder(BOTTOM_BORDER);
      sgbl.addComponent(analysisPanel, workflowDetails, 2, 0, 1, 1, 0, 0);
    }
    // add icon
    correctness.setBorder(BOTTOM_RIGHT_BORDER);
    sgbl.addComponent(analysisPanel, correctness, 1, 0, 1, 1, 0, 0);

    /*
     * Soundness
     */

    // display only if workflow-property is given
    if (qualanalysisService.isWorkflowNet()) {

      // add soundness-label
      JLabel soundnessLabel = new JLabel(Messages.getString(PREFIX + "SoundnessAnalysis"));
      soundnessLabel.setFont(SUBHEADER_FONT);
      soundnessLabel.setBorder(BOTTOM_BORDER);
      sgbl.addComponent(analysisPanel, soundnessLabel, 0, 1, 1, 1, 1, 1);

      // add soundness info
      // create coundness-page with further information
      SoundnessPage soundnessPage = new SoundnessPage(this, sideBar);
      if (soundnessPage.getWarningStatus()) {
        // create "correct"-icon
        correctness = new JLabel(Messages.getImageIcon(CORRECT_ICON));
      } else {
        if (!soundnessPage.getErrorStatus()) {
          // create "incorrect"-icon
          correctness = new JLabel(Messages.getImageIcon(INCORRECT_ICON));
        } else {
          // create "warning"-icon
          correctness = new JLabel(Messages.getImageIcon(WARNING_ICON));
        }
       
        // add detail-button
        JLabel soundnessDetails = new JLabel(Messages.getImageIcon(DETAILS_ICON));
        soundnessDetails.addMouseListener(new DetailsMouseListener(sideBar, soundnessPage));
        soundnessDetails.setBorder(BOTTOM_BORDER);
        sgbl.addComponent(analysisPanel, soundnessDetails, 2, 1, 1, 1, 0, 1);
      }
      // add icon
      correctness.setBorder(BOTTOM_RIGHT_BORDER);
      sgbl.addComponent(analysisPanel, correctness, 1, 1, 1, 1, 0, 1);
    }

    /*
     * token-mistake in initial marking
     */

    // check only for workflow-net
    if(qualanalysisService.isWorkflowNet()){
      // display only if there is a token mistake in initial marking
      if (qualanalysisService.getWronglyMarkedPlaces().size() > 0) {
        // add tokenMistake-label
        JLabel tokenMistakeLabel = new JLabel(Messages.getString(PREFIX_BEGINNER + "InitialMarkingMistake"));
        tokenMistakeLabel.setFont(SUBHEADER_FONT);
        tokenMistakeLabel.setBorder(BOTTOM_BORDER);
        sgbl.addComponent(analysisPanel, tokenMistakeLabel, 0, 2, 1, 1, 1, 0);
        // add tokenMistake-icon with toolTip
        JLabel tokenMistakeIcon = new JLabel(Messages.getImageIcon(WARNING_ICON));
        tokenMistakeIcon.setBorder(BOTTOM_RIGHT_BORDER);
        tokenMistakeIcon.setToolTipText(Messages.getString(PREFIX_BEGINNER + "InitialMarkingMistake.Info"));
        sgbl.addComponent(analysisPanel, tokenMistakeIcon, 1, 2, 1, 1, 0, 0);
      }
    }

    addComponent(analysisPanel, 0, 0, 1, 1, 1, 0);

    // emptyLabel

    addComponent(new JLabel(), 0, 1, 1, 1, 1, 1);

    /*
     * net info
     */
   
    ModelElementContainer mec = editor.getModelProcessor().getElementContainer();

    JPanel infoPanel = new JPanel();
    ClickLabel clickLabel = null;
    JLabel count = null;
    infoPanel.setBackground(Color.WHITE);
    infoPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 50, 0));
    infoPanel.setLayout(sgbl);

    // header
    JLabel netStatistic = new JLabel(Messages.getString(PREFIX + "NetStatistics"));
    netStatistic.setFont(HEADER_FONT);
    netStatistic.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
    sgbl.addComponent(infoPanel, netStatistic, 0, 0, 1, 1, 1, 0);

    // places
    clickLabel = new ClickLabel(Messages.getString(PREFIX + "NumPlaces") + COLON, qualanalysisService
        .getPlaces().iterator(), editor);
    clickLabel.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, clickLabel, 0, 1, 1, 1, 1, 0);

    count = new JLabel(String.valueOf(qualanalysisService.getPlaces().size()), JLabel.RIGHT);
    count.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, count, 1, 1, 1, 1, 0, 0);

    // transitions
    clickLabel = new ClickLabel(Messages.getString(PREFIX + "NumTransitions") + COLON, qualanalysisService
        .getTransitions().iterator(), editor);
    clickLabel.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, clickLabel, 0, 2, 1, 1, 1, 0);

    count = new JLabel((int)calculateT(mec)+"", JLabel.RIGHT);
    count.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, count, 1, 2, 1, 1, 0, 0);

    // operators
    clickLabel = new ClickLabel(SUB_POINT + Messages.getString(PREFIX + "NumOperators") + COLON,
        qualanalysisService.getOperators().iterator(), editor);
    clickLabel.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, clickLabel, 0, 3, 1, 1, 1, 0);

    count = new JLabel(String.valueOf(qualanalysisService.getOperators().size()), JLabel.RIGHT);
    count.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, count, 1, 3, 1, 1, 0, 0);

    // subprocesses
    clickLabel = new ClickLabel(SUB_POINT + Messages.getString(PREFIX + "NumSubprocesses") + COLON,
        qualanalysisService.getSubprocesses().iterator(), editor);
    clickLabel.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, clickLabel, 0, 4, 1, 1, 1, 0);

    count = new JLabel(String.valueOf(qualanalysisService.getSubprocesses().size()), JLabel.RIGHT);
    count.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, count, 1, 4, 1, 1, 0, 0);

    // arcs
    JLabel arcLabel = new JLabel(Messages.getString(PREFIX + "NumArcs") + COLON);
    arcLabel.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, arcLabel, 0, 5, 1, 1, 1, 0);

    count = new JLabel((int)calculateA(mec)+"", JLabel.RIGHT);
    count.setFont(ITEMS_FONT);
    sgbl.addComponent(infoPanel, count, 1, 5, 1, 1, 0, 0);

    addComponent(infoPanel, 0, 2, 1, 1, 1, 0);
  }
View Full Code Here

TOP

Related Classes of org.woped.qualanalysis.sidebar.assistant.components.SimpleGridBagLayout

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.