Example #1
0
  /**
   * Draws the panels and their children that compose the basic WMT GUI.
   *
   * @param data the DataManager object for the WMT session
   */
  public Perspective(DataManager data) {

    super(Unit.PX);
    this.data = data;
    this.data.setPerspective(this);
    this.addStyleName("wmt-DockLayoutPanel");
    if (data.isDevelopmentMode()) {
      this.addStyleDependentName("devmode");
    }

    // Determine initial view sizes based on browser window dimensions.
    browserWindowWidth = Window.getClientWidth();
    Integer viewEastInitialWidth =
        (int) Math.round(Constants.VIEW_EAST_FRACTION * browserWindowWidth);
    Integer headerHeight = 50; // TODO diagnose from largest header elt

    // The Perspective has two children, a header in the north panel
    // and a SplitLayoutPanel below.
    viewNorth = new ViewNorth();
    this.addNorth(viewNorth, headerHeight);
    SplitLayoutPanel splitter = new SplitLayoutPanel(Constants.SPLITTER_SIZE);
    splitter.addStyleName("wmt-SplitLayoutPanel");
    this.add(splitter);

    // The SplitLayoutPanel defines panels which translate to the West
    // and East views of WMT.
    viewEast = new ViewEast();
    splitter.addEast(viewEast, viewEastInitialWidth);
    viewWest = new ViewWest();
    splitter.add(viewWest); // must be last
  }
Example #2
0
 /**
  * A convenience method for setting the title of the Parameters panel.
  *
  * @param componentId the id of the component whose parameters are displayed
  */
 public void setParameterPanelTitle(String componentId) {
   String tabTitle = Constants.TITLE_PARAMETERS_PANEL;
   if (componentId != null) {
     String componentName = data.getModelComponent(componentId).getName();
     tabTitle += " (" + componentName + ")";
   }
   viewEast.setTabHTML(0, tabTitle);
 }
Example #3
0
  /**
   * A convenience method for setting the tab title of the Model panel. If the model isn't saved,
   * prepend an asterisk to its name. If the model isn't owned by the current user, append
   * "read-only" to its name.
   */
  public void setModelPanelTitle() {
    String tabTitle = Constants.TITLE_MODEL_PANEL;
    String modelName = data.getModel().getName();
    if (!modelName.equals(Constants.DEFAULT_MODEL_NAME)) {
      String marker = data.modelIsSaved() ? "" : "*";
      tabTitle += " (" + marker + modelName + ")";

      // This is a workaround for the difficult-to-modify TabLayoutPanel CSS.
      String modelOwner = data.findModel(modelName).getOwner();
      if ((modelOwner != null) && (modelOwner != data.security.getWmtUsername())) {
        tabTitle +=
            "<span style=\"margin-left:5px; color:rgb(203,73,54); "
                + "font-size:13px;\">read-only</span>"; // Font Awesome-ify?
      }
    }
    viewWest.setTabHTML(0, tabTitle);
  }
Example #4
0
  /** Resets WMT to an approximation of its startup state. */
  public void reset() {
    data.resetModelComponents();
    parameterTable.clearTable();
    modelTree.initializeTree();
    data.updateModelSaveState(false);
    ((ComponentSelectionMenu) modelTree.getDriverComponentCell().getComponentMenu())
        .updateComponents();

    // Deselect all labels except for the owner label.
    for (Map.Entry<String, LabelJSO> entry : data.modelLabels.entrySet()) {
      try {
        entry.getValue().isSelected(entry.getKey().equals(data.security.getWmtUsername()));
      } catch (Exception e) {
        GWT.log(e.toString());
      }
    }
    labelsMenu.populateMenu();
  }