示例#1
0
 private void setValueToEditor(LafParameterStorage storage) {
   this.storage = storage;
   if (parameter.getParameterClass() == boolean.class
       || parameter.getParameterClass() == Boolean.class) {
     Boolean value =
         (Boolean) LafParameterProvider.getInstance().getValue(parameter, entityId, storage);
     if (value == null) {
       jcbEditor.setSelectedIndex(0);
     } else if (value) {
       jcbEditor.setSelectedIndex(1);
     } else {
       jcbEditor.setSelectedIndex(2);
     }
   } else {
     Object o = LafParameterProvider.getInstance().getValue(parameter, entityId, storage);
     if (parameter.getFixedValueList() != null) {
       jcbEditor.setSelectedIndex(0);
       for (int i = 0; i < parameter.getFixedValueList().length; i++) {
         if (LangUtils.equals(o, parameter.getFixedValueList()[i])) {
           jcbEditor.setSelectedIndex(i + 1);
         }
       }
     } else {
       jtfEditor.setText(o == null ? "" : o.toString());
     }
   }
 }
示例#2
0
 private String getValueFromEditor() {
   if (jcbEditor != null) {
     if (parameter.getParameterClass() == boolean.class
         || parameter.getParameterClass() == Boolean.class) {
       switch (jcbEditor.getSelectedIndex()) {
         case 1:
           return Boolean.TRUE.toString();
         case 2:
           return Boolean.FALSE.toString();
         default:
           return null;
       }
     } else {
       int index = jcbEditor.getSelectedIndex();
       if (index == 0) {
         return null;
       } else {
         return parameter.getFixedValueList()[index - 1].toString();
       }
     }
   } else {
     String result = jtfEditor.getText();
     return "".equals(result) ? null : result;
   }
 }
示例#3
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");
    }