Esempio n. 1
0
 /**
  * Returns the layer name (depending of the "show layer names" check cob is clicked)
  *
  * @param layer
  * @return
  */
 private String getLayerName(WFSLayerNode layer) {
   if (showLayerNames) {
     return "[" + layer.getName() + "] " + layer.getTitle();
   } else {
     return layer.getTitle();
   }
 }
  /**
   * Set the selected layer node
   *
   * @param layerNode the layer to select
   */
  public void setSelectedFeature(WFSLayerNode layerNode) {
    int index = -1;

    for (int i = 0; i < getLstFeatures().getRowCount(); i++) {
      WFSLayerNode node = (WFSLayerNode) getLstFeatures().getValueAt(i);

      if (node != null && layerNode.getName().equals(node.getName())) {
        index = i;
      }
    }

    if (index != -1) {
      getLstFeatures().changeSelection(index, 0, false, false);
    }
  }
  /**
   * Refreshes the wizard components data each time a feature is selected. The
   * <i>describeFeatureType</i> operation must be sent.
   */
  public void refreshData() {
    WFSLayerNode lyr = (WFSLayerNode) getLstFeatures().getSelectedValue();

    try {
      getTxtName().setText(lyr.getTitle());
    } catch (NullPointerException e) {
      getTxtName().setText(PluginServices.getText(this, "default_name"));
      NotificationManager.addError(PluginServices.getText(this, "default_name"), e);
    }

    IPanelGroup panelGroup = getPanelGroup();

    if (panelGroup == null) return;

    ((WFSParamsPanel) panelGroup).refresh(lyr);

    repaint();
  }
  /** Refresh the features list */
  public void refresh(WFSLayerNode layer) {
    // Unselects all features
    unselectAllFeatures();

    // Add the new features
    getLstFeatures().addFeatures(getWizardData().getFeatures());

    if (layer != null) {
      layerNode = layer;
      setLayerName(layer.getName());
      setSelectedFeature(layer);
    }
  }