1 19 20 21 package org.netbeans.core.windows; 22 23 24 import org.netbeans.core.windows.persistence.GroupConfig; 25 import org.netbeans.core.windows.persistence.ModeConfig; 26 import org.netbeans.core.windows.persistence.TCRefConfig; 27 import org.netbeans.core.windows.persistence.WindowManagerConfig; 28 29 import java.awt.*; 30 import java.util.ArrayList ; 31 import java.util.List ; 32 33 34 40 abstract class ConfigFactory { 41 42 private static final int VERTICAL = Constants.VERTICAL; 44 private static final int HORIZONTAL = Constants.HORIZONTAL; 45 46 47 private ConfigFactory() { 48 } 49 50 51 public static WindowManagerConfig createDefaultConfig() { 52 WindowManagerConfig wmc = new WindowManagerConfig(); 53 wmc.xJoined = 100; 54 wmc.yJoined = 100; 55 wmc.widthJoined = 800; 56 wmc.heightJoined = 600; 57 wmc.relativeXJoined = -1; 58 wmc.relativeYJoined = -1; 59 wmc.relativeWidthJoined = -1; 60 wmc.relativeHeightJoined = -1; 61 wmc.centeredHorizontallyJoined = false; 62 wmc.centeredVerticallyJoined = false; 63 wmc.maximizeIfWidthBelowJoined = -1; 64 wmc.maximizeIfHeightBelowJoined = -1; 65 66 wmc.editorAreaState = Constants.EDITOR_AREA_JOINED; 67 wmc.editorAreaConstraints = createDefaultEditorAreaConstraints(); 68 wmc.editorAreaBounds = null; 69 wmc.editorAreaRelativeBounds = null; 70 71 wmc.screenSize = new Dimension(1024, 750); 72 wmc.activeModeName = "editor"; wmc.editorMaximizedModeName = ""; 74 wmc.viewMaximizedModeName = ""; 75 wmc.toolbarConfiguration = "Standard"; wmc.preferredToolbarIconSize = 24; 77 wmc.modes = createDefaultModeConfigs(); 78 wmc.groups = createDefaultGroupConfigs(); 79 return wmc; 80 } 81 82 83 private static SplitConstraint[] createDefaultEditorAreaConstraints() { 84 return new SplitConstraint[] { 85 new SplitConstraint(HORIZONTAL, 1, 0.75D), 86 new SplitConstraint(VERTICAL, 0, 0.75D), 87 new SplitConstraint(HORIZONTAL, 0, 0.75D) 88 }; 89 } 90 91 92 private static ModeConfig[] createDefaultModeConfigs() { 93 List <ModeConfig> l = new ArrayList <ModeConfig>(); 94 l.add(createDefaultExplorerModeConfig()); 95 l.add(createDefaultPropertiesModeConfig()); 96 l.add(createDefaultEditorModeConfig()); 97 l.add(createDefaultOutputModeConfig()); 98 l.add(createDefaultFormModeConfig()); 99 return l.toArray(new ModeConfig[0]); 100 } 101 102 private static ModeConfig createDefaultExplorerModeConfig() { 103 ModeConfig mc = new ModeConfig(); 104 mc.name = "explorer"; mc.bounds = null; 106 mc.relativeBounds = null; 107 mc.frameState = -1; 108 mc.state = Constants.MODE_STATE_JOINED; 109 mc.kind = Constants.MODE_KIND_VIEW; 110 mc.constraints = createDefaultExplorerConstraints(); 111 mc.selectedTopComponentID = "runtime"; mc.permanent = true; 113 mc.tcRefConfigs = createDefaultExplorerTCRefConfigs(); 114 return mc; 115 } 116 117 118 private static SplitConstraint[] createDefaultExplorerConstraints() { 119 return new SplitConstraint[] { 120 new SplitConstraint(HORIZONTAL, 0, 0.30D), 121 new SplitConstraint(VERTICAL, 0, 0.70D) 122 }; 123 } 124 125 private static TCRefConfig[] createDefaultExplorerTCRefConfigs() { 126 List <TCRefConfig> tcRefConfigs = new ArrayList <TCRefConfig>(); 127 tcRefConfigs.add(createDefaultRuntimeTCRefConfig()); 128 return tcRefConfigs.toArray(new TCRefConfig[0]); 129 } 130 131 private static TCRefConfig createDefaultRuntimeTCRefConfig() { 132 TCRefConfig tcrc = new TCRefConfig(); 133 tcrc.tc_id = "runtime"; tcrc.opened = true; 135 return tcrc; 136 } 137 138 private static ModeConfig createDefaultPropertiesModeConfig() { 139 ModeConfig mc = new ModeConfig(); 140 mc.name = "properties"; mc.bounds = null; 142 mc.relativeBounds = null; 143 mc.frameState = -1; 144 mc.state = Constants.MODE_STATE_JOINED; 145 mc.kind = Constants.MODE_KIND_VIEW; 146 mc.constraints = createDefaultPropertiesConstraints(); 147 mc.selectedTopComponentID = "properties"; mc.permanent = true; 149 mc.tcRefConfigs = createDefaultPropertiesTCRefConfigs(); 150 return mc; 151 } 152 153 154 private static SplitConstraint[] createDefaultPropertiesConstraints() { 155 return new SplitConstraint[] { 156 new SplitConstraint(HORIZONTAL, 0, 0.30D), 157 new SplitConstraint(VERTICAL, 1, 0.30D) 158 }; 159 } 160 161 private static TCRefConfig[] createDefaultPropertiesTCRefConfigs() { 162 List <TCRefConfig> tcRefConfigs = new ArrayList <TCRefConfig>(); 163 tcRefConfigs.add(createDefaultPropertiesTCRefConfig()); 164 return tcRefConfigs.toArray(new TCRefConfig[0]); 165 } 166 167 private static TCRefConfig createDefaultPropertiesTCRefConfig() { 168 TCRefConfig tcrc = new TCRefConfig(); 169 tcrc.tc_id = "properties"; tcrc.opened = true; 171 return tcrc; 172 } 173 174 private static ModeConfig createDefaultEditorModeConfig() { 175 ModeConfig mc = new ModeConfig(); 176 mc.name = "editor"; 177 mc.bounds = null; 178 mc.relativeBounds = null; 179 mc.frameState = -1; 180 mc.state = Constants.MODE_STATE_JOINED; 181 mc.kind = Constants.MODE_KIND_EDITOR; 182 mc.constraints = createDefaultEditorConstraints(); 183 mc.selectedTopComponentID = null; 184 mc.permanent = true; 185 mc.tcRefConfigs = createDefaultEditorTCRefConfigs(); 186 return mc; 187 } 188 189 190 private static SplitConstraint[] createDefaultEditorConstraints() { 191 return new SplitConstraint[] {}; 192 } 193 194 private static TCRefConfig[] createDefaultEditorTCRefConfigs() { 195 List <TCRefConfig> tcRefConfigs = new ArrayList <TCRefConfig>(); 196 tcRefConfigs.add(createDefaultWelcomeTCRefConfig()); 197 return tcRefConfigs.toArray(new TCRefConfig[0]); 198 } 199 200 private static TCRefConfig createDefaultWelcomeTCRefConfig() { 201 TCRefConfig tcrc = new TCRefConfig(); 202 tcrc.tc_id = "Welcome"; tcrc.opened = true; 204 return tcrc; 205 } 206 207 private static ModeConfig createDefaultOutputModeConfig() { 208 ModeConfig mc = new ModeConfig(); 209 mc.name = "output"; 210 mc.bounds = null; 211 mc.relativeBounds = null; 212 mc.frameState = -1; 213 mc.state = Constants.MODE_STATE_JOINED; 214 mc.kind = Constants.MODE_KIND_VIEW; 215 mc.constraints = createDefaultOutputConstraints(); 216 mc.selectedTopComponentID = null; 217 mc.permanent = true; 218 mc.tcRefConfigs = createDefaultOutputTCRefConfigs(); 219 return mc; 220 } 221 222 223 private static SplitConstraint[] createDefaultOutputConstraints() { 224 return new SplitConstraint[] { 225 new SplitConstraint(HORIZONTAL, 1, 0.70D), 226 new SplitConstraint(VERTICAL, 1, 0.20D), 227 new SplitConstraint(HORIZONTAL, 0, 0.80D) 228 }; 229 } 230 231 private static TCRefConfig[] createDefaultOutputTCRefConfigs() { 232 List <TCRefConfig> tcRefConfigs = new ArrayList <TCRefConfig>(); 233 tcRefConfigs.add(createDefaultOutputTCRefConfig()); 234 return tcRefConfigs.toArray(new TCRefConfig[0]); 235 } 236 237 private static TCRefConfig createDefaultOutputTCRefConfig() { 238 TCRefConfig tcrc = new TCRefConfig(); 239 tcrc.tc_id = "output"; tcrc.opened = true; 241 return tcrc; 242 } 243 244 private static ModeConfig createDefaultFormModeConfig() { 245 ModeConfig mc = new ModeConfig(); 246 mc.name = "Form"; 247 mc.bounds = null; 248 mc.relativeBounds = null; 249 mc.frameState = -1; 250 mc.state = Constants.MODE_STATE_JOINED; 251 mc.kind = Constants.MODE_KIND_VIEW; 252 mc.constraints = createDefaultFormConstraints(); 253 mc.selectedTopComponentID = "ComponentInspector"; mc.permanent = true; 255 mc.tcRefConfigs = createDefaultFormTCRefConfigs(); 256 return mc; 257 } 258 259 260 private static SplitConstraint[] createDefaultFormConstraints() { 261 return new SplitConstraint[] { 262 new SplitConstraint(HORIZONTAL, 1, 0.70D), 263 new SplitConstraint(VERTICAL, 0, 0.80D), 264 new SplitConstraint(HORIZONTAL, 1, 0.50D) 265 }; 266 } 267 268 private static TCRefConfig[] createDefaultFormTCRefConfigs() { 269 List <TCRefConfig> tcRefConfigs = new ArrayList <TCRefConfig>(); 270 tcRefConfigs.add(createDefaultComponentInspectorTCRefConfig()); 271 tcRefConfigs.add(createDefaultComponentPaletteTCRefConfig()); 272 return tcRefConfigs.toArray(new TCRefConfig[0]); 273 } 274 275 private static TCRefConfig createDefaultComponentInspectorTCRefConfig() { 276 TCRefConfig tcrc = new TCRefConfig(); 277 tcrc.tc_id = "ComponentInspector"; tcrc.opened = true; 279 return tcrc; 280 } 281 282 private static TCRefConfig createDefaultComponentPaletteTCRefConfig() { 283 TCRefConfig tcrc = new TCRefConfig(); 284 tcrc.tc_id = "CommonPalette"; tcrc.opened = true; 286 tcrc.dockedInMaximizedMode = true; 287 return tcrc; 288 } 289 290 291 292 private static GroupConfig[] createDefaultGroupConfigs() { 293 List <GroupConfig> l = new ArrayList <GroupConfig>(); 294 return l.toArray(new GroupConfig[0]); 296 } 297 298 299 } 300 | Popular Tags |