1 19 package org.netbeans.modules.j2ee.sun.share.config.ui; 20 21 import java.io.*; 22 import java.util.*; 23 import java.awt.*; 24 import java.beans.*; 25 import java.text.MessageFormat ; 26 import javax.swing.border.LineBorder ; 27 import javax.swing.event.ChangeListener ; 28 import javax.swing.event.ListSelectionEvent ; 29 import javax.swing.event.ListSelectionListener ; 30 import javax.swing.*; 31 import javax.swing.table.TableColumn ; 32 import javax.swing.undo.CannotRedoException ; 33 import javax.swing.undo.CannotUndoException ; 34 35 import org.openide.*; 36 import org.openide.nodes.*; 37 import org.openide.explorer.*; 38 import org.openide.explorer.propertysheet.*; 39 import org.openide.explorer.view.BeanTreeView; 40 import org.openide.windows.*; 41 import org.openide.util.HelpCtx; 42 import org.openide.util.SharedClassObject; 43 import org.openide.util.Utilities; 44 45 46 53 54 public class PaneledDesignEditor extends AbstractDesignEditor { 55 56 public static final int CONTENT_RIGHT = 0; 57 public static final int CONTENT_LEFT = 1; 58 59 60 public static final int DEFAULT_STRUCTURE_WIDTH = 170; 61 62 public static final int DEFAULT_STRUCTURE_HEIGHT = 300; 63 64 public static final int DEFAULT_STRUCTURE_SPLIT = 500; 65 public static final int DEFAULT_CONTENT_SPLIT = 150; 66 67 protected static EmptyInspectorNode emptyInspectorNode; 68 69 70 private static final String EMPTY_INSPECTOR_ICON_BASE = 71 "/org/netbeans/modules/form/resources/emptyInspector"; 73 74 75 protected JSplitPane split1; 76 protected JSplitPane split2; 77 protected int panelOrientation; 78 79 80 protected static String iconURL = "/org/netbeans/modules/form/resources/inspector.gif"; 82 protected static final long serialVersionUID =1L; 83 84 85 protected PaneledDesignEditor(){ 86 } 87 92 public PaneledDesignEditor(PanelView panel){ 93 contentView = panel; 94 contentView.setPreferredSize(new Dimension(DEFAULT_WIDTH,DEFAULT_HEIGHT)); 95 initComponents(); 96 setRootContext(panel.getRoot()); 97 } 98 99 105 public PaneledDesignEditor(PanelView panel, int orientation){ 106 contentView = panel; 107 contentView.setPreferredSize(new Dimension(DEFAULT_WIDTH,DEFAULT_HEIGHT)); 108 panelOrientation = orientation; 109 initComponents(); 110 setRootContext(panel.getRoot()); 111 } 112 119 120 public PaneledDesignEditor(PanelView panel, JComponent structure){ 121 contentView = panel; 122 contentView.setPreferredSize(new Dimension(DEFAULT_WIDTH,DEFAULT_HEIGHT)); 123 structureView = structure; 124 initComponents(); 125 setRootContext(panel.getRoot()); 126 } 127 135 136 public PaneledDesignEditor(PanelView panel, JComponent structure, int orientation){ 137 contentView = panel; 138 contentView.setPreferredSize(new Dimension(DEFAULT_WIDTH,DEFAULT_HEIGHT)); 139 panelOrientation = orientation; 140 structureView = structure; 141 initComponents(); 142 setRootContext(panel.getRoot()); 143 } 144 145 146 protected void initComponents() { 147 super.initComponents(); 148 createVerticalSplit(); 149 createHorizontalSplit(); 150 add(BorderLayout.CENTER, split1); 151 152 153 } 154 155 protected void createHorizontalSplit() { 156 if (panelOrientation == 1) 157 split1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,getContentView(), split2); 158 else 159 split1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,split2, getContentView()); 160 split1.setOneTouchExpandable(true); 162 163 } 164 165 protected void createVerticalSplit() { 166 split2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT,getStructureView(),getPropertiesView()); 167 split2.setPreferredSize(new Dimension(200,400)); 168 split2.setMinimumSize(new Dimension(100,100)); 169 split2.setOneTouchExpandable(true); 170 split2.setDividerLocation(DEFAULT_STRUCTURE_SPLIT); 171 } 172 173 174 175 179 public JComponent getStructureView(){ 180 if (structureView ==null){ 181 structureView = createStructureComponent(); 182 structureView.getAccessibleContext().setAccessibleName("ACS_StructureView"); 183 structureView.getAccessibleContext().setAccessibleDescription("ACSD_StructureView"); 184 structureView.setMinimumSize(new Dimension(100,100)); 185 structureView.setPreferredSize(new Dimension(DEFAULT_STRUCTURE_WIDTH ,DEFAULT_STRUCTURE_HEIGHT )); 186 } 187 return structureView; 188 } 189 193 public JComponent createStructureComponent() { 194 return new BeanTreeView(); 195 } 196 197 201 202 public JComponent getPropertiesView(){ 203 if (propertiesView == null){ 204 propertiesView = createPropertiesComponent(); 205 propertiesView.addPropertyChangeListener(new PropertiesDisplayListener()); 206 propertiesView.setMinimumSize(new Dimension(100,100)); 207 propertiesView.setPreferredSize(new Dimension(100,100)); 208 } 209 return propertiesView; 210 } 211 212 216 public JComponent createPropertiesComponent() { 217 return new PropertySheetView(); 218 } 219 } 220 | Popular Tags |