Пример #1
0
  /**
   * Constructor de la clase
   *
   * @param service
   * @param initialChosenMapLayers
   * @param initialSRS
   * @param alpha
   * @param selectedStyles
   */
  public EditWMSQueryPanel(
      WMService service,
      List initialChosenMapLayers,
      String initialSRS,
      int alpha,
      String initialFormat,
      Map selectedStyles) {
    this.service = service;
    this.format = initialFormat;
    this.selectedStyles = selectedStyles;

    try {
      jbInit();
      String url = service.getServerUrl();
      if (url.endsWith("?") || url.endsWith("&")) {
        url = url.substring(0, url.length() - 1);
      }
      urlTextField.setText(url);
      mapLayerPanel.init(service, initialChosenMapLayers);

      updateComboBox();
      String srsName = SRSUtils.getName(initialSRS);
      srsComboBox.setSelectedItem(srsName);
      SRS = srsName;

      mapLayerPanel.add(
          new InputChangedListener() {
            public void inputChanged() {
              updateComboBox();
              updateEnabledButtons();
            }
          });
      setAlpha(alpha);

      // inicializamos la tabla hash de estilos

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  } // fin del constructor
Пример #2
0
  /** Method updateComboBox. */
  private void updateComboBox() {
    String selectedSRS = (String) srsComboBox.getSelectedItem();
    comboBoxModel.removeAllElements();

    for (Iterator i = mapLayerPanel.commonSRSList().iterator(); i.hasNext(); ) {
      String commonSRS = (String) i.next();
      String srsName = SRSUtils.getName(commonSRS);
      comboBoxModel.addElement(srsName);
    }

    // selectedSRS might no longer be in the combobox, in which case nothing will be selected. [Jon
    // Aquino]
    srsComboBox.setSelectedItem(selectedSRS);
    if ((srsComboBox.getSelectedItem() == null) && (srsComboBox.getItemCount() > 0)) {
      srsComboBox.setSelectedIndex(0);
    }
  } // fin del método updateComboBox
Пример #3
0
 private void updateEnabledButtons() {
   try {
     jcbStyleModel.removeAllElements();
     if (mapLayerPanel.getSelectedItemsFromRigthList().size() == 1) {
       // cuando hay una capa seleccionada
       jbEditStyle.setEnabled(true);
       jbSaveStyle.setEnabled(false);
       jcbStyle.setEnabled(false);
       jlStyle.setEnabled(false);
     } else { // cuando hay más de una capa seleccionada
       jbEditStyle.setEnabled(false);
       jbSaveStyle.setEnabled(false);
       jcbStyle.setEnabled(false);
       jlStyle.setEnabled(false);
     }
   } catch (ArrayIndexOutOfBoundsException e) {
     // cuando no hay ninguna capa seleccionada
     jbEditStyle.setEnabled(false);
     jbSaveStyle.setEnabled(false);
     jcbStyle.setEnabled(false);
     jlStyle.setEnabled(false);
   } // fin del catch
 } // fin del método
Пример #4
0
 public String getEPSG() {
   int index = srsComboBox.getSelectedIndex();
   String srsCode = (String) mapLayerPanel.commonSRSList().get(index);
   return srsCode;
 }
Пример #5
0
 public List getChosenMapLayers() {
   return mapLayerPanel.getChosenMapLayers();
 }
Пример #6
0
 public String check(JComponent component) {
   return mapLayerPanel.getChosenMapLayers().isEmpty()
       ? "At least one WMS layer must be chosen"
       : null;
 }