Revision 47476 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/warning/impl/WarningSymbol.java
WarningSymbol.java | ||
---|---|---|
30 | 30 |
import java.awt.Rectangle; |
31 | 31 |
import java.awt.geom.AffineTransform; |
32 | 32 |
import java.awt.geom.Ellipse2D; |
33 |
|
|
34 | 33 |
import org.gvsig.compat.CompatLocator; |
35 |
import org.gvsig.compat.print.PrintAttributes; |
|
36 | 34 |
import org.gvsig.fmap.geom.Geometry; |
37 | 35 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
38 | 36 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol; |
... | ... | |
84 | 82 |
public void draw(Graphics2D g, AffineTransform affineTransform, |
85 | 83 |
Geometry geom, Cancellable cancel) { |
86 | 84 |
try { |
87 |
drawInsideRectangle(g, g.getTransform(), geom.getShape().getBounds(), null);
|
|
85 |
drawInsideRectangle(g, g.getTransform(), geom.getShape().getBounds()); |
|
88 | 86 |
} catch (SymbolDrawingException e) { |
89 | 87 |
// IMPOSSIBLE |
90 | 88 |
} |
91 | 89 |
} |
92 | 90 |
|
91 |
@Override |
|
93 | 92 |
public void setDrawExceptionType(int symbolDrawExceptionType) { |
94 | 93 |
this.exceptionType = symbolDrawExceptionType; |
95 | 94 |
} |
96 | 95 |
|
96 |
@Override |
|
97 | 97 |
public void setMessage(String message) { |
98 | 98 |
this.message = message; |
99 | 99 |
} |
... | ... | |
102 | 102 |
return message; |
103 | 103 |
} |
104 | 104 |
|
105 |
@Override |
|
105 | 106 |
public void drawInsideRectangle(Graphics2D g, |
106 |
AffineTransform scaleInstance, Rectangle r, |
|
107 |
PrintAttributes properties) throws SymbolDrawingException { |
|
107 |
AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
108 | 108 |
g.setClip(r); |
109 | 109 |
if (message == null) { |
110 | 110 |
message = "Symbol undrawable.\nPlease, check errors."; |
... | ... | |
146 | 146 |
double lineHeight = (r.getHeight() - 6) / messageLines.length; |
147 | 147 |
Rectangle textRect = new Rectangle((int) r.getMinX(), |
148 | 148 |
(int) r.getMinY() + 6, (int) r.getWidth(), (int) lineHeight); |
149 |
for (int i = 0; i < messageLines.length; i++) {
|
|
150 |
text.setText(messageLines[i]);
|
|
151 |
text.drawInsideRectangle(g, null, textRect, null);
|
|
152 |
textRect.setLocation((int) r.getX(), (int) (r.getY() + r
|
|
153 |
.getHeight()));
|
|
154 |
}
|
|
149 |
for (String messageLine : messageLines) {
|
|
150 |
text.setText(messageLine);
|
|
151 |
text.drawInsideRectangle(g, null, textRect);
|
|
152 |
textRect.setLocation((int) r.getX(), (int) (r.getY() + r
|
|
153 |
.getHeight()));
|
|
154 |
}
|
|
155 | 155 |
} |
156 | 156 |
|
157 |
@Override |
|
157 | 158 |
public Object clone() throws CloneNotSupportedException { |
158 | 159 |
WarningSymbol copy = (WarningSymbol) super.clone(); |
159 | 160 |
|
... | ... | |
179 | 180 |
this.exceptionType = exceptionType; |
180 | 181 |
} |
181 | 182 |
|
183 |
@Override |
|
182 | 184 |
public void loadFromState(PersistentState state) |
183 | 185 |
throws PersistenceException { |
184 | 186 |
setDescription(state.getString(FIELD_DESCRIPTION)); |
... | ... | |
186 | 188 |
setMessage(state.getString(FIELD_MESSAGE)); |
187 | 189 |
} |
188 | 190 |
|
191 |
@Override |
|
189 | 192 |
public void saveToState(PersistentState state) throws PersistenceException { |
190 | 193 |
state.set(FIELD_DESCRIPTION, getDescription()); |
191 | 194 |
state.set(FIELD_EXCEPTION_TYPE, getExceptionType()); |
... | ... | |
194 | 197 |
|
195 | 198 |
public static class RegisterPersistence implements Callable { |
196 | 199 |
|
200 |
@Override |
|
197 | 201 |
public Object call() throws Exception { |
198 | 202 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
199 | 203 |
if( manager.getDefinition(WARNING_SYMBOL_PERSISTENCE_DEFINITION_NAME)==null ) { |
... | ... | |
218 | 222 |
|
219 | 223 |
public static class RegisterSymbol implements Callable { |
220 | 224 |
|
225 |
@Override |
|
221 | 226 |
public Object call() throws Exception { |
222 | 227 |
SymbolManager manager = MapContextLocator.getSymbolManager(); |
223 | 228 |
|
Also available in: Unified diff