예제 #1
0
 private void initStorage(
     LafParameterStorage storage, String label, TableLayoutBuilder tbllayStorage) {
   if (LafParameterProvider.getInstance().isStorageAllowed(parameter, storage)) {
     JRadioButton jrb = new JRadioButton(label);
     jrb.setActionCommand(storage.name());
     jrb.addActionListener(this);
     bgStorages.add(jrb);
     tbllayStorage.newRow();
     tbllayStorage.add(jrb);
     if (this.storage == null) {
       jrb.setSelected(true);
       setValueToEditor(storage);
     }
   }
 }
예제 #2
0
    private void init() {
      jpnMain = new JPanel();
      jpnMain.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
      jpnStorage = new JPanel();
      jpnStorage.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
      jlb =
          new JLabel(
              SpringLocaleDelegate.getInstance()
                      .getResource(parameter.getName(), parameter.getName())
                  + ":");

      TableLayout tbllayMain =
          new TableLayout(
              new double[] {TableLayout.PREFERRED, 10, TableLayout.PREFERRED, TableLayout.FILL},
              new double[] {TableLayout.PREFERRED, TableLayout.FILL, 20, TableLayout.PREFERRED});
      jpnMain.setLayout(tbllayMain);
      TableLayoutBuilder tbllayStorage =
          new TableLayoutBuilder(jpnStorage).columns(TableLayout.PREFERRED);
      tbllayStorage
          .newRow()
          .addLabel(
              SpringLocaleDelegate.getInstance()
                  .getResource("LafParameterEditor.2", "Wo möchten Sie den Wert ändern?"));

      jpnMain.add(jpnStorage, "0,0,0,1,l,t");
      jpnMain.add(new JSeparator(JSeparator.VERTICAL), "1,0,1,1");
      jpnMain.add(jlb, "2,0,2,0,l,t");

      if (parameter.getParameterClass() == boolean.class
          || parameter.getParameterClass() == Boolean.class) {
        jcbEditor = new JComboBox();
        jcbEditor.addItem("");
        jcbEditor.addItem(
            SpringLocaleDelegate.getInstance().getResource("LafParameterEditor.7", "Ja"));
        jcbEditor.addItem(
            SpringLocaleDelegate.getInstance().getResource("LafParameterEditor.8", "Nein"));
        jpnMain.add(jcbEditor, "2,1,2,1,l,t");
      } else {
        if (parameter.getFixedValueList() != null) {
          jcbEditor = new JComboBox();
          jcbEditor.addItem("");
          for (Object o : parameter.getFixedValueList()) {
            jcbEditor.addItem(
                SpringLocaleDelegate.getInstance().getResource(o.toString(), o.toString()));
          }
          jpnMain.add(jcbEditor, "2,1,2,1,l,t");
        } else {
          jtfEditor = new JTextField(40);
          jpnMain.add(jtfEditor, "2,1,2,1,l,t");
        }
      }

      bgStorages = new ButtonGroup();

      initStorage(
          LafParameterStorage.SYSTEMPARAMETER,
          SpringLocaleDelegate.getInstance().getResource("LafParameterEditor.4", "Systemparameter"),
          tbllayStorage);
      initStorage(
          LafParameterStorage.WORKSPACE,
          SpringLocaleDelegate.getInstance().getResource("LafParameterEditor.5", "Arbeitsumgebung"),
          tbllayStorage);
      initStorage(
          LafParameterStorage.ENTITY,
          SpringLocaleDelegate.getInstance().getResource("LafParameterEditor.6", "Entity"),
          tbllayStorage);

      jpnMain.add(
          new JLabel(
              SpringLocaleDelegate.getInstance()
                  .getResource(
                      "LafParameterEditor.3",
                      "Möglicherweise müssen Sie die Maske erneut öffnen oder den Client neu starten, damit die Einstellung wirksam wird!")),
          "0,3,3,3,l,t");
    }