/*
  * (non-Javadoc)
  *
  * @see org.deegree.igeo.views.IView#init(org.deegree.client.presenter.state.ComponentStateAdapter,
  * org.deegree.client.configuration.ViewForm)
  */
 public void init(ViewFormType viewForm) throws Exception {
   setResizable(
       ((InnerFrameViewFormType) viewForm.get_AbstractViewForm().getValue()).isResizeable());
   setMaximizable(true);
   setIconifiable(true);
   Border outsideBorder = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
   Border insideBorder = BorderFactory.createLineBorder(new Color(197, 197, 220), 3);
   setBorder(BorderFactory.createCompoundBorder(outsideBorder, insideBorder));
   // TODO
   // each internal frame should have its own icon
   setFrameIcon(IconRegistry.getIcon("layers.png"));
   ComponentPosition compPosAdapter = this.owner.getComponentPositionAdapter();
   if (compPosAdapter.hasWindow()) {
     setSize(compPosAdapter.getWindowWidth(), compPosAdapter.getWindowHeight());
     setLocation(compPosAdapter.getWindowLeft(), compPosAdapter.getWindowTop());
   }
   setTitle(this.owner.getName());
   if (getParent() == null) {
     // parent is null view has not been yet added to its parent. This is the case if a
     // module's view is 'closed' when loading a project
     Container con = (Container) owner.getGUIContainer();
     if (con != null) {
       con.add(this);
     }
   }
 }
  private void initGUI() {
    try {
      {
        GridBagLayout thisLayout = new GridBagLayout();
        thisLayout.rowWeights = new double[] {0.0, 0.1};
        thisLayout.rowHeights = new int[] {267, 7};
        thisLayout.columnWeights = new double[] {0.0, 0.1, 0.1};
        thisLayout.columnWidths = new int[] {154, 7, 7};
        getContentPane().setLayout(thisLayout);
        {
          pnButtons = new JPanel();
          FlowLayout pnButtonsLayout = new FlowLayout();
          pnButtonsLayout.setAlignment(FlowLayout.LEFT);
          pnButtons.setLayout(pnButtonsLayout);
          getContentPane()
              .add(
                  pnButtons,
                  new GridBagConstraints(
                      0,
                      1,
                      2,
                      1,
                      0.0,
                      0.0,
                      GridBagConstraints.CENTER,
                      GridBagConstraints.BOTH,
                      new Insets(0, 0, 0, 0),
                      0,
                      0));
          {
            btOK =
                new JButton(
                    Messages.getMessage(getLocale(), "$MD11617"),
                    IconRegistry.getIcon("accept.png"));
            pnButtons.add(btOK);
            btOK.addActionListener(
                new ActionListener() {

                  public void actionPerformed(ActionEvent e) {
                    createArc();
                    drawingPane.getDrawObjectsAsGeoPoints().clear();
                    digitizerModule.getMapModule().update();
                  }
                });
          }
          {
            btCancel =
                new JButton(
                    Messages.getMessage(getLocale(), "$MD11618"),
                    IconRegistry.getIcon("cancel.png"));
            pnButtons.add(btCancel);
            btCancel.addActionListener(
                new ActionListener() {

                  public void actionPerformed(ActionEvent e) {
                    dispose();
                  }
                });
          }
        }
        {
          pnHelp = new JPanel();
          FlowLayout pnHelpLayout = new FlowLayout();
          pnHelpLayout.setAlignment(FlowLayout.RIGHT);
          pnHelp.setLayout(pnHelpLayout);
          getContentPane()
              .add(
                  pnHelp,
                  new GridBagConstraints(
                      2,
                      1,
                      1,
                      1,
                      0.0,
                      0.0,
                      GridBagConstraints.CENTER,
                      GridBagConstraints.BOTH,
                      new Insets(0, 0, 0, 0),
                      0,
                      0));
          {
            btHelp =
                new JButton(
                    Messages.getMessage(getLocale(), "$MD11619"), IconRegistry.getIcon("help.png"));
            pnHelp.add(btHelp);
          }
        }
        {
          pnDescription = new JPanel();
          BorderLayout pnDescriptionLayout = new BorderLayout();
          pnDescription.setLayout(pnDescriptionLayout);
          getContentPane()
              .add(
                  pnDescription,
                  new GridBagConstraints(
                      0,
                      0,
                      1,
                      1,
                      0.0,
                      0.0,
                      GridBagConstraints.CENTER,
                      GridBagConstraints.BOTH,
                      new Insets(0, 0, 0, 0),
                      0,
                      0));
          pnDescription.setBorder(
              BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11620")));
          {
            tpDescription = new JTextPane();
            pnDescription.add(tpDescription, BorderLayout.CENTER);
            tpDescription.setBackground(pnDescription.getBackground());
            tpDescription.setEditable(false);
            tpDescription.setContentType("text/html");
            tpDescription.setText(Messages.getMessage(getLocale(), "$MD11621"));
          }
        }
        {
          pnControl = new JPanel();
          GridBagLayout pnControlLayout = new GridBagLayout();
          getContentPane()
              .add(
                  pnControl,
                  new GridBagConstraints(
                      1,
                      0,
                      2,
                      1,
                      0.0,
                      0.0,
                      GridBagConstraints.CENTER,
                      GridBagConstraints.BOTH,
                      new Insets(0, 0, 0, 0),
                      0,
                      0));
          pnControl.setBorder(
              BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11622")));
          pnControlLayout.rowWeights = new double[] {0.0, 0.0, 0.1};
          pnControlLayout.rowHeights = new int[] {63, 109, 20};
          pnControlLayout.columnWeights = new double[] {0.1};
          pnControlLayout.columnWidths = new int[] {7};
          pnControl.setLayout(pnControlLayout);
          {
            pnArc = new JPanel();
            GridBagLayout pnArcLayout = new GridBagLayout();
            pnControl.add(
                pnArc,
                new GridBagConstraints(
                    0,
                    0,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH,
                    new Insets(0, 0, 0, 0),
                    0,
                    0));
            pnArc.setBorder(
                BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11623")));
            pnArcLayout.rowWeights = new double[] {0.1};
            pnArcLayout.rowHeights = new int[] {7};
            pnArcLayout.columnWeights = new double[] {0.1};
            pnArcLayout.columnWidths = new int[] {7};
            pnArc.setLayout(pnArcLayout);
            {
              spArc = new JSpinner(new SpinnerNumberModel(0, -181, 181, 0.5));
              pnArc.add(
                  spArc,
                  new GridBagConstraints(
                      0,
                      0,
                      1,
                      1,
                      0.0,
                      0.0,
                      GridBagConstraints.CENTER,
                      GridBagConstraints.HORIZONTAL,
                      new Insets(0, 9, 0, 9),
                      0,
                      0));
              spArc.addChangeListener(
                  new ChangeListener() {

                    public void stateChanged(ChangeEvent e) {
                      applyArc();
                    }
                  });
            }
          }
          {
            pnRadius = new JPanel();
            GridBagLayout pnRadiusLayout = new GridBagLayout();
            pnControl.add(
                pnRadius,
                new GridBagConstraints(
                    0,
                    1,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH,
                    new Insets(0, 0, 0, 0),
                    0,
                    0));
            pnRadius.setBorder(
                BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11624")));
            pnRadiusLayout.rowWeights = new double[] {0.0, 0.1};
            pnRadiusLayout.rowHeights = new int[] {43, 20};
            pnRadiusLayout.columnWeights = new double[] {0.1};
            pnRadiusLayout.columnWidths = new int[] {7};
            pnRadius.setLayout(pnRadiusLayout);
            {
              spArcRadius = new JSpinner(new SpinnerNumberModel(1d, 0.0001, 999999999, 0.5));
              pnRadius.add(
                  spArcRadius,
                  new GridBagConstraints(
                      0,
                      0,
                      1,
                      1,
                      0.0,
                      0.0,
                      GridBagConstraints.CENTER,
                      GridBagConstraints.HORIZONTAL,
                      new Insets(0, 9, 0, 9),
                      0,
                      0));
              spArcRadius.addChangeListener(
                  new ChangeListener() {

                    public void stateChanged(ChangeEvent e) {
                      applyRadius();
                    }
                  });
            }
            {
              pnUOM = new JPanel();
              FlowLayout pnUOMLayout = new FlowLayout();
              pnUOMLayout.setAlignment(FlowLayout.LEFT);
              pnUOMLayout.setHgap(9);
              pnUOMLayout.setVgap(10);
              pnUOM.setLayout(pnUOMLayout);
              pnRadius.add(
                  pnUOM,
                  new GridBagConstraints(
                      0,
                      1,
                      1,
                      1,
                      0.0,
                      0.0,
                      GridBagConstraints.CENTER,
                      GridBagConstraints.BOTH,
                      new Insets(0, 0, 0, 0),
                      0,
                      0));
              {
                lbUOM = new JLabel(Messages.getMessage(getLocale(), "$MD11625"));
                pnUOM.add(lbUOM);
                lbUOM.setPreferredSize(new Dimension(102, 16));
              }
              {
                String tmp = Messages.getMessage(getLocale(), "$MD11626");
                cbUOM = new JComboBox(new DefaultComboBoxModel(tmp.split(",")));
                pnUOM.add(cbUOM);
                cbUOM.setPreferredSize(new Dimension(136, 22));
              }
            }
          }
          {
            pnRotation = new JPanel();
            GridBagLayout pnRotationLayout = new GridBagLayout();
            pnControl.add(
                pnRotation,
                new GridBagConstraints(
                    0,
                    2,
                    1,
                    1,
                    0.0,
                    0.0,
                    GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH,
                    new Insets(
                        0, 0,
                        0, 0),
                    0,
                    0));
            pnRotation.setBorder(
                BorderFactory.createTitledBorder(Messages.getMessage(getLocale(), "$MD11627")));
            pnRotationLayout.rowWeights = new double[] {0.1};
            pnRotationLayout.rowHeights = new int[] {7};
            pnRotationLayout.columnWeights = new double[] {0.1};
            pnRotationLayout.columnWidths = new int[] {7};
            pnRotation.setLayout(pnRotationLayout);
            {
              spNoOfVertices = new JSpinner(new SpinnerNumberModel(10, 5, 1000, 1));
              pnRotation.add(
                  spNoOfVertices,
                  new GridBagConstraints(
                      0,
                      0,
                      1,
                      1,
                      0.0,
                      0.0,
                      GridBagConstraints.CENTER,
                      GridBagConstraints.HORIZONTAL,
                      new Insets(0, 9, 0, 9),
                      0,
                      0));
            }
          }
        }
      }
      this.setSize(457, 339);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }