예제 #1
0
  public void setView(AddElement view) {
    if (activeView != null) addElementPanel.remove(activeView);
    if (view == null) System.out.println("view is null");
    addElementPanel.add(view);
    addElementPanel.setVisible(false);

    view.reset();
    activeView = view;
    callback = null;
  }
예제 #2
0
 public void actionPerformed(ActionEvent event) {
   int action = Integer.parseInt(event.getActionCommand());
   switch (action) {
     case DELETE:
       model.removeAll(java.util.Arrays.asList(list.getSelectedValues()));
       break;
     case ADD:
       if (callback != null) callback.actionPerformed(event);
       else {
         activeView.reset();
         activeView.init(activeElement);
         addElementPanel.setVisible(true);
       }
       break;
     case CANCEL:
       addElementPanel.setVisible(false);
       break;
     case ADD_ELEMENT:
       if (activeView != null) model.add(activeView.getElement());
       break;
   }
 }
예제 #3
0
 public void setCallback(ActionListener callback) {
   this.callback = callback;
   activeView.setVisible(false);
 }