KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > editor > SplitEditor


1 package com.opensymphony.workflow.designer.editor;
2
3 import javax.swing.*;
4
5 import com.jgoodies.forms.layout.FormLayout;
6 import com.jgoodies.forms.layout.CellConstraints;
7 import com.jgoodies.forms.builder.PanelBuilder;
8 import com.opensymphony.workflow.designer.SplitCell;
9 import com.opensymphony.workflow.designer.UIFactory;
10 import com.opensymphony.workflow.designer.ResourceManager;
11 import com.opensymphony.workflow.designer.model.ResultsTableModel;
12
13 public class SplitEditor extends DetailPanel
14 {
15   private JTextField id = UIFactory.createReadOnlyTextField(12);
16   private ResultsTableModel resultsModel = new ResultsTableModel();
17
18   public SplitEditor()
19   {
20   }
21
22   protected void initComponents()
23   {
24     FormLayout layout = new FormLayout("2dlu, max(30dlu;pref), 2dlu, pref:grow, 4dlu", "pref, 2dlu, pref, 3dlu, pref, 2dlu, 60dlu, 2dlu");
25     PanelBuilder builder = new PanelBuilder(this, layout);
26     CellConstraints cc = new CellConstraints();
27     builder.addSeparator(ResourceManager.getString("info"), cc.xywh(2, 1, 4, 1));
28     builder.addLabel(ResourceManager.getString("id"), cc.xy(2, 3));
29     builder.add(id, cc.xy(4, 3));
30     builder.addSeparator(ResourceManager.getString("results"), cc.xywh(2, 5, 3, 1));
31     JTable actionsTable = new JTable(resultsModel);
32     builder.add(UIFactory.createTablePanel(actionsTable), cc.xywh(2, 7, 3, 1));
33   }
34
35   public String JavaDoc getTitle()
36   {
37     return ResourceManager.getString("title.split", new Object JavaDoc[]{id.getText()});
38   }
39
40   protected void updateView()
41   {
42     SplitCell cell = (SplitCell)getCell();
43     id.setText(Integer.toString(cell.getId(), 10));
44     resultsModel.setList(cell.getSplitDescriptor().getResults());
45   }
46 }
47
Popular Tags