Package easysm.boundaries

Source Code of easysm.boundaries.UpdateProject

package easysm.boundaries;

import javax.swing.JOptionPane;

import easysm.Constants;
import easysm.boundaries.components.EasySMFrame;
import easysm.boundaries.components.statemachine.StateMachine_Examine;
import easysm.datatypes.Action;
import easysm.datatypes.Expr;
import easysm.datatypes.visualization.ClassDiagramVis;
import easysm.datatypes.visualization.ProjectVis;
import easysm.datatypes.visualization.StateMachineVis;
import easysm.executors.Main;
import easysm.stores.Row;

/**
* @author FourCheeses Software Solutions
*/
public class UpdateProject extends BaseBoundary
{
  private ProjectVis currentProject;
  private StateMachineVis currentSM;
  private ClassDiagramVis currentOutputCD;
 
  private UpdateInputCD updateInputCD;
  private UpdateStateObservers updateSO;
  private UpdateEvents updateEvents;
  private UpdateStateTable updateST;
 
  private EasySMFrame frame;
  private StateMachine_Examine examineFrame;

  public UpdateProject(Main main, UpdateInputCD updateInputCD, UpdateStateObservers updateSO,
          UpdateEvents updateEvents, UpdateStateTable updateST)
  {
    super(main);
    this.updateInputCD = updateInputCD;
    this.updateSO = updateSO;
    this.updateEvents = updateEvents;
    this.updateST = updateST;
  }

  /*
   *
   * Properties
   */

  public ProjectVis currentProject()
  {
    return currentProject;
  }

  public StateMachineVis currentSM()
  {
    return currentSM;
  }

  public ClassDiagramVis currentOutputCD()
  {
    return currentOutputCD;
  }

  public UpdateInputCD updateInputCD()
  {
    return updateInputCD;
  }

  public UpdateStateObservers updateSO()
  {
    return updateSO;
  }

  public UpdateEvents updateEvents()
  {
    return updateEvents;
  }

  public UpdateStateTable updateST()
  {
    return updateST;
  }

  /*
   *
   * Operations called by Main
   */

  public void setFrame(EasySMFrame frame)
  {
    this.frame = frame;
  }

  public void setProject(ProjectVis project)
  {
    currentProject = project;
    if (frame != null && currentProject!=null) {
      frame.updateCheckboxTabsIfValid();
    }
  }

  public void setStateMachine(StateMachineVis smVis)
  {
    currentSM = smVis;
    if (frame != null) {
      frame.enableShowButtons();
    }
  }

  public void setOutputCD(ClassDiagramVis cdVis)
  {
    currentOutputCD = cdVis;
    if (frame != null) {
      frame.enableShowButtons();
    }
  }
 
  @Override
  public void info(String msg)
  {
    JOptionPane.showMessageDialog(frame, msg, Constants.INFO_DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
  }

  @Override
  public void error(String msg)
  {
    // Do nothing
  }

  /*
   *
   * Operations called by the GUI
   */

  public void openInputCD()
  {
    main().doOpenInputCD();
  }

  public void openSO()
  {
    main().doOpenSO();
  }

  public void openEvents()
  {
    main().doOpenEvents();
  }

  public void openST()
  {
    main().doOpenST();
  }

  public void generateSM()
  {
    main().doGenerateSM();
  }

  public void done()
  {
    examineFrame.dispose();
    examineFrame = null;
  }

  public void examine(Row row,
                      Expr cond,
                      Action act)
  {
    if (examineFrame == null) {
      examineFrame = new StateMachine_Examine(this);
      examineFrame.setLocationRelativeTo(frame);
    }

    examineFrame.setTheFrame(row, cond, act);
  }

  public void answer(boolean sat,
                     Row target)
  {
    main().rowSatisfies(sat, target);
  }
}
TOP

Related Classes of easysm.boundaries.UpdateProject

TOP
Copyright © 2018 www.massapi.com. 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.