Revision 2559
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/README.txt | ||
---|---|---|
1 |
==== |
|
2 |
gvSIG. Desktop Geographic Information System. |
|
3 |
|
|
4 |
Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
|
|
6 |
This program is free software; you can redistribute it and/or |
|
7 |
modify it under the terms of the GNU General Public License |
|
8 |
as published by the Free Software Foundation; either version 2 |
|
9 |
of the License, or (at your option) any later version. |
|
10 |
|
|
11 |
This program 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 |
|
14 |
GNU General Public License for more details. |
|
15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
|
17 |
along with this program; if not, write to the Free Software |
|
18 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
MA 02110-1301, USA. |
|
20 |
|
|
21 |
For any additional information, do not hesitate to contact us |
|
22 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
==== |
|
24 |
|
|
25 |
The first time you checkout the current project to a new workspace, |
|
26 |
you have to prepare it to be able to work easily with maven from |
|
27 |
eclipse itself. |
|
28 |
|
|
29 |
Perform the following steps: |
|
30 |
|
|
31 |
1.- Launch the *prepare-workspace.xml* ant build file. |
|
32 |
You can do it by loading the file into the ant view, |
|
33 |
and running the default task, or right-clicking the |
|
34 |
file from the package explorer or the navigator and |
|
35 |
select the option: *Run as > Ant build*. |
|
36 |
|
|
37 |
2.- Restart eclipse. |
|
38 |
|
|
39 |
3.- Import the subprojects of the project you have just checked out. |
|
40 |
|
|
41 |
Those steps are only needed once per workspace. |
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/SimpleServerManager.java | ||
---|---|---|
1 |
package org.gvsig.simplehttpserver; |
|
2 |
|
|
3 |
/** |
|
4 |
* |
|
5 |
* @author gvSIG Team |
|
6 |
*/ |
|
7 |
public interface SimpleServerManager { |
|
8 |
|
|
9 |
public SimpleServerConfig createSimpleServerConfig(); |
|
10 |
|
|
11 |
public SimpleServer createSimpleServer(SimpleServerConfig config); |
|
12 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/SimpleServer.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver; |
|
3 |
|
|
4 |
import java.net.URL; |
|
5 |
import java.util.Map; |
|
6 |
import org.gvsig.simplehttpserver.commands.Command; |
|
7 |
|
|
8 |
|
|
9 |
public interface SimpleServer { |
|
10 |
|
|
11 |
public static int INFO = 0; |
|
12 |
public static int WARN = 1; |
|
13 |
public static int DEBUG = 2; |
|
14 |
|
|
15 |
public interface LoggerListener { |
|
16 |
public void log(int level, String message); |
|
17 |
} |
|
18 |
|
|
19 |
public SimpleServerConfig getConfig(); |
|
20 |
|
|
21 |
public void start(); |
|
22 |
|
|
23 |
public void stop(); |
|
24 |
|
|
25 |
public void reload(); |
|
26 |
|
|
27 |
public boolean isStarted(); |
|
28 |
|
|
29 |
public void addLogListener(LoggerListener logger); |
|
30 |
|
|
31 |
public void removeLogListener(LoggerListener logger); |
|
32 |
|
|
33 |
public URL getURL(String path); |
|
34 |
|
|
35 |
public String getHost(); |
|
36 |
|
|
37 |
public void log(int level, String message); |
|
38 |
|
|
39 |
public Map<String, Command> getCommands(); |
|
40 |
|
|
41 |
public Command getCommand(String arg); |
|
42 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/Command.java | ||
---|---|---|
1 |
package org.gvsig.simplehttpserver.commands; |
|
2 |
|
|
3 |
import java.io.InputStream; |
|
4 |
import java.util.List; |
|
5 |
import org.apache.commons.lang3.Range; |
|
6 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
7 |
|
|
8 |
|
|
9 |
/** |
|
10 |
* |
|
11 |
* @author jjdelcerro |
|
12 |
*/ |
|
13 |
public interface Command { |
|
14 |
|
|
15 |
Object call(int argc, List<String> args, InputStream contents) throws Exception; |
|
16 |
|
|
17 |
String getMimeType(); |
|
18 |
|
|
19 |
String getName(); |
|
20 |
|
|
21 |
Range getNumArgs(); |
|
22 |
|
|
23 |
String getDescription(); |
|
24 |
|
|
25 |
SimpleServer getServer(); |
|
26 |
|
|
27 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/HelpFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver.commands; |
|
3 |
|
|
4 |
import org.apache.commons.lang3.Range; |
|
5 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
* @author gvSIG Team |
|
10 |
*/ |
|
11 |
public class HelpFactory extends AbstractCommandFactory { |
|
12 |
|
|
13 |
public HelpFactory() { |
|
14 |
super( |
|
15 |
"help", |
|
16 |
Range.between(0,1), |
|
17 |
"text/html", |
|
18 |
"help\n\n" + |
|
19 |
"Retrieve a short help of supported commands.\n" + |
|
20 |
"Use help/asjson to retrieve this help as json." |
|
21 |
); |
|
22 |
} |
|
23 |
|
|
24 |
@Override |
|
25 |
public Command create(SimpleServer server) { |
|
26 |
return new Help(this, server); |
|
27 |
} |
|
28 |
|
|
29 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/AbstractCommand.java | ||
---|---|---|
1 |
package org.gvsig.simplehttpserver.commands; |
|
2 |
|
|
3 |
import org.apache.commons.lang3.Range; |
|
4 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
5 |
import org.gvsig.simplehttpserver.SimpleServerConfig; |
|
6 |
import org.slf4j.Logger; |
|
7 |
import org.slf4j.LoggerFactory; |
|
8 |
|
|
9 |
/** |
|
10 |
* |
|
11 |
* @author gvSIG Team |
|
12 |
*/ |
|
13 |
public abstract class AbstractCommand implements Command { |
|
14 |
|
|
15 |
protected static final Logger LOG = LoggerFactory.getLogger(AbstractCommand.class); |
|
16 |
|
|
17 |
private final SimpleServer server; |
|
18 |
private final CommandFactory factory; |
|
19 |
|
|
20 |
public AbstractCommand(CommandFactory factory, SimpleServer server) { |
|
21 |
this.server = server; |
|
22 |
this.factory = factory; |
|
23 |
} |
|
24 |
|
|
25 |
protected SimpleServerConfig getConfig() { |
|
26 |
return this.server.getConfig(); |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
public SimpleServer getServer() { |
|
31 |
return this.server; |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public String getDescription() { |
|
36 |
return this.factory.getDescription().replace("${host}", this.server.getHost()); |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public String getName() { |
|
41 |
return this.factory.getName(); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
public Range getNumArgs() { |
|
46 |
return this.factory.getNumArgs(); |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public String getMimeType() { |
|
51 |
return this.factory.getMimeType(); |
|
52 |
} |
|
53 |
|
|
54 |
|
|
55 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/CommandFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver.commands; |
|
3 |
|
|
4 |
import org.apache.commons.lang3.Range; |
|
5 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
* @author jjdelcerro |
|
10 |
*/ |
|
11 |
public interface CommandFactory { |
|
12 |
|
|
13 |
String getMimeType(); |
|
14 |
|
|
15 |
String getName(); |
|
16 |
|
|
17 |
Range getNumArgs(); |
|
18 |
|
|
19 |
String getDescription(); |
|
20 |
|
|
21 |
public Command create(SimpleServer server); |
|
22 |
|
|
23 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/Help.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver.commands; |
|
3 |
|
|
4 |
import java.io.InputStream; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Map; |
|
7 |
import javax.json.Json; |
|
8 |
import javax.json.JsonArrayBuilder; |
|
9 |
import javax.json.JsonObject; |
|
10 |
import javax.json.JsonObjectBuilder; |
|
11 |
import org.apache.commons.lang3.StringUtils; |
|
12 |
import org.gvsig.htmlbuilder.HTMLBuilder; |
|
13 |
import org.gvsig.htmlbuilder.HTMLBuilder.HTMLComplexElement; |
|
14 |
import org.gvsig.simplehttpserver.SimpleServer; |
|
15 |
import org.gvsig.tools.util.ToolsUtilLocator; |
|
16 |
|
|
17 |
/** |
|
18 |
* |
|
19 |
* @author gvSIG Team |
|
20 |
*/ |
|
21 |
public class Help extends AbstractCommand { |
|
22 |
|
|
23 |
public Help(CommandFactory factory, SimpleServer server) { |
|
24 |
super(factory,server); |
|
25 |
} |
|
26 |
|
|
27 |
|
|
28 |
@Override |
|
29 |
public Object call(int argc, List<String> args, InputStream contents) { |
|
30 |
Map<String, Command> commands = this.getServer().getCommands(); |
|
31 |
if( argc>0 && StringUtils.equalsIgnoreCase("asjson", args.get(1)) ) { |
|
32 |
JsonArrayBuilder builder = Json.createArrayBuilder(); |
|
33 |
for (Command command : commands.values()) { |
|
34 |
builder.add(this.getCommandDescription(command)); |
|
35 |
} |
|
36 |
return builder.toString(); |
|
37 |
} else { |
|
38 |
HTMLBuilder builder = ToolsUtilLocator.getToolsUtilManager().createHTMLBuilder(); |
|
39 |
HTMLComplexElement table = builder.table( |
|
40 |
0,1,4, |
|
41 |
builder.thead( |
|
42 |
builder.tr( |
|
43 |
builder.th("Return type"), |
|
44 |
builder.th("Name"), |
|
45 |
builder.th("Description") |
|
46 |
) |
|
47 |
) |
|
48 |
); |
|
49 |
|
|
50 |
for (Command command : commands.values()) { |
|
51 |
HTMLComplexElement tr = builder.tr(HTMLBuilder.valign_top).contents( |
|
52 |
builder.td(command.getMimeType()), |
|
53 |
builder.td(command.getName()), |
|
54 |
builder.td( |
|
55 |
builder.plainWithNl(command.getDescription()+"\n\n") |
|
56 |
) |
|
57 |
); |
|
58 |
table.contents(tr); |
|
59 |
} |
|
60 |
return table.toHTML(); |
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 |
public JsonObject getCommandDescription(Command command) { |
|
65 |
JsonObjectBuilder builder = Json.createObjectBuilder(); |
|
66 |
builder.add("Name", command.getName()); |
|
67 |
builder.add("NumArgs", command.getNumArgs().toString()); |
|
68 |
builder.add("MimeType", StringUtils.defaultString(command.getMimeType())); |
|
69 |
builder.add("Description", StringUtils.defaultString(command.getDescription())); |
|
70 |
return builder.build(); |
|
71 |
} |
|
72 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/commands/AbstractCommandFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver.commands; |
|
3 |
|
|
4 |
import org.apache.commons.lang3.Range; |
|
5 |
|
|
6 |
/** |
|
7 |
* |
|
8 |
* @author jjdelcerro |
|
9 |
*/ |
|
10 |
public abstract class AbstractCommandFactory implements CommandFactory { |
|
11 |
|
|
12 |
private final String name; |
|
13 |
private final Range nargs; |
|
14 |
private final String mimetype; |
|
15 |
private final String description; |
|
16 |
|
|
17 |
protected AbstractCommandFactory(String name, Range nargs, String mimetype, String description) { |
|
18 |
this.name = name; |
|
19 |
this.nargs = nargs; |
|
20 |
this.mimetype = mimetype; |
|
21 |
this.description = description; |
|
22 |
} |
|
23 |
|
|
24 |
@Override |
|
25 |
public String getDescription() { |
|
26 |
return this.description; |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
public String getName() { |
|
31 |
return this.name; |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public Range getNumArgs() { |
|
36 |
return this.nargs; |
|
37 |
} |
|
38 |
|
|
39 |
@Override |
|
40 |
public String getMimeType() { |
|
41 |
return this.mimetype; |
|
42 |
} |
|
43 |
|
|
44 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/simplehttpserver/SimpleServerConfig.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.simplehttpserver; |
|
3 |
|
|
4 |
import java.beans.PropertyChangeListener; |
|
5 |
import java.net.URL; |
|
6 |
import java.util.Collection; |
|
7 |
import org.gvsig.simplehttpserver.commands.CommandFactory; |
|
8 |
import org.gvsig.tools.util.PropertiesSupport; |
|
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
* @author gvSIG Team |
|
13 |
*/ |
|
14 |
public interface SimpleServerConfig extends PropertiesSupport { |
|
15 |
|
|
16 |
public int getPort(); |
|
17 |
|
|
18 |
public int getTimeout(); |
|
19 |
|
|
20 |
public String getServerInfo(); |
|
21 |
|
|
22 |
public SimpleServerConfig setPort(int port); |
|
23 |
|
|
24 |
public SimpleServerConfig setTimeout(int timeout); |
|
25 |
|
|
26 |
public SimpleServerConfig setServerInfo(String serverInfo); |
|
27 |
|
|
28 |
public SimpleServerConfig addCommandFactory(CommandFactory factory); |
|
29 |
|
|
30 |
public void removeCommandFactory(String name); |
|
31 |
|
|
32 |
public void removeCommandFactory(CommandFactory factory); |
|
33 |
|
|
34 |
public Collection<CommandFactory> getCommandFactories(); |
|
35 |
|
|
36 |
public void addPropertyChangeListener(PropertyChangeListener listener); |
|
37 |
|
|
38 |
public void removePropertyChangeListener(PropertyChangeListener listener); |
|
39 |
|
|
40 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/InformationBuilder.java | ||
---|---|---|
1 |
package org.gvsig.tools.util; |
|
2 |
|
|
3 |
public interface InformationBuilder { |
|
4 |
|
|
5 |
public interface Element { |
|
6 |
|
|
7 |
public Element value(String format, Object... args); |
|
8 |
public String build(); |
|
9 |
} |
|
10 |
|
|
11 |
public interface TitleElement extends Element { |
|
12 |
|
|
13 |
@Override |
|
14 |
public TitleElement value(String format, Object... args); |
|
15 |
public TitleElement label(String label); |
|
16 |
public TitleElement labelkey(String labelkey); |
|
17 |
} |
|
18 |
|
|
19 |
public interface RawElement extends Element { |
|
20 |
|
|
21 |
@Override |
|
22 |
public RawElement value(String format, Object... args); |
|
23 |
} |
|
24 |
|
|
25 |
public interface TextElement extends RawElement { |
|
26 |
|
|
27 |
@Override |
|
28 |
public TextElement value(String format, Object... args); |
|
29 |
|
|
30 |
} |
|
31 |
|
|
32 |
public interface PropertyElement extends TextElement { |
|
33 |
|
|
34 |
public PropertyElement monospace(); |
|
35 |
|
|
36 |
public PropertyElement label(String label); |
|
37 |
|
|
38 |
public PropertyElement labelkey(String labelkey); |
|
39 |
|
|
40 |
@Override |
|
41 |
public PropertyElement value(String format, Object... args); |
|
42 |
|
|
43 |
} |
|
44 |
|
|
45 |
public InformationBuilder backgroundColor(String color); |
|
46 |
|
|
47 |
public InformationBuilder backgroundColorTitle(String color); |
|
48 |
|
|
49 |
public InformationBuilder backgroundColorPropertyLabel(String color); |
|
50 |
|
|
51 |
public InformationBuilder backgroundColorPropertyValue1(String color); |
|
52 |
|
|
53 |
public InformationBuilder backgroundColorPropertyValue2(String color); |
|
54 |
|
|
55 |
public TitleElement title(); |
|
56 |
|
|
57 |
public PropertyElement property(); |
|
58 |
|
|
59 |
public TextElement text(); |
|
60 |
|
|
61 |
public RawElement raw(); |
|
62 |
|
|
63 |
public String build(); |
|
64 |
|
|
65 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/ToolsUtilLocator.java | ||
---|---|---|
1 |
package org.gvsig.tools.util; |
|
2 |
|
|
3 |
/** |
|
4 |
* gvSIG. Desktop Geographic Information System. |
|
5 |
* |
|
6 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
9 |
* the terms of the GNU General Public License as published by the Free Software |
|
10 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
11 |
* version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
14 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
15 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
16 |
* details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License along with |
|
19 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
20 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
21 |
* |
|
22 |
* For any additional information, do not hesitate to contact us at info AT |
|
23 |
* gvsig.com, or visit our website www.gvsig.com. |
|
24 |
*/ |
|
25 |
|
|
26 |
import org.gvsig.configurableactions.ConfigurableActionsMamager; |
|
27 |
import org.gvsig.euclidean.EuclideanManager; |
|
28 |
import org.gvsig.filedialogchooser.FileDialogChooserManager; |
|
29 |
import org.gvsig.imageviewer.ImageViewerManager; |
|
30 |
import org.gvsig.propertypage.PropertiesPageManager; |
|
31 |
import org.gvsig.svgsupport.SVGSupportManager; |
|
32 |
import org.gvsig.texteditor.TextEditorManager; |
|
33 |
import org.gvsig.tools.locator.AbstractLocator; |
|
34 |
import org.gvsig.tools.locator.Locator; |
|
35 |
import org.gvsig.tools.locator.LocatorException; |
|
36 |
import org.gvsig.webbrowser2.WebBrowserManager; |
|
37 |
import org.gvsig.json.JsonManager; |
|
38 |
import org.gvsig.simplehttpserver.SimpleServerManager; |
|
39 |
|
|
40 |
/** |
|
41 |
* @author gvSIG Team |
|
42 |
* |
|
43 |
*/ |
|
44 |
@SuppressWarnings("rawtypes") |
|
45 |
public class ToolsUtilLocator extends AbstractLocator { |
|
46 |
|
|
47 |
private static final String LOCATOR_NAME = "ToolsUtilLocator"; |
|
48 |
|
|
49 |
public static final String TOOLS_UTIL_MANAGER_NAME = "org.gvsig.tools.util.manager"; |
|
50 |
private static final String TOOLS_UTIL_MANAGER_DESCRIPTION = "Tools utilities."; |
|
51 |
|
|
52 |
public static final String PROPERTIES_PAGE_MANAGER_NAME = "org.gvsig.tools.properties.page.manager"; |
|
53 |
private static final String PROPERTIES_PAGE_MANAGER_DESCRIPTION = "Properties page manager"; |
|
54 |
|
|
55 |
public static final String FILE_DIALOG_CHOOSER_MANAGER_NAME = "org.gvsig.filedialogchooser.manager"; |
|
56 |
private static final String FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION = "File dialog chooser."; |
|
57 |
|
|
58 |
public static final String PLUGINS_SVGSUPPORT_MANAGER_NAME = "SVGSupportManager"; |
|
59 |
private static final String PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION = "SVGSupportManager"; |
|
60 |
|
|
61 |
public static final String PLUGINS_IMAGEVIEWER_MANAGER_NAME = "ImageViewerManager"; |
|
62 |
private static final String PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION = "ImageViewerManager"; |
|
63 |
|
|
64 |
public static final String CONFIGURABLE_ACTIONS_MANAGER_NAME = "ConfigurableActionsMamager"; |
|
65 |
private static final String CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION = "ConfigurableActionsMamager"; |
|
66 |
|
|
67 |
public static final String TEXTEDITOR_MANAGER_NAME = "TextEditorMamager"; |
|
68 |
private static final String TEXTEDITOR_MANAGER_DESCRIPTION = "TextEditorMamager"; |
|
69 |
|
|
70 |
public static final String WEBBROWSER_MANAGER_NAME = "WebBrowserMamager"; |
|
71 |
private static final String WEBBROWSER_MANAGER_DESCRIPTION = "WebBrowserMamager"; |
|
72 |
|
|
73 |
public static final String EUCLIDEAN_MANAGER_NAME = "EuclideanManager"; |
|
74 |
private static final String EUCLIDEAN_MANAGER_DESCRIPTION = "EuclideanManager"; |
|
75 |
|
|
76 |
public static final String JSON_MANAGER_NAME = "org.gvsig.json.manager"; |
|
77 |
private static final String JSON_MANAGER_DESCRIPTION = "Json tools."; |
|
78 |
|
|
79 |
public static final String SIMPLEHTTPSERVER_MANAGER_NAME = "org.gvsig.simplehttpserver"; |
|
80 |
private static final String SIMPLEHTTPSERVER_MANAGER_DESCRIPTION = "Simple http server"; |
|
81 |
|
|
82 |
private static final ToolsUtilLocator INSTANCE = new ToolsUtilLocator(); |
|
83 |
|
|
84 |
private ToolsUtilLocator() { |
|
85 |
|
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Return the singleton instance. |
|
90 |
* |
|
91 |
* @return the singleton instance |
|
92 |
*/ |
|
93 |
public static ToolsUtilLocator getInstance() { |
|
94 |
return INSTANCE; |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
public String getLocatorName() { |
|
99 |
return LOCATOR_NAME; |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* Return a reference to ToolsUtilManager. |
|
104 |
* |
|
105 |
* @return a reference to ToolsUtilManager |
|
106 |
* @throws LocatorException if there is no access to the class or the class |
|
107 |
* cannot be instantiated |
|
108 |
* @see Locator#get(String) |
|
109 |
*/ |
|
110 |
public static ToolsUtilManager getToolsUtilManager() |
|
111 |
throws LocatorException { |
|
112 |
return (ToolsUtilManager) getInstance().get(TOOLS_UTIL_MANAGER_NAME); |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Registers the Class implementing the ToolsUtilManager interface. |
|
117 |
* |
|
118 |
* @param clazz implementing the ToolsUtilManager interface |
|
119 |
*/ |
|
120 |
public static void registerToolsUtilManager(Class clazz) { |
|
121 |
getInstance().register(TOOLS_UTIL_MANAGER_NAME, |
|
122 |
TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
|
123 |
} |
|
124 |
|
|
125 |
public static void registerDefaultToolsUtilManager(Class clazz) { |
|
126 |
getInstance().registerDefault(TOOLS_UTIL_MANAGER_NAME, |
|
127 |
TOOLS_UTIL_MANAGER_DESCRIPTION, clazz); |
|
128 |
} |
|
129 |
|
|
130 |
public static FileDialogChooserManager getFileDialogChooserManager() |
|
131 |
throws LocatorException { |
|
132 |
return (FileDialogChooserManager) getInstance().get(FILE_DIALOG_CHOOSER_MANAGER_NAME); |
|
133 |
} |
|
134 |
|
|
135 |
public static void registerFileDialogChooserManager(Class clazz) { |
|
136 |
getInstance().register(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
|
137 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
|
138 |
} |
|
139 |
|
|
140 |
public static void registerDefaultFileDialogChooserManager(Class clazz) { |
|
141 |
getInstance().registerDefault(FILE_DIALOG_CHOOSER_MANAGER_NAME, |
|
142 |
FILE_DIALOG_CHOOSER_MANAGER_DESCRIPTION, clazz); |
|
143 |
} |
|
144 |
|
|
145 |
//SVG support |
|
146 |
public static SVGSupportManager getSVGSupportManager() throws LocatorException { |
|
147 |
return (SVGSupportManager) getInstance().get(PLUGINS_SVGSUPPORT_MANAGER_NAME); |
|
148 |
} |
|
149 |
|
|
150 |
public static void registerSVGSupportManager(Class clazz) { |
|
151 |
getInstance().register(PLUGINS_SVGSUPPORT_MANAGER_NAME, PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, |
|
152 |
clazz); |
|
153 |
} |
|
154 |
|
|
155 |
public static void registerDefaultSVGSupportManager(Class clazz) { |
|
156 |
getInstance().registerDefault(PLUGINS_SVGSUPPORT_MANAGER_NAME, |
|
157 |
PLUGINS_SVGSUPPORT_MANAGER_DESCRIPTION, clazz); |
|
158 |
} |
|
159 |
|
|
160 |
public static ImageViewerManager getImageViewerManager() throws LocatorException { |
|
161 |
return (ImageViewerManager) getInstance().get(PLUGINS_IMAGEVIEWER_MANAGER_NAME); |
|
162 |
} |
|
163 |
|
|
164 |
public static void registerImageViewertManager(Class clazz) { |
|
165 |
getInstance().register(PLUGINS_IMAGEVIEWER_MANAGER_NAME, PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION, |
|
166 |
clazz); |
|
167 |
} |
|
168 |
|
|
169 |
public static void registerDefaultImageViewerManager(Class clazz) { |
|
170 |
getInstance().registerDefault(PLUGINS_IMAGEVIEWER_MANAGER_NAME, |
|
171 |
PLUGINS_IMAGEVIEWER_MANAGER_DESCRIPTION, clazz); |
|
172 |
} |
|
173 |
|
|
174 |
|
|
175 |
public static ConfigurableActionsMamager getConfigurableActionsMamager() throws LocatorException { |
|
176 |
return (ConfigurableActionsMamager) getInstance().get(CONFIGURABLE_ACTIONS_MANAGER_NAME); |
|
177 |
} |
|
178 |
|
|
179 |
public static void registerConfigurableActionsMamager(Class clazz) { |
|
180 |
getInstance().register(CONFIGURABLE_ACTIONS_MANAGER_NAME, CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION, |
|
181 |
clazz); |
|
182 |
} |
|
183 |
|
|
184 |
public static void registerDefaultConfigurableActionsMamager(Class clazz) { |
|
185 |
getInstance().registerDefault(CONFIGURABLE_ACTIONS_MANAGER_NAME, |
|
186 |
CONFIGURABLE_ACTIONS_MANAGER_DESCRIPTION, clazz); |
|
187 |
} |
|
188 |
|
|
189 |
|
|
190 |
public static PropertiesPageManager getPropertiesPageManager() throws LocatorException { |
|
191 |
return (PropertiesPageManager) getInstance().get(PROPERTIES_PAGE_MANAGER_NAME); |
|
192 |
} |
|
193 |
|
|
194 |
public static void registerPropertiesPageManager(Class clazz) { |
|
195 |
getInstance().register(PROPERTIES_PAGE_MANAGER_NAME, |
|
196 |
PROPERTIES_PAGE_MANAGER_DESCRIPTION, |
|
197 |
clazz); |
|
198 |
} |
|
199 |
|
|
200 |
public static void registerDefaultPropertiesPageManager(Class clazz) { |
|
201 |
getInstance().registerDefault( |
|
202 |
PROPERTIES_PAGE_MANAGER_NAME, |
|
203 |
PROPERTIES_PAGE_MANAGER_DESCRIPTION, clazz); |
|
204 |
} |
|
205 |
|
|
206 |
public static TextEditorManager getTextEditorManager() throws LocatorException { |
|
207 |
return (TextEditorManager) getInstance().get(TEXTEDITOR_MANAGER_NAME); |
|
208 |
} |
|
209 |
|
|
210 |
public static void registerTextEditorManager(Class clazz) { |
|
211 |
getInstance().register(TEXTEDITOR_MANAGER_NAME, |
|
212 |
TEXTEDITOR_MANAGER_DESCRIPTION, |
|
213 |
clazz); |
|
214 |
} |
|
215 |
|
|
216 |
public static void registerDefaultTextEditorManager(Class clazz) { |
|
217 |
getInstance().registerDefault( |
|
218 |
TEXTEDITOR_MANAGER_NAME, |
|
219 |
TEXTEDITOR_MANAGER_DESCRIPTION, clazz); |
|
220 |
} |
|
221 |
|
|
222 |
|
|
223 |
public static WebBrowserManager getWebBrowserManager() throws LocatorException { |
|
224 |
return (WebBrowserManager) getInstance().get(WEBBROWSER_MANAGER_NAME); |
|
225 |
} |
|
226 |
|
|
227 |
public static void registerWebBrowserManager(Class clazz) { |
|
228 |
getInstance().register(WEBBROWSER_MANAGER_NAME, |
|
229 |
WEBBROWSER_MANAGER_DESCRIPTION, |
|
230 |
clazz); |
|
231 |
} |
|
232 |
|
|
233 |
public static void registerDefaultWebBrowserManager(Class clazz) { |
|
234 |
getInstance().registerDefault( |
|
235 |
WEBBROWSER_MANAGER_NAME, |
|
236 |
WEBBROWSER_MANAGER_DESCRIPTION, clazz); |
|
237 |
} |
|
238 |
|
|
239 |
public static EuclideanManager getEuclideanManager() throws LocatorException { |
|
240 |
return (EuclideanManager) getInstance().get(EUCLIDEAN_MANAGER_NAME); |
|
241 |
} |
|
242 |
|
|
243 |
public static void registerEuclideanManager(Class clazz) { |
|
244 |
getInstance().register(EUCLIDEAN_MANAGER_NAME, |
|
245 |
EUCLIDEAN_MANAGER_DESCRIPTION, |
|
246 |
clazz); |
|
247 |
} |
|
248 |
|
|
249 |
public static void registerDefaultEuclideanManager(Class clazz) { |
|
250 |
getInstance().registerDefault( |
|
251 |
EUCLIDEAN_MANAGER_NAME, |
|
252 |
EUCLIDEAN_MANAGER_DESCRIPTION, clazz); |
|
253 |
} |
|
254 |
|
|
255 |
public static JsonManager getJsonManager() throws LocatorException { |
|
256 |
return (JsonManager) getInstance().get(JSON_MANAGER_NAME); |
|
257 |
} |
|
258 |
|
|
259 |
public static void registerJsonManager(Class clazz) { |
|
260 |
getInstance().register(JSON_MANAGER_NAME, |
|
261 |
JSON_MANAGER_DESCRIPTION, |
|
262 |
clazz); |
|
263 |
} |
|
264 |
|
|
265 |
public static void registerDefaultJsonManager(Class clazz) { |
|
266 |
getInstance().registerDefault( |
|
267 |
JSON_MANAGER_NAME, |
|
268 |
JSON_MANAGER_DESCRIPTION, clazz); |
|
269 |
} |
|
270 |
|
|
271 |
public static SimpleServerManager getSimpleServerManager() throws LocatorException { |
|
272 |
return (SimpleServerManager) getInstance().get(SIMPLEHTTPSERVER_MANAGER_NAME); |
|
273 |
} |
|
274 |
|
|
275 |
public static void registerSimpleServerManager(Class clazz) { |
|
276 |
getInstance().register(SIMPLEHTTPSERVER_MANAGER_NAME, |
|
277 |
SIMPLEHTTPSERVER_MANAGER_DESCRIPTION, |
|
278 |
clazz); |
|
279 |
} |
|
280 |
|
|
281 |
public static void registerDefaultSimpleServerManager(Class clazz) { |
|
282 |
getInstance().registerDefault( |
|
283 |
SIMPLEHTTPSERVER_MANAGER_NAME, |
|
284 |
SIMPLEHTTPSERVER_MANAGER_DESCRIPTION, clazz); |
|
285 |
} |
|
286 |
|
|
287 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/ToolsUtilLibrary.java | ||
---|---|---|
1 |
package org.gvsig.tools.util; |
|
2 |
|
|
3 |
import org.gvsig.tools.ToolsLibrary; |
|
4 |
import org.gvsig.tools.library.AbstractLibrary; |
|
5 |
import org.gvsig.tools.library.LibraryException; |
|
6 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
7 |
|
|
8 |
/** |
|
9 |
* gvSIG. Desktop Geographic Information System. |
|
10 |
* |
|
11 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
12 |
* |
|
13 |
* This program is free software; you can redistribute it and/or |
|
14 |
* modify it under the terms of the GNU General Public License |
|
15 |
* as published by the Free Software Foundation; either version 3 |
|
16 |
* of the License, or (at your option) any later version. |
|
17 |
* |
|
18 |
* This program is distributed in the hope that it will be useful, |
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
* GNU General Public License for more details. |
|
22 |
* |
|
23 |
* You should have received a copy of the GNU General Public License |
|
24 |
* along with this program; if not, write to the Free Software |
|
25 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 |
* MA 02110-1301, USA. |
|
27 |
* |
|
28 |
* For any additional information, do not hesitate to contact us |
|
29 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
30 |
*/ |
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
@SuppressWarnings("unchecked") |
|
35 |
public class ToolsUtilLibrary extends AbstractLibrary { |
|
36 |
|
|
37 |
public void doRegistration() { |
|
38 |
super.doRegistration(); |
|
39 |
registerAsAPI(ToolsUtilLibrary.class); |
|
40 |
this.require(ToolsLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
protected void doInitialize() throws LibraryException { |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
protected void doPostInitialize() throws LibraryException { |
|
48 |
// Validate there is any implementation registered. |
|
49 |
ToolsUtilManager manager = ToolsUtilLocator.getToolsUtilManager(); |
|
50 |
if (manager == null) { |
|
51 |
throw new ReferenceNotRegisteredException( |
|
52 |
ToolsUtilLocator.TOOLS_UTIL_MANAGER_NAME, ToolsUtilLocator |
|
53 |
.getInstance()); |
|
54 |
} |
|
55 |
|
|
56 |
} |
|
57 |
|
|
58 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/tools/util/ToolsUtilManager.java | ||
---|---|---|
1 |
package org.gvsig.tools.util; |
|
2 |
|
|
3 |
import org.gvsig.desktopopen.DesktopOpen; |
|
4 |
import org.gvsig.htmlbuilder.HTMLBuilder; |
|
5 |
|
|
6 |
/** |
|
7 |
* gvSIG. Desktop Geographic Information System. |
|
8 |
* |
|
9 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or modify it under |
|
12 |
* the terms of the GNU General Public License as published by the Free Software |
|
13 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
14 |
* version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
17 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
18 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
19 |
* details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License along with |
|
22 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
23 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
24 |
* |
|
25 |
* For any additional information, do not hesitate to contact us at info AT |
|
26 |
* gvsig.com, or visit our website www.gvsig.com. |
|
27 |
*/ |
|
28 |
/** |
|
29 |
* @author fdiaz |
|
30 |
* |
|
31 |
*/ |
|
32 |
public interface ToolsUtilManager { |
|
33 |
|
|
34 |
/** |
|
35 |
* @return |
|
36 |
*/ |
|
37 |
public InformationBuilder createInformationBuilder(); |
|
38 |
|
|
39 |
public DesktopOpen createDesktopOpen(); |
|
40 |
|
|
41 |
public HTMLBuilder createHTMLBuilder(); |
|
42 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/configurableactions/ConfigurableActionsMamager.java | ||
---|---|---|
1 |
package org.gvsig.configurableactions; |
|
2 |
|
|
3 |
import java.util.Collection; |
|
4 |
import javax.swing.Action; |
|
5 |
import javax.swing.JComponent; |
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
public interface ConfigurableActionsMamager { |
|
10 |
|
|
11 |
public void addConfigurableAction(String panelid, Action action); |
|
12 |
|
|
13 |
public void removeConfigurableAction(String panelid, String actionName); |
|
14 |
|
|
15 |
public void removeAllConfigurableActions(String panelid); |
|
16 |
|
|
17 |
public Collection<Action> getConfigurableActions(String panelid); |
|
18 |
|
|
19 |
public JComponent getConfigurableActionsComponent(String panelid, Object source); |
|
20 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/propertypage/PropertiesPageFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.propertypage; |
|
3 |
|
|
4 |
public interface PropertiesPageFactory { |
|
5 |
|
|
6 |
public String getName(); |
|
7 |
|
|
8 |
/** |
|
9 |
* Return the group identifier. |
|
10 |
* The group identifier identify the object that store the properties that |
|
11 |
* this property page handle. Bty excample: |
|
12 |
* - Project |
|
13 |
* - View |
|
14 |
* - Layer |
|
15 |
* |
|
16 |
* @return the group identifier |
|
17 |
*/ |
|
18 |
public String getGroupID(); |
|
19 |
|
|
20 |
/** |
|
21 |
* Return true if this propeties page is enabled for the object. |
|
22 |
* |
|
23 |
* @param obj object that store the properties of this properties page. |
|
24 |
* @return true if the page is enabled |
|
25 |
*/ |
|
26 |
public boolean isVisible(Object obj); |
|
27 |
|
|
28 |
/** |
|
29 |
* Create a instance of the propeties page for the object. |
|
30 |
* |
|
31 |
* @param container, Container of the new page, usually the dialog. |
|
32 |
* @param data object that store the properties of this properties page. |
|
33 |
* @return the properties page |
|
34 |
*/ |
|
35 |
public PropertiesPage create(Object container, Object data); |
|
36 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/propertypage/BasePropertiesPagePanelLayout.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
|
|
7 |
package org.gvsig.propertypage; |
|
8 |
|
|
9 |
import java.awt.Dimension; |
|
10 |
import java.awt.GridBagConstraints; |
|
11 |
import java.awt.GridBagLayout; |
|
12 |
import javax.swing.BorderFactory; |
|
13 |
import javax.swing.Box; |
|
14 |
import javax.swing.JButton; |
|
15 |
import javax.swing.JLabel; |
|
16 |
import javax.swing.JPanel; |
|
17 |
import javax.swing.JScrollPane; |
|
18 |
import javax.swing.JTextArea; |
|
19 |
import javax.swing.border.BevelBorder; |
|
20 |
import javax.swing.border.SoftBevelBorder; |
|
21 |
import org.jdesktop.layout.GroupLayout; |
|
22 |
|
|
23 |
/** |
|
24 |
* |
|
25 |
* @author usuario |
|
26 |
*/ |
|
27 |
public class BasePropertiesPagePanelLayout extends javax.swing.JPanel { |
|
28 |
|
|
29 |
/** |
|
30 |
* Creates new form BasePropertiesPagePanelLayout |
|
31 |
*/ |
|
32 |
public BasePropertiesPagePanelLayout() { |
|
33 |
initComponents(); |
|
34 |
} |
|
35 |
|
|
36 |
/** |
|
37 |
* This method is called from within the constructor to |
|
38 |
* initialize the form. |
|
39 |
* WARNING: Do NOT modify this code. The content of this method is |
|
40 |
* always regenerated by the Form Editor. |
|
41 |
*/ |
|
42 |
@SuppressWarnings("unchecked") |
|
43 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
|
44 |
private void initComponents() { |
|
45 |
java.awt.GridBagConstraints gridBagConstraints; |
|
46 |
|
|
47 |
titleLabel = new javax.swing.JLabel(); |
|
48 |
applyButton = new javax.swing.JButton(); |
|
49 |
cancelButton = new javax.swing.JButton(); |
|
50 |
acceptButton = new javax.swing.JButton(); |
|
51 |
content = new javax.swing.JPanel(); |
|
52 |
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0)); |
|
53 |
|
|
54 |
java.awt.GridBagLayout layout = new java.awt.GridBagLayout(); |
|
55 |
layout.columnWidths = new int[] {0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0}; |
|
56 |
layout.rowHeights = new int[] {0, 4, 0, 4, 0, 4, 0, 4, 0}; |
|
57 |
setLayout(layout); |
|
58 |
|
|
59 |
titleLabel.setText("jLabel1"); |
|
60 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
61 |
gridBagConstraints.gridx = 2; |
|
62 |
gridBagConstraints.gridy = 2; |
|
63 |
gridBagConstraints.gridwidth = 7; |
|
64 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
65 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; |
|
66 |
add(titleLabel, gridBagConstraints); |
|
67 |
|
|
68 |
applyButton.setText("Apply"); |
|
69 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
70 |
gridBagConstraints.gridx = 6; |
|
71 |
gridBagConstraints.gridy = 6; |
|
72 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
73 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; |
|
74 |
gridBagConstraints.weightx = 0.1; |
|
75 |
add(applyButton, gridBagConstraints); |
|
76 |
|
|
77 |
cancelButton.setText("Cancel"); |
|
78 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
79 |
gridBagConstraints.gridx = 4; |
|
80 |
gridBagConstraints.gridy = 6; |
|
81 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
82 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; |
|
83 |
gridBagConstraints.weightx = 0.1; |
|
84 |
add(cancelButton, gridBagConstraints); |
|
85 |
|
|
86 |
acceptButton.setText("Accept"); |
|
87 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
88 |
gridBagConstraints.gridx = 8; |
|
89 |
gridBagConstraints.gridy = 6; |
|
90 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
|
91 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; |
|
92 |
gridBagConstraints.weightx = 0.1; |
|
93 |
add(acceptButton, gridBagConstraints); |
|
94 |
|
|
95 |
content.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
|
96 |
|
|
97 |
org.jdesktop.layout.GroupLayout contentLayout = new org.jdesktop.layout.GroupLayout(content); |
|
98 |
content.setLayout(contentLayout); |
|
99 |
contentLayout.setHorizontalGroup( |
|
100 |
contentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
101 |
.add(0, 388, Short.MAX_VALUE) |
|
102 |
); |
|
103 |
contentLayout.setVerticalGroup( |
|
104 |
contentLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
|
105 |
.add(0, 234, Short.MAX_VALUE) |
|
106 |
); |
|
107 |
|
|
108 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
109 |
gridBagConstraints.gridx = 2; |
|
110 |
gridBagConstraints.gridy = 4; |
|
111 |
gridBagConstraints.gridwidth = 7; |
|
112 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
|
113 |
gridBagConstraints.weightx = 1.0; |
|
114 |
gridBagConstraints.weighty = 1.0; |
|
115 |
add(content, gridBagConstraints); |
|
116 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
117 |
gridBagConstraints.gridx = 2; |
|
118 |
gridBagConstraints.gridy = 6; |
|
119 |
gridBagConstraints.weightx = 1.0; |
|
120 |
add(filler1, gridBagConstraints); |
|
121 |
}// </editor-fold>//GEN-END:initComponents |
|
122 |
|
|
123 |
|
|
124 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
|
125 |
protected javax.swing.JButton acceptButton; |
|
126 |
protected javax.swing.JButton applyButton; |
|
127 |
protected javax.swing.JButton cancelButton; |
|
128 |
protected javax.swing.JPanel content; |
|
129 |
protected javax.swing.Box.Filler filler1; |
|
130 |
protected javax.swing.JLabel titleLabel; |
|
131 |
// End of variables declaration//GEN-END:variables |
|
132 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/propertypage/BasePropertiesPageDialog.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.propertypage; |
|
3 |
|
|
4 |
import java.awt.BorderLayout; |
|
5 |
import java.awt.Component; |
|
6 |
import java.awt.event.ActionEvent; |
|
7 |
import java.awt.event.ActionListener; |
|
8 |
import java.util.List; |
|
9 |
import javax.swing.JComponent; |
|
10 |
import javax.swing.JTabbedPane; |
|
11 |
import org.gvsig.propertypage.PropertiesPage.SetPageEnabledEvent; |
|
12 |
import org.gvsig.tools.ToolsLocator; |
|
13 |
import org.gvsig.tools.i18n.I18nManager; |
|
14 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
15 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
|
16 |
import org.gvsig.tools.util.Invocable; |
|
17 |
import org.gvsig.tools.util.ToolsUtilLocator; |
|
18 |
|
|
19 |
|
|
20 |
public class BasePropertiesPageDialog extends BasePropertiesPagePanelLayout implements org.gvsig.tools.swing.api.Component { |
|
21 |
public static final int ACTION_CANCEL = 0; |
|
22 |
public static final int ACTION_ACCEPT = 1; |
|
23 |
public static final int ACTION_APPLY = 2; |
|
24 |
|
|
25 |
private Object obj; |
|
26 |
private String groupID; |
|
27 |
private List<PropertiesPage> pages = null; |
|
28 |
private int userAction = ACTION_ACCEPT; |
|
29 |
private JTabbedPane tabbedPane = null; |
|
30 |
|
|
31 |
public BasePropertiesPageDialog() { |
|
32 |
} |
|
33 |
|
|
34 |
public BasePropertiesPageDialog(Object obj, String groupID) { |
|
35 |
init(groupID, obj); |
|
36 |
} |
|
37 |
|
|
38 |
protected void init(String groupID, Object obj) { |
|
39 |
this.obj = obj; |
|
40 |
this.groupID = groupID; |
|
41 |
PropertiesPageManager manager = ToolsUtilLocator.getPropertiesPageManager(); |
|
42 |
this.pages = manager.getPages(this.groupID, this, this.obj); |
|
43 |
initComponents(); |
|
44 |
} |
|
45 |
|
|
46 |
protected void initComponents() { |
|
47 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
48 |
|
|
49 |
this.content.setLayout(new BorderLayout()); |
|
50 |
Component contents = createPropertiesPagesPanel(); |
|
51 |
if( contents instanceof JTabbedPane ) { |
|
52 |
this.tabbedPane = (JTabbedPane) contents; |
|
53 |
} |
|
54 |
this.content.add(contents, BorderLayout.CENTER ); |
|
55 |
|
|
56 |
this.titleLabel.setText(""); |
|
57 |
|
|
58 |
this.acceptButton.setText(i18nManager.getTranslation("accept")); |
|
59 |
this.acceptButton.addActionListener( new ActionListener() { |
|
60 |
@Override |
|
61 |
public void actionPerformed(ActionEvent ae) { |
|
62 |
whenAccept(); |
|
63 |
} |
|
64 |
}); |
|
65 |
this.applyButton.setText(i18nManager.getTranslation("apply")); |
|
66 |
this.applyButton.addActionListener( new ActionListener() { |
|
67 |
@Override |
|
68 |
public void actionPerformed(ActionEvent ae) { |
|
69 |
whenApply(); |
|
70 |
} |
|
71 |
}); |
|
72 |
this.cancelButton.setText(i18nManager.getTranslation("cancel")); |
|
73 |
this.cancelButton.addActionListener( new ActionListener() { |
|
74 |
@Override |
|
75 |
public void actionPerformed(ActionEvent ae) { |
|
76 |
whenCancel(); |
|
77 |
} |
|
78 |
}); |
|
79 |
|
|
80 |
} |
|
81 |
|
|
82 |
protected List<PropertiesPage> getPages() { |
|
83 |
return pages; |
|
84 |
} |
|
85 |
|
|
86 |
protected PropertiesPage getPage(Class<? extends PropertiesPage> theClass) { |
|
87 |
for (PropertiesPage page : pages) { |
|
88 |
if( theClass.isInstance(page) ) { |
|
89 |
return page; |
|
90 |
} |
|
91 |
} |
|
92 |
return null; |
|
93 |
} |
|
94 |
|
|
95 |
protected boolean isButtonVisible(int button) { |
|
96 |
switch(button) { |
|
97 |
case WindowManager_v2.BUTTON_APPLY: |
|
98 |
return this.applyButton.isVisible(); |
|
99 |
case WindowManager_v2.BUTTON_OK: |
|
100 |
return acceptButton.isVisible(); |
|
101 |
case WindowManager_v2.BUTTON_CANCEL: |
|
102 |
return cancelButton.isVisible(); |
|
103 |
} |
|
104 |
return false; |
|
105 |
} |
|
106 |
|
|
107 |
protected void setButtonVisible(int button, boolean visible) { |
|
108 |
switch(button) { |
|
109 |
case WindowManager_v2.BUTTON_APPLY: |
|
110 |
this.applyButton.setVisible(visible); |
|
111 |
break; |
|
112 |
case WindowManager_v2.BUTTON_OK: |
|
113 |
this.acceptButton.setVisible(visible); |
|
114 |
break; |
|
115 |
case WindowManager_v2.BUTTON_CANCEL: |
|
116 |
this.cancelButton.setVisible(visible); |
|
117 |
break; |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
121 |
protected void setButtonLabel(int button, String label) { |
|
122 |
switch(button) { |
|
123 |
case WindowManager_v2.BUTTON_APPLY: |
|
124 |
this.applyButton.setText(label); |
|
125 |
break; |
|
126 |
case WindowManager_v2.BUTTON_OK: |
|
127 |
this.acceptButton.setText(label); |
|
128 |
break; |
|
129 |
case WindowManager_v2.BUTTON_CANCEL: |
|
130 |
this.cancelButton.setText(label); |
|
131 |
break; |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
protected boolean isButtonEnabled(int button) { |
|
136 |
switch(button) { |
|
137 |
case WindowManager_v2.BUTTON_APPLY: |
|
138 |
return this.applyButton.isEnabled(); |
|
139 |
case WindowManager_v2.BUTTON_OK: |
|
140 |
return acceptButton.isEnabled(); |
|
141 |
case WindowManager_v2.BUTTON_CANCEL: |
|
142 |
return cancelButton.isEnabled(); |
|
143 |
} |
|
144 |
return false; |
|
145 |
} |
|
146 |
|
|
147 |
protected void setButtonEnabled(int button, boolean visible) { |
|
148 |
switch(button) { |
|
149 |
case WindowManager_v2.BUTTON_APPLY: |
|
150 |
this.applyButton.setEnabled(visible); |
|
151 |
break; |
|
152 |
case WindowManager_v2.BUTTON_OK: |
|
153 |
this.acceptButton.setEnabled(visible); |
|
154 |
break; |
|
155 |
case WindowManager_v2.BUTTON_CANCEL: |
|
156 |
this.cancelButton.setEnabled(visible); |
|
157 |
break; |
|
158 |
} |
|
159 |
} |
|
160 |
|
|
161 |
protected Component createPropertiesPagesPanel() { |
|
162 |
if( this.pages.size()==1 && !useTabsAlwais() ) { |
|
163 |
PropertiesPage page = this.pages.get(0); |
|
164 |
return page.asJComponent(); |
|
165 |
} else { |
|
166 |
JTabbedPane theTabbedPane = new JTabbedPane(); |
|
167 |
for( int i=0; i<this.pages.size(); i++ ) { |
|
168 |
PropertiesPage page = this.pages.get(i); |
|
169 |
if( page instanceof ActionListenerSupport ) { |
|
170 |
((ActionListenerSupport)page).addActionListener(new ActionListener() { |
|
171 |
@Override |
|
172 |
public void actionPerformed(ActionEvent e) { |
|
173 |
if( e instanceof SetPageEnabledEvent ) { |
|
174 |
SetPageEnabledEvent ee = (SetPageEnabledEvent) e; |
|
175 |
setEnabledAt(ee.getFilter(), ee.isEnabled()); |
|
176 |
} |
|
177 |
} |
|
178 |
}); |
|
179 |
} |
|
180 |
theTabbedPane.addTab(page.getTitle(), page.asJComponent()); |
|
181 |
} |
|
182 |
return theTabbedPane; |
|
183 |
} |
|
184 |
} |
|
185 |
|
|
186 |
protected boolean useTabsAlwais() { |
|
187 |
return false; |
|
188 |
} |
|
189 |
|
|
190 |
public void whenAccept() { |
|
191 |
for( int i=0; i<this.pages.size(); i++ ) { |
|
192 |
PropertiesPage page = this.pages.get(i); |
|
193 |
if( ! page.whenAccept() ) { |
|
194 |
return; |
|
195 |
} |
|
196 |
} |
|
197 |
this.userAction = ACTION_ACCEPT; |
|
198 |
this.closeDialog(); |
|
199 |
} |
|
200 |
|
|
201 |
public void whenApply() { |
|
202 |
for( int i=0; i<this.pages.size(); i++ ) { |
|
203 |
PropertiesPage page = this.pages.get(i); |
|
204 |
if( ! page.whenApply() ) { |
|
205 |
return; |
|
206 |
} |
|
207 |
} |
|
208 |
this.userAction = ACTION_APPLY; |
|
209 |
} |
|
210 |
|
|
211 |
public void whenCancel() { |
|
212 |
for( int i=0; i<this.pages.size(); i++ ) { |
|
213 |
PropertiesPage page = this.pages.get(i); |
|
214 |
if( ! page.whenCancel() ) { |
|
215 |
return; |
|
216 |
} |
|
217 |
} |
|
218 |
this.userAction = ACTION_CANCEL; |
|
219 |
this.closeDialog(); |
|
220 |
} |
|
221 |
|
|
222 |
public int getUserAction() { |
|
223 |
return this.userAction; |
|
224 |
} |
|
225 |
|
|
226 |
protected void closeDialog() { |
|
227 |
this.setVisible(false); |
|
228 |
} |
|
229 |
|
|
230 |
@Override |
|
231 |
public JComponent asJComponent() { |
|
232 |
return this; |
|
233 |
} |
|
234 |
|
|
235 |
public void setEnabledAt(Invocable filter, boolean enabled) { |
|
236 |
if( this.tabbedPane==null ) { |
|
237 |
return; |
|
238 |
} |
|
239 |
for( int i=0; i<this.pages.size(); i++ ) { |
|
240 |
PropertiesPage page = this.pages.get(i); |
|
241 |
if( (Boolean)(filter.call(page)) ) { |
|
242 |
this.tabbedPane.setEnabledAt(i, enabled); |
|
243 |
} |
|
244 |
} |
|
245 |
} |
|
246 |
|
|
247 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.288/org.gvsig.tools.util/org.gvsig.tools.util.api/src/main/java/org/gvsig/propertypage/BasePropertiesPagePanelLayout.form | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
|
|
3 |
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> |
|
4 |
<AuxValues> |
|
5 |
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> |
|
6 |
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> |
|
7 |
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="false"/> |
|
8 |
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> |
|
9 |
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> |
|
10 |
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/> |
|
11 |
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> |
|
12 |
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> |
|
13 |
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="4"/> |
|
14 |
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/> |
|
15 |
</AuxValues> |
|
16 |
<SubComponents> |
|
17 |
<Component class="javax.swing.JLabel" name="titleLabel"> |
|
18 |
<Properties> |
|
19 |
<Property name="text" type="java.lang.String" value="jLabel1"/> |
|
20 |
</Properties> |
|
21 |
<Constraints> |
|
22 |
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> |
|
23 |
<GridBagConstraints gridX="2" gridY="2" gridWidth="7" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> |
|
24 |
</Constraint> |
|
25 |
</Constraints> |
|
26 |
</Component> |
|
27 |
<Component class="javax.swing.JButton" name="applyButton"> |
|
28 |
<Properties> |
|
29 |
<Property name="text" type="java.lang.String" value="Apply"/> |
|
30 |
</Properties> |
|
31 |
<Constraints> |
|
32 |
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> |
|
33 |
<GridBagConstraints gridX="6" gridY="6" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="22" weightX="0.1" weightY="0.0"/> |
|
34 |
</Constraint> |
|
35 |
</Constraints> |
|
36 |
</Component> |
|
37 |
<Component class="javax.swing.JButton" name="cancelButton"> |
|
38 |
<Properties> |
|
39 |
<Property name="text" type="java.lang.String" value="Cancel"/> |
|
40 |
</Properties> |
|
41 |
<Constraints> |
|
42 |
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> |
|
43 |
<GridBagConstraints gridX="4" gridY="6" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="22" weightX="0.1" weightY="0.0"/> |
|
44 |
</Constraint> |
|
45 |
</Constraints> |
|
46 |
</Component> |
|
47 |
<Component class="javax.swing.JButton" name="acceptButton"> |
|
48 |
<Properties> |
|
49 |
<Property name="text" type="java.lang.String" value="Accept"/> |
|
50 |
</Properties> |
|
51 |
<Constraints> |
|
52 |
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> |
|
53 |
<GridBagConstraints gridX="8" gridY="6" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="22" weightX="0.1" weightY="0.0"/> |
|
54 |
</Constraint> |
|
55 |
</Constraints> |
|
56 |
</Component> |
|
57 |
<Container class="javax.swing.JPanel" name="content"> |
|
58 |
<Properties> |
|
59 |
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> |
|
60 |
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo"> |
|
61 |
<EmptyBorder/> |
|
62 |
</Border> |
|
63 |
</Property> |
|
64 |
</Properties> |
|
65 |
<Constraints> |
|
66 |
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> |
|
67 |
<GridBagConstraints gridX="2" gridY="4" gridWidth="7" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/> |
|
68 |
</Constraint> |
|
69 |
</Constraints> |
|
70 |
|
|
71 |
<Layout> |
|
72 |
<DimensionLayout dim="0"> |
|
73 |
<Group type="103" groupAlignment="0" attributes="0"> |
|
74 |
<EmptySpace min="0" pref="388" max="32767" attributes="0"/> |
|
75 |
</Group> |
|
76 |
</DimensionLayout> |
|
77 |
<DimensionLayout dim="1"> |
|
78 |
<Group type="103" groupAlignment="0" attributes="0"> |
|
79 |
<EmptySpace min="0" pref="234" max="32767" attributes="0"/> |
|
80 |
</Group> |
|
81 |
</DimensionLayout> |
|
82 |
</Layout> |
|
83 |
</Container> |
|
84 |
<Component class="javax.swing.Box$Filler" name="filler1"> |
|
85 |
<Properties> |
|
86 |
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> |
|
87 |
<Dimension value="[32767, 0]"/> |
|
88 |
</Property> |
|
89 |
</Properties> |
|
90 |
<AuxValues> |
|
91 |
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalGlue"/> |
|
92 |
</AuxValues> |
|
93 |
<Constraints> |
|
94 |
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> |
|
95 |
<GridBagConstraints gridX="2" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> |
|
96 |
</Constraint> |
|
97 |
</Constraints> |
|
98 |
</Component> |
|
99 |
</SubComponents> |
|
100 |
<LayoutCode> |
|
101 |
<CodeStatement> |
|
102 |
<CodeExpression id="1_layout"> |
|
103 |
<CodeVariable name="layout" type="4096" declaredType="java.awt.GridBagLayout"/> |
|
104 |
<ExpressionOrigin> |
|
105 |
<ExpressionProvider type="CodeConstructor"> |
|
106 |
<CodeConstructor class="java.awt.GridBagLayout" parameterTypes=""/> |
|
107 |
</ExpressionProvider> |
|
108 |
</ExpressionOrigin> |
|
109 |
</CodeExpression> |
|
110 |
<StatementProvider type="CodeExpression"> |
|
111 |
<CodeExpression id="1_layout"/> |
|
112 |
</StatementProvider> |
|
113 |
</CodeStatement> |
|
114 |
<CodeStatement> |
|
115 |
<CodeExpression id="1_layout"/> |
|
116 |
<StatementProvider type="CodeField"> |
|
117 |
<CodeField name="columnWidths" class="java.awt.GridBagLayout"/> |
|
118 |
</StatementProvider> |
|
119 |
<Parameters> |
|
120 |
<CodeExpression id="2"> |
|
121 |
<ExpressionOrigin> |
|
122 |
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor"> |
|
123 |
<PropertyValue value="[0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0]"/> |
|
124 |
</Value> |
|
125 |
</ExpressionOrigin> |
|
126 |
</CodeExpression> |
|
127 |
</Parameters> |
|
128 |
</CodeStatement> |
|
129 |
<CodeStatement> |
|
130 |
<CodeExpression id="1_layout"/> |
Also available in: Unified diff