1 19 20 21 package org.netbeans.core.windows.persistence; 22 23 24 import org.netbeans.core.windows.SplitConstraint; 25 26 import java.awt.*; 27 28 29 35 public class WindowManagerConfig { 36 44 public boolean centeredHorizontallySeparated; 45 46 48 public boolean centeredVerticallySeparated; 49 50 51 public int xSeparated; 52 53 54 public int ySeparated; 55 56 58 public int widthSeparated; 59 60 62 public int heightSeparated; 63 64 65 public float relativeXSeparated; 66 67 68 public float relativeYSeparated; 69 70 71 public float relativeWidthSeparated; 72 73 74 public float relativeHeightSeparated; 75 79 87 public boolean centeredHorizontallyJoined; 88 89 91 public boolean centeredVerticallyJoined; 92 93 94 public int xJoined; 95 96 97 public int yJoined; 98 99 101 public int widthJoined; 102 103 105 public int heightJoined; 106 107 108 public float relativeXJoined; 109 110 111 public float relativeYJoined; 112 113 114 public float relativeWidthJoined; 115 116 117 public float relativeHeightJoined; 118 119 120 public int maximizeIfWidthBelowJoined; 121 122 123 public int maximizeIfHeightBelowJoined; 124 135 public int mainWindowFrameStateJoined; 136 144 public int mainWindowFrameStateSeparated; 145 146 147 public int editorAreaState; 148 150 public SplitConstraint[] editorAreaConstraints; 151 152 public Rectangle editorAreaBounds; 153 154 public Rectangle editorAreaRelativeBounds; 155 163 public int editorAreaFrameState; 164 165 166 public Dimension screenSize; 167 168 public String activeModeName; 169 170 public String editorMaximizedModeName; 171 172 public String viewMaximizedModeName; 173 174 public String toolbarConfiguration; 175 176 public int preferredToolbarIconSize; 177 178 public ModeConfig[] modes; 179 180 public GroupConfig[] groups; 181 182 public String [] tcIdViewList; 183 184 185 public WindowManagerConfig() { 186 editorAreaConstraints = new SplitConstraint[0]; 187 activeModeName = ""; editorMaximizedModeName = ""; viewMaximizedModeName = ""; toolbarConfiguration = ""; modes = new ModeConfig[0]; 192 groups = new GroupConfig[0]; 193 tcIdViewList = new String [0]; 194 } 195 196 public boolean equals (Object obj) { 197 if (this == obj) { 198 return true; 199 } 200 if (!(obj instanceof WindowManagerConfig)) { 201 return false; 202 } 203 WindowManagerConfig wmCfg = (WindowManagerConfig) obj; 204 if ((centeredHorizontallySeparated != wmCfg.centeredHorizontallySeparated) || 205 (centeredVerticallySeparated != wmCfg.centeredVerticallySeparated)) { 206 return false; 207 } 208 if ((xSeparated != wmCfg.xSeparated) || 209 (ySeparated != wmCfg.ySeparated) || 210 (widthSeparated != wmCfg.widthSeparated) || 211 (heightSeparated != wmCfg.heightSeparated)) { 212 return false; 213 } 214 if ((relativeXSeparated != wmCfg.relativeXSeparated) || 215 (relativeYSeparated != wmCfg.relativeYSeparated)) { 216 return false; 217 } 218 if ((relativeWidthSeparated != wmCfg.relativeWidthSeparated) || 219 (relativeHeightSeparated != wmCfg.relativeHeightSeparated)) { 220 return false; 221 } 222 223 if ((centeredHorizontallyJoined != wmCfg.centeredHorizontallyJoined) || 224 (centeredVerticallyJoined != wmCfg.centeredVerticallyJoined)) { 225 return false; 226 } 227 if ((xJoined != wmCfg.xJoined) || 228 (yJoined != wmCfg.yJoined) || 229 (widthJoined != wmCfg.widthJoined) || 230 (heightJoined != wmCfg.heightJoined)) { 231 return false; 232 } 233 if ((relativeXJoined != wmCfg.relativeXJoined) || 234 (relativeYJoined != wmCfg.relativeYJoined)) { 235 return false; 236 } 237 if ((relativeWidthJoined != wmCfg.relativeWidthJoined) || 238 (relativeHeightJoined != wmCfg.relativeHeightJoined)) { 239 return false; 240 } 241 if ((maximizeIfWidthBelowJoined != wmCfg.maximizeIfWidthBelowJoined) || 242 (maximizeIfHeightBelowJoined != wmCfg.maximizeIfHeightBelowJoined)) { 243 return false; 244 } 245 246 if (mainWindowFrameStateJoined != wmCfg.mainWindowFrameStateJoined) { 247 return false; 248 } 249 if (mainWindowFrameStateSeparated != wmCfg.mainWindowFrameStateSeparated) { 250 return false; 251 } 252 if (editorAreaState != wmCfg.editorAreaState) { 253 return false; 254 } 255 if (editorAreaConstraints.length != wmCfg.editorAreaConstraints.length) { 257 return false; 258 } 259 for (int i = 0; i < editorAreaConstraints.length; i++) { 260 if (!editorAreaConstraints[i].equals(wmCfg.editorAreaConstraints[i])) { 261 return false; 262 } 263 } 264 if ((editorAreaBounds != null) && (wmCfg.editorAreaBounds != null)) { 265 if (!editorAreaBounds.equals(wmCfg.editorAreaBounds)) { 266 return false; 267 } 268 } else if ((editorAreaBounds != null) || (wmCfg.editorAreaBounds != null)) { 269 return false; 270 } 271 if ((editorAreaRelativeBounds != null) && (wmCfg.editorAreaRelativeBounds != null)) { 272 if (!editorAreaRelativeBounds.equals(wmCfg.editorAreaRelativeBounds)) { 273 return false; 274 } 275 } else if ((editorAreaRelativeBounds != null) || (wmCfg.editorAreaRelativeBounds != null)) { 276 return false; 277 } 278 if (editorAreaFrameState != wmCfg.editorAreaFrameState) { 279 return false; 280 } 281 if ((screenSize != null) && (wmCfg.screenSize != null)) { 282 if (!screenSize.equals(wmCfg.screenSize)) { 283 return false; 284 } 285 } else if ((screenSize != null) || (wmCfg.screenSize != null)) { 286 return false; 287 } 288 if (!activeModeName.equals(wmCfg.activeModeName)) { 289 return false; 290 } 291 if (!editorMaximizedModeName.equals(wmCfg.editorMaximizedModeName)) { 292 return false; 293 } 294 if (!viewMaximizedModeName.equals(wmCfg.viewMaximizedModeName)) { 295 return false; 296 } 297 if (!toolbarConfiguration.equals(wmCfg.toolbarConfiguration)) { 298 return false; 299 } 300 if (preferredToolbarIconSize != wmCfg.preferredToolbarIconSize) { 301 return false; 302 } 303 if (modes.length != wmCfg.modes.length) { 305 return false; 306 } 307 for (int i = 0; i < modes.length; i++) { 308 ModeConfig modeCfg = null; 309 for (int j = 0; j < wmCfg.modes.length; j++) { 310 if (modes[i].name.equals(wmCfg.modes[j].name)) { 311 modeCfg = wmCfg.modes[j]; 312 break; 313 } 314 } 315 if (modeCfg == null) { 316 return false; 317 } 318 if (!modes[i].equals(modeCfg)) { 319 return false; 320 } 321 } 322 if (groups.length != wmCfg.groups.length) { 324 return false; 325 } 326 for (int i = 0; i < groups.length; i++) { 327 GroupConfig groupCfg = null; 328 for (int j = 0; j < wmCfg.groups.length; j++) { 329 if (groups[i].name.equals(wmCfg.groups[j].name)) { 330 groupCfg = wmCfg.groups[j]; 331 break; 332 } 333 } 334 if (groupCfg == null) { 335 return false; 336 } 337 if (!groups[i].equals(groupCfg)) { 338 return false; 339 } 340 } 341 if (tcIdViewList.length != wmCfg.tcIdViewList.length) { 343 return false; 344 } 345 for (int i = 0; i < tcIdViewList.length; i++) { 346 if (!tcIdViewList[i].equals(wmCfg.tcIdViewList[i])) { 347 return false; 348 } 349 } 350 return true; 351 } 352 353 public int hashCode() { 354 int hash = 17; 355 356 hash = 37 * hash + (centeredHorizontallySeparated ? 0 : 1); 357 hash = 37 * hash + (centeredVerticallySeparated ? 0 : 1); 358 hash = 37 * hash + xSeparated; 359 hash = 37 * hash + ySeparated; 360 hash = 37 * hash + widthSeparated; 361 hash = 37 * hash + heightSeparated; 362 hash = 37 * hash + Float.floatToIntBits(relativeXSeparated); 363 hash = 37 * hash + Float.floatToIntBits(relativeYSeparated); 364 hash = 37 * hash + Float.floatToIntBits(relativeWidthSeparated); 365 hash = 37 * hash + Float.floatToIntBits(relativeHeightSeparated); 366 367 hash = 37 * hash + (centeredHorizontallyJoined ? 0 : 1); 368 hash = 37 * hash + (centeredVerticallyJoined ? 0 : 1); 369 hash = 37 * hash + xJoined; 370 hash = 37 * hash + yJoined; 371 hash = 37 * hash + widthJoined; 372 hash = 37 * hash + heightJoined; 373 hash = 37 * hash + Float.floatToIntBits(relativeXJoined); 374 hash = 37 * hash + Float.floatToIntBits(relativeYJoined); 375 hash = 37 * hash + Float.floatToIntBits(relativeWidthJoined); 376 hash = 37 * hash + Float.floatToIntBits(relativeHeightJoined); 377 hash = 37 * hash + maximizeIfWidthBelowJoined; 378 hash = 37 * hash + maximizeIfHeightBelowJoined; 379 380 hash = 37 * hash + mainWindowFrameStateJoined; 381 hash = 37 * hash + mainWindowFrameStateSeparated; 382 hash = 37 * hash + editorAreaState; 383 for (int i = 0; i < editorAreaConstraints.length; i++) { 384 hash = 37 * hash + editorAreaConstraints[i].hashCode(); 385 } 386 if (editorAreaBounds != null) { 387 hash = 37 * hash + editorAreaBounds.hashCode(); 388 } 389 if (editorAreaRelativeBounds != null) { 390 hash = 37 * hash + editorAreaRelativeBounds.hashCode(); 391 } 392 hash = 37 * hash + editorAreaFrameState; 393 if (screenSize != null) { 394 hash = 37 * hash + screenSize.hashCode(); 395 } 396 hash = 37 * hash + activeModeName.hashCode(); 397 hash = 37 * hash + editorMaximizedModeName.hashCode(); 398 hash = 37 * hash + viewMaximizedModeName.hashCode(); 399 hash = 37 * hash + toolbarConfiguration.hashCode(); 400 hash = 37 * hash + preferredToolbarIconSize; 401 for (int i = 0; i < modes.length; i++) { 402 hash = 37 * hash + modes[i].hashCode(); 403 } 404 for (int i = 0; i < groups.length; i++) { 405 hash = 37 * hash + groups[i].hashCode(); 406 } 407 for (int i = 0; i < tcIdViewList.length; i++) { 408 hash = 37 * hash + tcIdViewList[i].hashCode(); 409 } 410 return hash; 411 } 412 413 } 414 | Popular Tags |