Example #1
0
 private void initUI() {
   tblMain.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   refresh();
   btAdd.addActionListener(
       e -> {
         PropertyForm.start(null);
         refresh();
       });
   btEdit.addActionListener(e -> editAction());
   btRemove.addActionListener(
       e -> {
         Instance instance =
             ((InstanceTableModel) tblMain.getModel()).getItem(tblMain.getSelectedRow());
         if (instance != null && !instance.isNew()) {
           int dialogButton = JOptionPane.YES_NO_OPTION;
           int dialogResult =
               JOptionPane.showConfirmDialog(null, "Remove row ?", "Confirm", dialogButton);
           if (dialogResult == 0) {
             ConfigHelper.getInstance().remove(instance);
             refresh();
           }
         }
       });
   btRun.addActionListener(e -> this.startLoad(this));
   progressBar.setMinimum(0);
   progressBar.setStringPainted(true);
   tblMain.addMouseListener(
       new MouseAdapter() {
         public void mousePressed(MouseEvent me) {
           if (me.getClickCount() == 2) {
             editAction();
           }
         }
       });
 }
Example #2
0
 private void editAction() {
   if (tblMain.getSelectedRowCount() > 0) {
     PropertyForm.start(
         ((InstanceTableModel) tblMain.getModel()).getItem(tblMain.getSelectedRow()));
     refresh();
   }
 }
 public Control createControl(Composite parent) {
   composite = new SashForm(parent, SWT.VERTICAL);
   properties.createControl(composite);
   editor.createControl(composite);
   composite.setWeights(new int[] {15, 30});
   return composite;
 }
 public void setInput(Object object) {
   selected = (XModelObject) object;
   String[] h = editor.getHelper().getHeader();
   editor.getHelper().setEntity(selected.getModelEntity(), 0);
   if (h != editor.getHelper().getHeader()) {
     if (composite != null) {
       editor.getControl().dispose();
       editor.createControl(composite);
       composite.setWeights(new int[] {15, 30});
       composite.update();
       composite.layout();
     }
   }
   editor.setObject(selected);
   editor.update();
   properties.setInput(selected);
 }
 public void update() {
   editor.update();
   properties.update();
 }
 public void dispose() {
   if (editor != null) editor.dispose();
   editor = null;
   if (properties != null) properties.dispose();
   properties = null;
 }