Beispiel #1
0
 /**
  * Create the physical control.
  *
  * @param bEditableControl Is this control editable?
  * @return The new control.
  */
 public Component setupControl(boolean bEditableControl) {
   String strDesc = ((SRadioButton) this.getScreenField()).getButtonDesc();
   JRadioButton control = null;
   String m_strImageButton = ((SRadioButton) this.getScreenField()).getImageButtonName();
   if (m_strImageButton == null) control = new JRadioButton(strDesc); // Physical control
   else if ((strDesc == null) || (strDesc.length() == 0))
     control =
         new JRadioButton(
             this.loadImageIcon(
                 m_strImageButton, null)); // Get this image, then redisplay me when you're done
   else
     control =
         new JRadioButton(
             strDesc,
             this.loadImageIcon(
                 m_strImageButton, null)); // Get this image, then redisplay me when you're done
   control.setOpaque(false);
   control.setHorizontalTextPosition(JToggleButton.LEFT);
   control.setIconTextGap(
       org.jbundle.base.screen.control.javafx.util.ScreenInfo.EXTRA_COL_SPACING);
   if (bEditableControl) {
     control.addFocusListener(this);
     control.addActionListener(this);
   }
   return control;
 }
  private void initGui() {
    setLayout(new GridBagLayout());

    ButtonGroup contentSourceRadioGroup = new ButtonGroup();
    contentSourceRadioGroup.add(genAttribRadioButton);
    contentSourceRadioGroup.add(fileRadioButton);
    contentSourceRadioGroup.add(genAttribAndFileRadioButton);

    includeDescription.setIconTextGap(10);
    add(
        includeDescription,
        GuiUtil.setConstraints(
            0,
            1,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.BOTH,
            BORDER_THICKNESS,
            0,
            BORDER_THICKNESS,
            0));

    contentSourcePanel = new JPanel();
    contentSourcePanel.setLayout(new GridBagLayout());
    contentSourcePanel.setBorder(BorderFactory.createTitledBorder(""));
    add(
        contentSourcePanel,
        GuiUtil.setConstraints(
            0,
            2,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.BOTH,
            BORDER_THICKNESS,
            0,
            BORDER_THICKNESS,
            0));

    genAttribRadioButton.setIconTextGap(10);
    fileRadioButton.setIconTextGap(10);
    genAttribAndFileRadioButton.setIconTextGap(10);

    GridBagConstraints garb =
        GuiUtil.setConstraints(
            0, 0, 0.0, 1.0, GridBagConstraints.BOTH, 0, BORDER_THICKNESS, 0, BORDER_THICKNESS);
    garb.gridwidth = 2;
    contentSourcePanel.add(genAttribRadioButton, garb);
    GridBagConstraints frb =
        GuiUtil.setConstraints(
            0, 1, 0.0, 1.0, GridBagConstraints.BOTH, 0, BORDER_THICKNESS, 0, BORDER_THICKNESS);
    frb.gridwidth = 2;
    contentSourcePanel.add(fileRadioButton, frb);
    browseText.setPreferredSize(browseText.getSize());
    contentSourcePanel.add(
        browseText,
        GuiUtil.setConstraints(
            0, 2, 1.0, 1.0, GridBagConstraints.BOTH, 0, BORDER_THICKNESS * 6, 0, 0));
    contentSourcePanel.add(
        browseButton,
        GuiUtil.setConstraints(
            1, 2, 0.0, 1.0, GridBagConstraints.BOTH, 0, BORDER_THICKNESS * 2, 0, BORDER_THICKNESS));
    GridBagConstraints gaafrb =
        GuiUtil.setConstraints(
            0,
            3,
            0.0,
            1.0,
            GridBagConstraints.BOTH,
            BORDER_THICKNESS,
            BORDER_THICKNESS,
            0,
            BORDER_THICKNESS);
    gaafrb.gridwidth = 2;
    contentSourcePanel.add(genAttribAndFileRadioButton, gaafrb);

    contentInSeparateFile.setIconTextGap(10);
    add(
        contentInSeparateFile,
        GuiUtil.setConstraints(
            0, 3, 2, 1, 1.0, 0.0, GridBagConstraints.BOTH, BORDER_THICKNESS, 0, 0, 0));
    add(
        warningLabel,
        GuiUtil.setConstraints(
            0, 4, 2, 1, 1.0, 0.0, GridBagConstraints.BOTH, 0, BORDER_THICKNESS * 6, 0, 0));

    PopupMenuDecorator.getInstance().decorate(browseText);

    includeDescription.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setEnabledComponents();
          }
        });

    browseButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadFile();
          }
        });

    genAttribRadioButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setEnabledComponents();
          }
        });

    fileRadioButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setEnabledComponents();
          }
        });

    genAttribAndFileRadioButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setEnabledComponents();
          }
        });
  }