001: /*
002: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
007: *
008: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
009: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
010: * the license for the specific language governing your rights and limitations.
011: *
012: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
013: */
014: package org.pentaho.reportdesigner.crm.report.tests;
015:
016: import org.jetbrains.annotations.NotNull;
017: import org.jetbrains.annotations.Nullable;
018:
019: import java.awt.geom.Rectangle2D;
020: import java.util.ArrayList;
021:
022: /**
023: * User: Martin
024: * Date: 11.02.2007
025: * Time: 13:56:46
026: */
027: @SuppressWarnings({"ALL"})
028: public class NullTest {
029: @NotNull
030: private A a;
031: @NotNull
032: private D d;
033:
034: @NotNull
035: private Rectangle2D.Double sr;
036:
037: @Nullable
038: private Rectangle2D.Double c1;
039: @Nullable
040: private Rectangle2D.Double c2;
041: @Nullable
042: private Rectangle2D.Double c3;
043: @Nullable
044: private Rectangle2D.Double c4;
045:
046: @Nullable
047: private Rectangle2D.Double e1;
048: @Nullable
049: private Rectangle2D.Double e2;
050: @Nullable
051: private Rectangle2D.Double e3;
052: @Nullable
053: private Rectangle2D.Double e4;
054:
055: public void updateSelectionRects() {
056: ArrayList<C> sel = d.x();
057: ArrayList<C> sel2 = new ArrayList<C>();
058:
059: for (C c : sel) {
060: if (c.e(a.g())) {
061: sel2.add(c);
062: }
063: }
064:
065: if (!sel2.isEmpty()) {
066: sr = null;
067:
068: boolean hl = false;
069: boolean vl = false;
070:
071: //if 1
072: if (sel2.size() == 1) {
073: C c = null;
074: if (c instanceof F) {
075: F f = (F) c;
076: if (null == null) {
077: } else if (f.h() == LD.A
078: && f.getS().getWidth() == 0) {
079: }
080: }
081: }
082:
083: //if 2
084: if (null == null) {
085: }
086:
087: double sf = 0;
088:
089: if (!hl && !vl) {
090: c1 = new Rectangle2D.Double(sr.x - 2 / sf, sr.y - 2
091: / sf, 5 / sf, 5 / sf);
092: c2 = new Rectangle2D.Double(sr.x + sr.width - 2 / sf,
093: sr.y - 2 / sf, 5 / sf, 5 / sf);
094: c3 = new Rectangle2D.Double(sr.x + sr.width - 2 / sf,
095: sr.y + sr.height - 2 / sf, 5 / sf, 5 / sf);
096: c4 = new Rectangle2D.Double(sr.x - 2 / sf, sr.y
097: + sr.height - 2 / sf, 5 / sf, 5 / sf);
098: }
099:
100: if (!hl) {
101: e1 = new Rectangle2D.Double(sr.x + sr.width / 2 - 2
102: / sf, sr.y - 2 / sf, 5 / sf, 5 / sf);
103: e3 = new Rectangle2D.Double(sr.x + sr.width / 2 - 2
104: / sf, sr.y + sr.height - 2 / sf, 5 / sf, 5 / sf);
105: }
106:
107: if (!vl) {
108: e2 = new Rectangle2D.Double(sr.x + sr.width - 2 / sf,
109: sr.y + sr.height / 2 - 2 / sf, 5 / sf, 5 / sf);
110: e4 = new Rectangle2D.Double(sr.x - 2 / sf, sr.y
111: + sr.height / 2 - 2 / sf, 5 / sf, 5 / sf);
112: }
113: }
114: }
115:
116: private static class A {
117:
118: public B g() {
119: return null;
120: }
121: }
122:
123: private static class B {
124:
125: }
126:
127: private static class C {
128:
129: public boolean e(B b) {
130: return false;
131: }
132: }
133:
134: private static class F extends C {
135:
136: public LD h() {
137: return null;
138: }
139:
140: public Rectangle2D.Double getS() {
141: return null;
142: }
143: }
144:
145: private static class D {
146:
147: public ArrayList<C> x() {
148: return null;
149: }
150: }
151:
152: private enum LD {
153: A
154: }
155: }
|