예제 #1
0
  /**
   * Constructor
   *
   * @param mt Map transform
   * @param type Layer geometry type
   * @param layer Layer
   * @param style Style
   */
  public SimpleStyleEditor(MapTransform mt, Type type, ILayer layer, Style style) {
    // Set the layout.
    super(new BorderLayout());

    // Recover the first three paramters.
    this.mt = mt;
    this.type = type;
    this.layer = layer;

    // Get the geometry type and available legends.
    this.geometryType =
        (type == null) ? SimpleGeometryType.ALL : SimpleGeometryType.getSimpleType(type);

    // Initialize the dialog container, adding the empty dialog.
    cardLayout = new CardLayout();
    dialogContainer = new JPanel(cardLayout);
    dialogContainer.setPreferredSize(new Dimension(640, 420));
    addEmptyDialog();

    // Add all panels.
    styleWrapper = addAllPanels(style);

    // Initialize the legend tree.
    legendTree = new LegendTree(this);

    // Put everything inside a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, legendTree, dialogContainer);
    // Should be just wide enough for "Interval classification - Point"
    splitPane.setDividerLocation(260);
    Dimension minimumSize = new Dimension(100, 50);
    legendTree.setMinimumSize(minimumSize);
    dialogContainer.setMinimumSize(minimumSize);
    add(splitPane, BorderLayout.CENTER);
  }
예제 #2
0
 /**
  * Retrieves the currently selected legend in the tree and shows the corresponding dialog in the
  * card layout; shows the empty panel if no legend is selected.
  */
 protected void showDialogForCurrentlySelectedLegend() {
   ISELegendPanel selected = legendTree.getSelectedPanel();
   if (selected != null) {
     cardLayout.show(dialogContainer, selected.getId());
   } else {
     cardLayout.show(dialogContainer, NO_LEGEND_ID);
   }
 }
예제 #3
0
 @Override
 public String validateInput() {
   if (!legendTree.hasLegend()) {
     return I18N.tr("You must create at least one legend");
   }
   List<String> errors = styleWrapper.validateInput();
   StringBuilder sb = new StringBuilder();
   for (String message : errors) {
     if (message != null && !message.isEmpty()) {
       sb.append(message);
       sb.append("\n");
     }
   }
   String err = sb.toString();
   if (err != null && !err.isEmpty()) {
     return err;
   }
   return null;
 }
예제 #4
0
 /**
  * Updates the name of the selected element when it changes.
  *
  * @param pce The original event
  */
 public void onNodeNameChange(PropertyChangeEvent pce) {
   if (pce.getPropertyName().equals(PnlRule.NAME_PROPERTY)) {
     legendTree.selectedNameChanged();
   }
 }