Пример #1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   for (LafParameterStorage storage : LafParameterStorage.values()) {
     if (storage.name().equals(e.getActionCommand())) {
       setValueToEditor(storage);
     }
   }
 }
Пример #2
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);
     }
   }
 }
Пример #3
0
  public static void installPopup(JComponent c, LafParameter<?> parameter, Long entityId) {
    boolean changeAllowed = false;
    for (LafParameterStorage storage : LafParameterStorage.values()) {
      if (LafParameterProvider.getInstance().isStorageAllowed(parameter, storage)) {
        changeAllowed = true;
      }
    }

    if (changeAllowed) {
      JPopupMenu pm = c.getComponentPopupMenu();
      if (pm == null) {
        pm = new JPopupMenu();
        c.setComponentPopupMenu(pm);
      }
      pm.add(new LafParameterAction(parameter, entityId, c));
    }
  }