01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.legend.ui;
18:
19: import java.awt.Color;
20: import java.io.IOException;
21: import java.net.URL;
22:
23: import net.refractions.udig.catalog.IGeoResource;
24: import net.refractions.udig.project.StyleContent;
25:
26: import org.eclipse.core.runtime.IProgressMonitor;
27: import org.eclipse.ui.IMemento;
28:
29: public class LegendStyleContent extends StyleContent {
30:
31: public static final String ID = "net.refractions.udig.legend.legendStyle"; //$NON-NLS-1$
32:
33: public LegendStyleContent() {
34: super (ID);
35: }
36:
37: @Override
38: public Class getStyleClass() {
39: return LegendStyle.class;
40: }
41:
42: @Override
43: public void save(IMemento momento, Object value) {
44: }
45:
46: @Override
47: public Object load(IMemento momento) {
48: return null;
49: }
50:
51: @Override
52: public Object load(URL url, IProgressMonitor monitor)
53: throws IOException {
54: return null;
55: }
56:
57: @Override
58: public Object createDefaultStyle(IGeoResource resource,
59: Color colour, IProgressMonitor monitor) throws IOException {
60: if (!resource.canResolve(LegendGraphic.class))
61: return null;
62: return createDefault();
63: }
64:
65: public static LegendStyle createDefault() {
66: LegendStyle style = new LegendStyle();
67:
68: style.verticalMargin = 3;
69: style.horizontalMargin = 2;
70: style.verticalSpacing = 5;
71: style.horizontalSpacing = 3;
72: style.indentSize = 10;
73: style.imageHeight = 16;
74: style.imageWidth = 16;
75: style.maxWidth = -1;
76: style.maxHeight = -1;
77:
78: style.foregroundColour = Color.BLACK;
79: style.backgroundColour = Color.WHITE;
80:
81: return style;
82: }
83: }
|