Revision 1484
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/test/resources/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
Put into this folder the resources needed by your test classes. |
|
5 |
|
|
6 |
This folder is added to the Tests classpath, so you can load any resources |
|
7 |
through the ClassLoader. |
|
8 |
|
|
9 |
By default, in this folder you can find an example of log4j configuration, |
|
10 |
prepared to log messages through the console, so logging works when you |
|
11 |
run your tests classes. |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
DefaultExampleManager class. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.scripting.impl.DefaultExampleManager"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
|
|
26 |
<!-- |
|
27 |
By default, show only logging messages of INFO level or higher, |
|
28 |
through the previously configured CONSOLE appender. |
|
29 |
--> |
|
30 |
<root> |
|
31 |
<priority value="INFO" /> |
|
32 |
<appender-ref ref="CONSOLE" /> |
|
33 |
</root> |
|
34 |
</log4j:configuration> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/test/java/README.txt | ||
---|---|---|
1 |
#set( $symbol_pound = '#' ) |
|
2 |
#set( $symbol_dollar = '$' ) |
|
3 |
#set( $symbol_escape = '\' ) |
|
4 |
For each class you are going to test, create one Test class with the same |
|
5 |
name as the class to test, ending with Test. |
|
6 |
|
|
7 |
For example, the unit tests of the "ExampleLibrary" class are performed |
|
8 |
by the "ExampleLibraryTest" class. |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/AbstractEditorFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.scripting.swing.api; |
|
3 |
|
|
4 |
import org.apache.commons.lang3.StringUtils; |
|
5 |
import org.gvsig.scripting.ScriptingUnit; |
|
6 |
|
|
7 |
|
|
8 |
public abstract class AbstractEditorFactory implements EditorFactory { |
|
9 |
private final String description; |
|
10 |
private final String name; |
|
11 |
|
|
12 |
protected AbstractEditorFactory(String name, String description) { |
|
13 |
if( StringUtils.isEmpty(name) ) { |
|
14 |
this.name = this.getClass().getSimpleName(); |
|
15 |
} else { |
|
16 |
this.name = name; |
|
17 |
} |
|
18 |
if( StringUtils.isEmpty(description) ) { |
|
19 |
this.description = ""; |
|
20 |
} else { |
|
21 |
this.description = description; |
|
22 |
} |
|
23 |
|
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public String getName() { |
|
28 |
return this.name; |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
public String getDescription() { |
|
33 |
return this.description; |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public int getPriority() { |
|
38 |
return 1000; |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public JEditor create(ScriptingUnit unit) { |
|
43 |
if( this.canCreate(unit) ) { |
|
44 |
return doCreate(unit); |
|
45 |
} |
|
46 |
throw new IllegalArgumentException(); |
|
47 |
} |
|
48 |
|
|
49 |
protected abstract JEditor doCreate(ScriptingUnit unit); |
|
50 |
|
|
51 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JTextEditor.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.scripting.swing.api; |
|
3 |
|
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import javax.swing.text.JTextComponent; |
|
6 |
|
|
7 |
|
|
8 |
public interface JTextEditor extends JEditor { |
|
9 |
|
|
10 |
public void reload(); |
|
11 |
|
|
12 |
public void selectLine(int line); |
|
13 |
|
|
14 |
public void gotoline(int line); |
|
15 |
|
|
16 |
public int getLineCount(); |
|
17 |
|
|
18 |
public JTextComponent getJTextComponent(); |
|
19 |
|
|
20 |
public SyntaxtHighlightTextComponent getSyntaxtHighlightTextComponent(); |
|
21 |
|
|
22 |
public void addUpdateCaretPositionActionListener(ActionListener actionlistener); |
|
23 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/EditorFactory.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.scripting.swing.api; |
|
3 |
|
|
4 |
import org.gvsig.scripting.ScriptingUnit; |
|
5 |
|
|
6 |
|
|
7 |
public interface EditorFactory { |
|
8 |
|
|
9 |
public String getName(); |
|
10 |
|
|
11 |
public String getDescription(); |
|
12 |
|
|
13 |
public int getPriority(); |
|
14 |
|
|
15 |
public JEditor create(ScriptingUnit unit); |
|
16 |
|
|
17 |
public boolean canCreate(ScriptingUnit unit); |
|
18 |
|
|
19 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JDialogEditor.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import org.gvsig.scripting.ScriptingDialog; |
|
4 |
|
|
5 |
/** |
|
6 |
* <code>JDialogEditor</code> is a component that support edition to a {@link ScriptingDialog). |
|
7 |
* |
|
8 |
* @see JEditor |
|
9 |
* @see JCodeEditor |
|
10 |
* |
|
11 |
*/ |
|
12 |
public interface JDialogEditor extends JCodeEditor { |
|
13 |
|
|
14 |
/** |
|
15 |
* Gets the {@link ScriptingDialog} associated with this JDialogEditor |
|
16 |
* |
|
17 |
* @return {@link ScriptingDialog} |
|
18 |
*/ |
|
19 |
public abstract ScriptingDialog getDialog(); |
|
20 |
|
|
21 |
public abstract void reloadDialog(); |
|
22 |
|
|
23 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JScriptingBrowser.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import java.awt.LayoutManager; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import javax.swing.tree.TreePath; |
|
6 |
|
|
7 |
import org.gvsig.scripting.ScriptingBaseScript; |
|
8 |
|
|
9 |
import org.gvsig.scripting.ScriptingFolder; |
|
10 |
import org.gvsig.scripting.ScriptingManager; |
|
11 |
import org.gvsig.scripting.ScriptingUnit; |
|
12 |
import org.gvsig.tools.swing.api.Component; |
|
13 |
|
|
14 |
/** |
|
15 |
* <code>JScriptingBrowser</code> is a component that shows hierachically a |
|
16 |
* system folder. It launch events on selection or double.clic of each |
|
17 |
* {@link ScriptingUnit}. In case of {@link ScriptingFolder} a selection will |
|
18 |
* load the content lazily, and double-clic will expand it. In case of |
|
19 |
* {@link ScriptingBaseScript} will throw a exception to the |
|
20 |
* {@link JScriptingLauncher} |
|
21 |
* |
|
22 |
* @see JScriptingLauncher |
|
23 |
* |
|
24 |
*/ |
|
25 |
public interface JScriptingBrowser extends Component { |
|
26 |
|
|
27 |
public static final int DEFAULT_ACTION = 1; |
|
28 |
public static final int SELECTION_ACTION = 2; |
|
29 |
public static final int DROPDOWN_ACTION = 3; |
|
30 |
|
|
31 |
public interface BrowserActionEvent { |
|
32 |
|
|
33 |
public Object getSource(); |
|
34 |
|
|
35 |
public int getID(); |
|
36 |
|
|
37 |
public String getActionCommand(); |
|
38 |
|
|
39 |
public ScriptingUnit getUnit(); |
|
40 |
} |
|
41 |
|
|
42 |
public ScriptingManager getManager(); |
|
43 |
|
|
44 |
public ScriptingFolder getRoot(); |
|
45 |
|
|
46 |
public ScriptingUnit getSelectedNode(); |
|
47 |
|
|
48 |
public TreePath getSelectionPath(); |
|
49 |
|
|
50 |
public void setSelectionPath(TreePath path); |
|
51 |
|
|
52 |
public void addActionListener(ActionListener listener); |
|
53 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JThinlet.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.io.File; |
|
6 |
|
|
7 |
import javax.swing.JPanel; |
|
8 |
import javax.swing.event.AncestorEvent; |
|
9 |
|
|
10 |
import thinlet.Thinlet; |
|
11 |
|
|
12 |
public abstract class JThinlet extends JPanel { |
|
13 |
|
|
14 |
/** |
|
15 |
* |
|
16 |
*/ |
|
17 |
private static final long serialVersionUID = -1758582617532787515L; |
|
18 |
|
|
19 |
public abstract void load(File file); |
|
20 |
|
|
21 |
public abstract Thinlet getThinlet(); |
|
22 |
|
|
23 |
public abstract void invoke(String name); |
|
24 |
|
|
25 |
public abstract Dimension getPreferredSize(); |
|
26 |
|
|
27 |
public abstract void ancestorAdded(AncestorEvent event); |
|
28 |
|
|
29 |
public abstract void ancestorMoved(AncestorEvent event); |
|
30 |
|
|
31 |
public abstract void ancestorRemoved(AncestorEvent event); |
|
32 |
|
|
33 |
public abstract void addActionListener(ActionListener actionlistener); |
|
34 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JThinG.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import javax.swing.JPanel; |
|
6 |
|
|
7 |
import thinlet.Thinlet; |
|
8 |
|
|
9 |
/** |
|
10 |
* <code>JThinG</code> is a component that provides an interface to edit the dialog window |
|
11 |
* associated to a {@link ScriptingDialog}. |
|
12 |
* |
|
13 |
* @see JThinlet |
|
14 |
* |
|
15 |
*/ |
|
16 |
public abstract class JThinG extends JPanel{ |
|
17 |
|
|
18 |
/** |
|
19 |
* |
|
20 |
*/ |
|
21 |
private static final long serialVersionUID = -623339194209238547L; |
|
22 |
|
|
23 |
/** |
|
24 |
* Loads the file with the code of the dialog interface. |
|
25 |
* |
|
26 |
* @param file File where is the code of the dialog window of the {@link ScriptingDialog} |
|
27 |
*/ |
|
28 |
public abstract void load(File file); |
|
29 |
|
|
30 |
/** |
|
31 |
* Saves the file with the code of the dialog interface. |
|
32 |
* |
|
33 |
* @param file File where it will be saved the code of the dialog window of the {@link ScriptingDialog} |
|
34 |
*/ |
|
35 |
public abstract void save(File file); |
|
36 |
|
|
37 |
/** |
|
38 |
* Gets the Thinlet Component associated to this. |
|
39 |
* |
|
40 |
* @return Thinlet |
|
41 |
*/ |
|
42 |
public abstract Thinlet getThinlet(); |
|
43 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JScriptingComposer.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import java.awt.event.ActionListener; |
|
4 |
import java.io.File; |
|
5 |
import javax.swing.JPanel; |
|
6 |
import javax.swing.event.ChangeListener; |
|
7 |
import javax.swing.event.ListSelectionListener; |
|
8 |
import org.gvsig.scripting.ScriptingScript; |
|
9 |
|
|
10 |
import org.gvsig.scripting.ScriptingUnit; |
|
11 |
import org.gvsig.tools.swing.api.Component; |
|
12 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
13 |
|
|
14 |
/** |
|
15 |
* <code>JScriptingComposer</code> provides services to the management and |
|
16 |
* edition of the {@link ScriptingUnit}s of the ScriptingFramework. |
|
17 |
* |
|
18 |
* @see JScriptingLauncher |
|
19 |
*/ |
|
20 |
public interface JScriptingComposer extends Component { |
|
21 |
|
|
22 |
public static final String DOCKED_PROBLEMS = "Problems"; |
|
23 |
public static final String DOCKED_CONSOLE = "Console"; |
|
24 |
public static final String DOCKED_PROJECTS = "Projects"; |
|
25 |
|
|
26 |
public interface Dock extends Iterable<Dock.DockedPanel> { |
|
27 |
public static final String DOCK_TOP = "North"; |
|
28 |
public static final String DOCK_BOTTOM = "South"; |
|
29 |
public static final String DOCK_LEFT = "West"; |
|
30 |
public static final String DOCK_RIGHT = "East"; |
|
31 |
public static final String DOCK_CENTER = "Center"; |
|
32 |
|
|
33 |
public static final String ACTION_ACTIVATE_PANEL = "ActivePanel"; |
|
34 |
public static final String ACTION_CLOSE_PANEL = "ClosePanel"; |
|
35 |
|
|
36 |
public interface DockedPanel { |
|
37 |
public String getId(); |
|
38 |
public Component getComponent(); |
|
39 |
public String getTitle(); |
|
40 |
public String getAlign(); |
|
41 |
public boolean isModified(); |
|
42 |
public void setModified(boolean modified); |
|
43 |
public void remove(); |
|
44 |
public void select(); |
|
45 |
public void moveto(String position); |
|
46 |
} |
|
47 |
public DockedPanel add(String id, String title, Component compnent, String position); |
|
48 |
public void remove(String id); |
|
49 |
public DockedPanel get(String id); |
|
50 |
public void select(String id); |
|
51 |
public DockedPanel getSelected(String position); |
|
52 |
public void setModified(DockedPanel panel, boolean modified); |
|
53 |
public boolean getModified(DockedPanel panel); |
|
54 |
public void addCloseListener(ActionListener listener); |
|
55 |
public void removeCloseListener(ActionListener listener); |
|
56 |
public void addActivateListener(ActionListener listener); |
|
57 |
public void removeActivateListener(ActionListener listener); |
|
58 |
} |
|
59 |
|
|
60 |
public interface Problems extends Component { |
|
61 |
public interface Problem { |
|
62 |
public String getType(); |
|
63 |
public String getMessage(); |
|
64 |
public String getResourceName(); |
|
65 |
public File getResource(); |
|
66 |
public int getLineNumber(); |
|
67 |
} |
|
68 |
public void addListSelectionListener(ListSelectionListener listener); |
|
69 |
public Problem getSelect(); |
|
70 |
public int getCount(); |
|
71 |
public Problem get(int n); |
|
72 |
public void removeAll(); |
|
73 |
public void add(String type, String message, String resource, String location); |
|
74 |
public void add(String type, String message, String resource, int line, int column); |
|
75 |
public void add(String type, Exception e) ; |
|
76 |
} |
|
77 |
|
|
78 |
public interface StatusBar extends Component { |
|
79 |
public void clear(); |
|
80 |
|
|
81 |
public void message(String message); |
|
82 |
|
|
83 |
public void setPosition(int line); |
|
84 |
|
|
85 |
public void setPosition(int line, int column); |
|
86 |
} |
|
87 |
|
|
88 |
public JPanel getAboutUsDialog(); |
|
89 |
|
|
90 |
public void setWindowManager(WindowManager windowsManager); |
|
91 |
|
|
92 |
public WindowManager getWindowManager(); |
|
93 |
|
|
94 |
public JEditor getCurrentEditor(); |
|
95 |
|
|
96 |
public ScriptingScript getCurrentScript(); |
|
97 |
|
|
98 |
public Dock getDock(); |
|
99 |
|
|
100 |
public Problems getProblems(); |
|
101 |
|
|
102 |
public JScriptingConsole getConsole(); |
|
103 |
|
|
104 |
public JScriptingLauncher getProjects(); |
|
105 |
|
|
106 |
public StatusBar getStatusbar(); |
|
107 |
|
|
108 |
public void addChangeEditorListener(ChangeListener listener); |
|
109 |
|
|
110 |
public void removeChangeEditorListener(ChangeListener listener); |
|
111 |
|
|
112 |
public void refreshProjects(); |
|
113 |
|
|
114 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/SyntaxtHighlightTextComponent.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.awt.event.KeyListener; |
|
6 |
import javax.swing.Icon; |
|
7 |
|
|
8 |
import javax.swing.JScrollPane; |
|
9 |
import javax.swing.text.JTextComponent; |
|
10 |
import org.gvsig.tools.swing.api.Component; |
|
11 |
|
|
12 |
public interface SyntaxtHighlightTextComponent extends Component { |
|
13 |
|
|
14 |
public interface UpdateCaretPositionActionEvent { |
|
15 |
public int getLine(); |
|
16 |
public int getColumn(); |
|
17 |
public boolean hasLineAndColumn(); |
|
18 |
} |
|
19 |
|
|
20 |
public JTextComponent getJTextComponent(); |
|
21 |
|
|
22 |
public JScrollPane getJScrollPane(); |
|
23 |
|
|
24 |
public void setText(String text); |
|
25 |
|
|
26 |
public String getText(); |
|
27 |
|
|
28 |
public void setContentType(String contentType); |
|
29 |
|
|
30 |
public String getContentType(); |
|
31 |
|
|
32 |
public void addUpdateCaretPositionActionListener(ActionListener updateCaretPosition); |
|
33 |
|
|
34 |
public void addKeyListener(KeyListener keyListener); |
|
35 |
|
|
36 |
public void discardAllEdits(); |
|
37 |
|
|
38 |
public void removeTrackingIcons(); |
|
39 |
|
|
40 |
public void removeTrackingIcons(String tag); |
|
41 |
|
|
42 |
public void addLineTrackingIcon(String tag, int line, Icon icon, String tip, Color color); |
|
43 |
|
|
44 |
public void addLineTrackingIcon(String tag, int line, Icon icon, String tip); |
|
45 |
|
|
46 |
public void gotoline(int line); |
|
47 |
|
|
48 |
} |
|
0 | 49 |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JCodeEditor.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import org.gvsig.scripting.ScriptingScript; |
|
4 |
|
|
5 |
|
|
6 |
/** |
|
7 |
* <code>JCodeEditor</code> is a component that support edition to a {@link ScriptingScript}. |
|
8 |
* |
|
9 |
* @see JEditor |
|
10 |
* @see JDialogEditor |
|
11 |
* |
|
12 |
*/ |
|
13 |
public interface JCodeEditor extends JTextEditor { |
|
14 |
|
|
15 |
public ScriptingScript getScript(); |
|
16 |
|
|
17 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/ScriptingUIManager.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import java.net.URL; |
|
4 |
import java.util.Collection; |
|
5 |
import java.util.List; |
|
6 |
import javax.swing.Action; |
|
7 |
|
|
8 |
import javax.swing.ImageIcon; |
|
9 |
import javax.swing.JComponent; |
|
10 |
import javax.swing.JPanel; |
|
11 |
|
|
12 |
import org.gvsig.about.AboutManager; |
|
13 |
import org.gvsig.scripting.ScriptingDialog; |
|
14 |
import org.gvsig.scripting.ScriptingFolder; |
|
15 |
import org.gvsig.scripting.ScriptingManager; |
|
16 |
import org.gvsig.scripting.ScriptingScript; |
|
17 |
import org.gvsig.scripting.ScriptingUnit; |
|
18 |
import org.gvsig.tools.swing.api.script.ScriptSwingManager; |
|
19 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
20 |
|
|
21 |
/** |
|
22 |
* There are two top level management roles within ScriptingFramework: logical |
|
23 |
* and User's Interface (UI) management. |
|
24 |
* |
|
25 |
* This class is responsible of the UI management role. It provides all the |
|
26 |
* components shown in the ScriptingFramework. |
|
27 |
* |
|
28 |
* @see ScriptingManager |
|
29 |
* |
|
30 |
*/ |
|
31 |
public interface ScriptingUIManager extends ScriptSwingManager { |
|
32 |
public static final String SCRIPT_COMPOSER_AUTORUN = "scautorun"; |
|
33 |
|
|
34 |
/** |
|
35 |
* Creates a new {@link JScriptingLauncher} component. |
|
36 |
* |
|
37 |
* @return a new {@link JScriptingLauncher}. |
|
38 |
* |
|
39 |
* @see JScriptingLauncher |
|
40 |
*/ |
|
41 |
public JScriptingLauncher createLauncher(); |
|
42 |
|
|
43 |
/** |
|
44 |
* Creates a new {@link JScriptingComposer} component. |
|
45 |
* |
|
46 |
* @return a new {@link JScriptingComposer}. |
|
47 |
* |
|
48 |
* @see JScriptingComposer |
|
49 |
*/ |
|
50 |
public JScriptingComposer createComposer(); |
|
51 |
|
|
52 |
/** |
|
53 |
* Creates a new {@link JScriptingBrowser} component. |
|
54 |
* |
|
55 |
* @param root {@link ScriptingFolder} that identificates the image. |
|
56 |
* @param foldersOnly boolean to indicate if only will be shown folders (if |
|
57 |
* it's true) or it will be shown the ScriptingBaseScript files too (false |
|
58 |
* value). By default, false |
|
59 |
* |
|
60 |
* @return a new {@link JScriptingBrowser}. |
|
61 |
* |
|
62 |
* @see JScriptingBrowser |
|
63 |
*/ |
|
64 |
public JScriptingBrowser createBrowser(ScriptingFolder root, boolean foldersOnly); |
|
65 |
|
|
66 |
/** |
|
67 |
* Creates a new {@link JScriptingBrowser} component. |
|
68 |
* |
|
69 |
* @param root {@link ScriptingFolder} that identificates the image. |
|
70 |
* |
|
71 |
* @return a new {@link JScriptingBrowser}. |
|
72 |
* |
|
73 |
* @see JScriptingBrowser |
|
74 |
*/ |
|
75 |
public JScriptingBrowser createBrowser(ScriptingFolder root); |
|
76 |
|
|
77 |
/** |
|
78 |
* Creates a new {@link JScriptingInstaller} component. |
|
79 |
* |
|
80 |
* @return a new {@link JScriptingInstaller}. |
|
81 |
* |
|
82 |
* @see JScriptingInstaller |
|
83 |
*/ |
|
84 |
public JPanel createInstaller(); |
|
85 |
|
|
86 |
/** |
|
87 |
* Creates a new JEditorPane component with syntax highlight. |
|
88 |
* |
|
89 |
* @return a new {@link JEditorPaneSyntaxHighlighting}. |
|
90 |
* |
|
91 |
* @see JEditorPaneSyntaxHighlighting |
|
92 |
*/ |
|
93 |
public SyntaxtHighlightTextComponent createSyntaxHighlightingPanel(); |
|
94 |
|
|
95 |
/** |
|
96 |
* Creates a new {@link JCodeEditor} component. |
|
97 |
* @param script |
|
98 |
* @return a new {@link JCodeEditor}. |
|
99 |
* |
|
100 |
* @see JCodeEditor |
|
101 |
*/ |
|
102 |
public JCodeEditor createJCodeEditor(ScriptingScript script); |
|
103 |
|
|
104 |
/** |
|
105 |
* Creates a new {@link JDialogEditor} component. |
|
106 |
* |
|
107 |
* @param uimanager |
|
108 |
* @param script |
|
109 |
* @return a new {@link JDialogEditor}. |
|
110 |
* |
|
111 |
* @see JDialogEditor |
|
112 |
*/ |
|
113 |
public JDialogEditor createJDialogEditor(ScriptingDialog script); |
|
114 |
|
|
115 |
/** |
|
116 |
* Creates a new {@link JThinlet} component. |
|
117 |
* |
|
118 |
* @return a new {@link JThinlet}. |
|
119 |
* |
|
120 |
* @see JThinlet |
|
121 |
*/ |
|
122 |
public JThinlet createJThinlet(); |
|
123 |
|
|
124 |
/** |
|
125 |
* Creates a new {@link JThinG} component. |
|
126 |
* |
|
127 |
* @return a new {@link JThinG}. |
|
128 |
* |
|
129 |
* @see JThinG |
|
130 |
*/ |
|
131 |
public JThinG createJThinG(); |
|
132 |
|
|
133 |
/** |
|
134 |
* Creates a JEditor for the scripting unit passed as parameter. |
|
135 |
* Return null if not exists an editor for this unit. |
|
136 |
* |
|
137 |
* @param unit |
|
138 |
* @return |
|
139 |
*/ |
|
140 |
public JEditor createEditor(ScriptingUnit unit); |
|
141 |
|
|
142 |
/** |
|
143 |
* Returns a ImageIcon associated with the name. |
|
144 |
* |
|
145 |
* @param name String that identificates the image. |
|
146 |
* |
|
147 |
* @return the ImageIcon identified by the String name. |
|
148 |
*/ |
|
149 |
public ImageIcon getIcon(String name); |
|
150 |
|
|
151 |
/** |
|
152 |
* Returns a ImageIcon associated with the name. |
|
153 |
* |
|
154 |
* @param name String that identificates the image. |
|
155 |
* @param size String to specify if the size of the icon would be "small", |
|
156 |
* "medium" or "big" (default value: "small"). |
|
157 |
* |
|
158 |
* @return the ImageIcon identified by the String name. |
|
159 |
*/ |
|
160 |
public ImageIcon getIcon(String name, String size); |
|
161 |
|
|
162 |
/** |
|
163 |
* Returns the {@link ScriptingManager} of the ScriptingFramework. |
|
164 |
* |
|
165 |
* @return {@link ScriptingManager} |
|
166 |
*/ |
|
167 |
public ScriptingManager getManager(); |
|
168 |
|
|
169 |
/** |
|
170 |
* Returns the {@link AboutManager} to provide services of the 'About Us' |
|
171 |
* information of the ScriptingFramework. |
|
172 |
* |
|
173 |
* @return the {@link AboutManager} |
|
174 |
* |
|
175 |
* @see AboutManager |
|
176 |
*/ |
|
177 |
public AboutManager getAboutManager(); |
|
178 |
|
|
179 |
/** |
|
180 |
* Shows a JPanel in a dialog window with it's own characteristics |
|
181 |
* |
|
182 |
* @param panel JPanel included in the dialog's content |
|
183 |
* @param title String with the dialog's title |
|
184 |
* |
|
185 |
*/ |
|
186 |
public void showDialog(JComponent panel, String title); |
|
187 |
|
|
188 |
/** |
|
189 |
* Shows a JPanel in a window with it's own characteristics |
|
190 |
* |
|
191 |
* @param panel JPanel included in the window's content |
|
192 |
* @param title String with the window's title |
|
193 |
* |
|
194 |
*/ |
|
195 |
public void showWindow(JComponent panel, String title); |
|
196 |
|
|
197 |
/** |
|
198 |
* Shows a JPanel in a tool window with it's own characteristics |
|
199 |
* |
|
200 |
* @param panel JPanel included in the tool's content |
|
201 |
* @param title String with the tool's title |
|
202 |
* |
|
203 |
*/ |
|
204 |
public void showTool(JComponent panel, String title); |
|
205 |
|
|
206 |
public String getTranslation(String key); |
|
207 |
|
|
208 |
public void setWindowManager(WindowManager windowsManager); |
|
209 |
|
|
210 |
public WindowManager getWindowManager(); |
|
211 |
|
|
212 |
public JScriptingConsole createJScriptingConsole(); |
|
213 |
|
|
214 |
public JScriptingConsole createJScriptingConsole(boolean captureOutput); |
|
215 |
|
|
216 |
public void addComposerTool(Action action); |
|
217 |
|
|
218 |
public void addComposerMenu(String text, Action action); |
|
219 |
|
|
220 |
public Collection<Action> getComposerTools(); |
|
221 |
|
|
222 |
public interface MenuEntry { |
|
223 |
public String getText(); |
|
224 |
public Action getAction(); |
|
225 |
} |
|
226 |
public Collection<MenuEntry> getComposerMenus(); |
|
227 |
|
|
228 |
public JScriptingComposer getActiveComposer(); |
|
229 |
|
|
230 |
public void addCreatedComponentListener(CreateComponentListener listener); |
|
231 |
|
|
232 |
public void removeCreatedComponentListener(CreateComponentListener listener); |
|
233 |
|
|
234 |
public void registerEditor(EditorFactory factory); |
|
235 |
|
|
236 |
public boolean hasEditor(ScriptingUnit unit); |
|
237 |
|
|
238 |
public List<EditorFactory> getEditorFactories(); |
|
239 |
|
|
240 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/CreateComponentListener.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.scripting.swing.api; |
|
3 |
|
|
4 |
import org.gvsig.tools.swing.api.Component; |
|
5 |
|
|
6 |
public interface CreateComponentListener { |
|
7 |
public void componentCreated(Component component); |
|
8 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/ScriptingSwingLocator.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import org.gvsig.tools.locator.BaseLocator; |
|
4 |
|
|
5 |
public class ScriptingSwingLocator extends BaseLocator { |
|
6 |
|
|
7 |
private static final String LOCATOR_NAME = "ScriptingSwingLocator"; |
|
8 |
|
|
9 |
public static final String UIMANAGER_NAME = "scriptingswinglocator.uimanager"; |
|
10 |
|
|
11 |
public static final String UIMANAGER_DESCRIPTION = "Scripting UIManager"; |
|
12 |
|
|
13 |
/** |
|
14 |
* Unique instance. |
|
15 |
*/ |
|
16 |
private static final ScriptingSwingLocator instance = new ScriptingSwingLocator(); |
|
17 |
|
|
18 |
/** |
|
19 |
* Return the singleton instance. |
|
20 |
* |
|
21 |
* @return the singleton instance |
|
22 |
*/ |
|
23 |
public static ScriptingSwingLocator getInstance() { |
|
24 |
return instance; |
|
25 |
} |
|
26 |
|
|
27 |
/** |
|
28 |
* Return the Locator's name |
|
29 |
* |
|
30 |
* @return a String with the Locator's name |
|
31 |
*/ |
|
32 |
@Override |
|
33 |
public String getLocatorName() { |
|
34 |
return LOCATOR_NAME; |
|
35 |
} |
|
36 |
|
|
37 |
/** |
|
38 |
* Registers the Class implementing the ScriptingUIManager interface. |
|
39 |
* |
|
40 |
* @param clazz |
|
41 |
* implementing the ScriptingUIManager interface |
|
42 |
*/ |
|
43 |
public static void registerUIManager( |
|
44 |
Class<? extends ScriptingUIManager> clazz) { |
|
45 |
getInstance().register(UIMANAGER_NAME, UIMANAGER_DESCRIPTION, clazz); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* Gets the instance of the {@link ScriptingUIManager} registered. |
|
50 |
* |
|
51 |
* @return {@link ScriptingUIManager} |
|
52 |
*/ |
|
53 |
public static ScriptingUIManager getUIManager() { |
|
54 |
return (ScriptingUIManager) getInstance().get(UIMANAGER_NAME); |
|
55 |
} |
|
56 |
|
|
57 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JScriptingLauncher.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
import java.awt.event.ActionEvent; |
|
5 |
import java.awt.event.ActionListener; |
|
6 |
import org.gvsig.scripting.ScriptingBaseScript; |
|
7 |
import org.gvsig.tools.swing.api.Component; |
|
8 |
|
|
9 |
/** |
|
10 |
* <code>JScriptingLauncher</code> is a component that contains |
|
11 |
* {@link JScriptingBrowser}s to navigate for the User's Folder and for System's |
|
12 |
* Folder. It has a tab for each {@link JScriptingBrowser}. It catches the |
|
13 |
* exceptions throws by {@link JScriptingBrowser} and it do the associated |
|
14 |
* action or throw a new exception to the {@link JScriptingComposer} (if it's |
|
15 |
* included on it) |
|
16 |
* |
|
17 |
* @see JScriptingBrowser |
|
18 |
* @see JScriptingComposer |
|
19 |
* |
|
20 |
*/ |
|
21 |
public interface JScriptingLauncher extends Component { |
|
22 |
|
|
23 |
public static final int DEFAULT_ACTION = 1; |
|
24 |
public static final int SELECTION_ACTION = 2; |
|
25 |
public static final int DROPDOWN_ACTION = 3; |
|
26 |
|
|
27 |
/** |
|
28 |
* Reloads the content of the {@link JScriptingBrowser}s |
|
29 |
* |
|
30 |
*/ |
|
31 |
public void refresh(); |
|
32 |
|
|
33 |
/** |
|
34 |
* Return the selected browser in this launcher. |
|
35 |
* |
|
36 |
* @return |
|
37 |
*/ |
|
38 |
public JScriptingBrowser getSelectedBrowser(); |
|
39 |
|
|
40 |
/** |
|
41 |
* Registra un listener para ser informado cuando se realiza doble click |
|
42 |
* sobre un ScriptingUnit. |
|
43 |
* |
|
44 |
* @param listener |
|
45 |
*/ |
|
46 |
public void addDefaultActionListener(ActionListener listener); |
|
47 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JScriptingConsole.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.scripting.swing.api; |
|
3 |
|
|
4 |
import java.awt.Color; |
|
5 |
import java.io.PrintStream; |
|
6 |
import java.io.Writer; |
|
7 |
import org.gvsig.tools.swing.api.Component; |
|
8 |
|
|
9 |
public interface JScriptingConsole extends Component { |
|
10 |
|
|
11 |
public void append(String s); |
|
12 |
|
|
13 |
public void append(String msg, Color color); |
|
14 |
|
|
15 |
public void clear(); |
|
16 |
|
|
17 |
public PrintStream errors(); |
|
18 |
|
|
19 |
public PrintStream output(); |
|
20 |
|
|
21 |
public Writer getOutputWriter(); |
|
22 |
|
|
23 |
public Writer getErrorsWriter(); |
|
24 |
|
|
25 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/ScriptingSwingLibrary.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import org.gvsig.scripting.ScriptingLibrary; |
|
4 |
import org.gvsig.tools.library.AbstractLibrary; |
|
5 |
import org.gvsig.tools.library.LibraryException; |
|
6 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
7 |
|
|
8 |
public class ScriptingSwingLibrary extends AbstractLibrary { |
|
9 |
|
|
10 |
@Override |
|
11 |
public void doRegistration() { |
|
12 |
registerAsAPI(ScriptingSwingLibrary.class); |
|
13 |
require(ScriptingLibrary.class); |
|
14 |
} |
|
15 |
|
|
16 |
@Override |
|
17 |
protected void doInitialize() throws LibraryException { |
|
18 |
// Nothing to do |
|
19 |
} |
|
20 |
|
|
21 |
@Override |
|
22 |
protected void doPostInitialize() throws LibraryException { |
|
23 |
// Validate there is any implementation registered. |
|
24 |
ScriptingUIManager manager = ScriptingSwingLocator.getUIManager(); |
|
25 |
|
|
26 |
if (manager == null) { |
|
27 |
throw new ReferenceNotRegisteredException( |
|
28 |
ScriptingSwingLocator.UIMANAGER_NAME, |
|
29 |
ScriptingSwingLocator.getInstance()); |
|
30 |
} |
|
31 |
} |
|
32 |
|
|
33 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/swing/api/JEditor.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.api; |
|
2 |
|
|
3 |
import java.awt.event.ActionListener; |
|
4 |
import java.beans.PropertyChangeListener; |
|
5 |
|
|
6 |
import org.gvsig.scripting.ScriptingBaseScript; |
|
7 |
|
|
8 |
import org.gvsig.scripting.ScriptingUnit; |
|
9 |
import org.gvsig.tools.swing.api.Component; |
|
10 |
|
|
11 |
/** |
|
12 |
* <code>AbstractJEditor</code> is a component that provides services to edit the content of |
|
13 |
* a {@link ScriptingBaseScript}. |
|
14 |
* |
|
15 |
* @see JCodeEditor |
|
16 |
* @see JDialogEditor |
|
17 |
* |
|
18 |
*/ |
|
19 |
public interface JEditor extends Component { |
|
20 |
|
|
21 |
public ScriptingUnit getUnit(); |
|
22 |
|
|
23 |
public void addChangeListener(PropertyChangeListener listener); |
|
24 |
|
|
25 |
public void save(); |
|
26 |
|
|
27 |
public boolean isModified(); |
|
28 |
|
|
29 |
public void set(ScriptingUnit unit); |
|
30 |
|
|
31 |
public void fetch(ScriptingUnit unit); |
|
32 |
|
|
33 |
} |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/java/org/gvsig/scripting/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.scripting package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example library description.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#packagecomment">Javadoc Tool documentation about the package file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/javadoc/overview.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.scripting package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example library overview.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#overviewcomment">Javadoc Tool documentation about the overview file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.scripting.swing.api.ScriptingSwingLibrary |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/resources/org/gvsig/scripting/i18n/text.properties | ||
---|---|---|
1 |
# Resource bundle texts for the Spanish language locale (es) |
|
2 |
Example.returns_value=devuelve el valor |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/resources/org/gvsig/scripting/i18n/text_en.properties | ||
---|---|---|
1 |
# Resource bundle texts for the English language locale (en) |
|
2 |
Example.returns_value=returns value |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/resources/overview.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.scripting package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>TODO: Example library overview.</p> |
|
11 |
|
|
12 |
<p>See the <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#overviewcomment">Javadoc Tool documentation about the overview file</a></p> |
|
13 |
|
|
14 |
</body> |
|
15 |
</html> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your library classes. |
|
2 |
|
|
3 |
This folder is added to the runtime classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, into this folder you can find some examples of resource bundle |
|
7 |
property files that may be used by your library classes. |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.api/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.scripting.swing.api</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.scripting.swing.api</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.scripting.swing</artifactId> |
|
11 |
<version>2.3.141</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
17 |
<scope>compile</scope> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
22 |
<scope>compile</scope> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.i18n</artifactId> |
|
27 |
<scope>compile</scope> |
|
28 |
</dependency> |
|
29 |
<dependency> |
|
30 |
<groupId>org.gvsig</groupId> |
|
31 |
<artifactId>org.gvsig.scripting.thing</artifactId> |
|
32 |
<scope>compile</scope> |
|
33 |
</dependency> |
|
34 |
<dependency> |
|
35 |
<groupId>org.gvsig</groupId> |
|
36 |
<artifactId>org.gvsig.about.api</artifactId> |
|
37 |
<scope>compile</scope> |
|
38 |
</dependency> |
|
39 |
<dependency> |
|
40 |
<groupId>org.gvsig</groupId> |
|
41 |
<artifactId>org.gvsig.scripting.lib.api</artifactId> |
|
42 |
<scope>compile</scope> |
|
43 |
</dependency> |
|
44 |
<dependency> |
|
45 |
<groupId>javax.help</groupId> |
|
46 |
<artifactId>javahelp</artifactId> |
|
47 |
<scope>compile</scope> |
|
48 |
</dependency> |
|
49 |
</dependencies> |
|
50 |
</project> |
|
0 | 51 |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.scripting.swing</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.scripting</artifactId> |
|
11 |
<version>2.3.141</version> |
|
12 |
</parent> |
|
13 |
<modules> |
|
14 |
<module>org.gvsig.scripting.swing.api</module> |
|
15 |
<module>org.gvsig.scripting.swing.impl</module> |
|
16 |
</modules> |
|
17 |
</project> |
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.141/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/syntaxhighlight/JRSyntaxTextArea.java | ||
---|---|---|
1 |
package org.gvsig.scripting.swing.impl.syntaxhighlight; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Color; |
|
5 |
import java.awt.Component; |
|
6 |
import java.awt.Container; |
|
7 |
import java.awt.Cursor; |
|
8 |
import java.awt.Dimension; |
|
9 |
import java.awt.Font; |
|
10 |
import java.awt.Point; |
|
11 |
import java.awt.Rectangle; |
|
12 |
import java.awt.event.ActionEvent; |
|
13 |
import java.awt.event.ActionListener; |
|
14 |
import java.awt.event.InputEvent; |
|
15 |
import java.awt.event.KeyEvent; |
|
16 |
import java.awt.event.KeyListener; |
|
17 |
import java.awt.event.MouseAdapter; |
|
18 |
import java.awt.event.MouseEvent; |
|
19 |
import java.net.URL; |
|
20 |
import java.util.ArrayList; |
|
21 |
import java.util.Arrays; |
|
22 |
import java.util.Comparator; |
|
23 |
import java.util.HashMap; |
|
24 |
import java.util.HashSet; |
|
25 |
import java.util.List; |
|
26 |
import java.util.Map; |
|
27 |
import java.util.Set; |
|
28 |
import java.util.TreeSet; |
|
29 |
import javax.swing.DefaultListCellRenderer; |
|
30 |
import javax.swing.Icon; |
|
31 |
import javax.swing.ImageIcon; |
|
32 |
import javax.swing.JCheckBox; |
|
33 |
import javax.swing.JComponent; |
|
34 |
import javax.swing.JLabel; |
|
35 |
import javax.swing.JList; |
|
36 |
import javax.swing.JOptionPane; |
|
37 |
import javax.swing.JPanel; |
|
38 |
|
|
39 |
import javax.swing.JScrollPane; |
|
40 |
import javax.swing.JViewport; |
|
41 |
import javax.swing.KeyStroke; |
|
42 |
import javax.swing.SwingUtilities; |
|
43 |
import javax.swing.UIDefaults; |
|
44 |
import javax.swing.UIManager; |
|
45 |
import javax.swing.event.CaretEvent; |
|
46 |
import javax.swing.event.CaretListener; |
|
47 |
import javax.swing.text.BadLocationException; |
|
48 |
import javax.swing.text.Element; |
|
49 |
import javax.swing.text.JTextComponent; |
|
50 |
import org.apache.commons.lang3.StringUtils; |
|
51 |
import org.fife.rsta.ui.CollapsibleSectionPanel; |
|
52 |
import org.fife.rsta.ui.search.FindToolBar; |
|
53 |
import org.fife.rsta.ui.search.ReplaceToolBar; |
|
54 |
import org.fife.rsta.ui.search.SearchEvent; |
|
55 |
import org.fife.rsta.ui.search.SearchListener; |
|
56 |
import org.fife.ui.autocomplete.AutoCompletion; |
|
57 |
import org.fife.ui.autocomplete.BasicCompletion; |
|
58 |
import org.fife.ui.autocomplete.Completion; |
|
59 |
import org.fife.ui.autocomplete.CompletionProvider; |
|
60 |
import org.fife.ui.autocomplete.DefaultCompletionProvider; |
|
61 |
|
|
62 |
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; |
|
63 |
import org.fife.ui.rsyntaxtextarea.SyntaxConstants; |
|
64 |
import org.fife.ui.rsyntaxtextarea.TokenMakerFactory; |
|
65 |
import org.fife.ui.rtextarea.GutterIconInfo; |
|
66 |
import org.fife.ui.rtextarea.RTextScrollPane; |
|
67 |
import org.fife.ui.rtextarea.SearchContext; |
|
68 |
import org.fife.ui.rtextarea.SearchEngine; |
|
69 |
import org.fife.ui.rtextarea.SearchResult; |
|
70 |
import org.gvsig.scripting.swing.api.ScriptingSwingLocator; |
|
71 |
import org.gvsig.scripting.swing.api.ScriptingUIManager; |
|
72 |
import org.gvsig.scripting.swing.api.SyntaxtHighlightTextComponent; |
|
73 |
import org.slf4j.Logger; |
|
74 |
import org.slf4j.LoggerFactory; |
|
75 |
|
|
76 |
public class JRSyntaxTextArea implements SyntaxtHighlightTextComponent, SearchListener { |
|
77 |
|
|
78 |
private static final Logger logger = LoggerFactory.getLogger(JRSyntaxTextArea.class); |
|
79 |
|
|
80 |
public static class MyCheckBox extends JCheckBox { |
|
81 |
|
|
82 |
private static final String uiClassID = "ToggleButtonUI"; |
|
83 |
|
|
84 |
@Override |
|
85 |
public String getUIClassID() { |
|
86 |
return uiClassID; |
|
87 |
} |
|
88 |
|
|
89 |
} |
|
90 |
|
|
91 |
private class MyFindToolBar extends FindToolBar { |
|
92 |
|
|
93 |
public MyFindToolBar(SearchListener listener) { |
|
94 |
super(listener); |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
protected JCheckBox createCB(String key) { |
|
99 |
JCheckBox cb = new MyCheckBox(); |
|
100 |
cb.setToolTipText(searchMsg.getString(key)); |
|
101 |
cb.addActionListener(listener); |
|
102 |
cb.addMouseListener(listener); |
|
103 |
cb.setIcon(getIcon("scripting-search-" + key.toLowerCase())); |
|
104 |
return cb; |
|
105 |
} |
|
106 |
|
|
107 |
} |
|
108 |
|
|
109 |
private class MyReplaceToolBar extends ReplaceToolBar { |
|
110 |
|
|
111 |
public MyReplaceToolBar(SearchListener listener) { |
|
112 |
super(listener); |
|
113 |
} |
|
114 |
|
|
115 |
@Override |
|
116 |
protected JCheckBox createCB(String key) { |
|
117 |
JCheckBox cb = new MyCheckBox(); |
|
118 |
cb.setToolTipText(searchMsg.getString(key)); |
|
119 |
cb.addActionListener(listener); |
|
120 |
cb.addMouseListener(listener); |
|
121 |
cb.setIcon(getIcon("scripting-search-" + key.toLowerCase())); |
|
122 |
return cb; |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 |
private class LineTrackerPanel extends JPanel { |
|
127 |
|
|
128 |
private static final long serialVersionUID = -1923556745197997373L; |
|
129 |
|
|
130 |
private class Line extends JLabel { |
|
131 |
|
|
132 |
private static final long serialVersionUID = 8966359978957026490L; |
|
133 |
private final int lineno; |
|
134 |
private final String tag; |
|
135 |
|
|
136 |
public Line(String tag, final int lineno, int posy, Color color, String tooltip) { |
|
137 |
UIDefaults uidefaults = UIManager.getLookAndFeel().getDefaults(); |
|
138 |
this.setBackground((Color) uidefaults.get("EditorPane.background")); |
|
139 |
this.setForeground((Color) uidefaults.get("EditorPane.foreground")); |
|
140 |
|
|
141 |
this.lineno = lineno; |
|
142 |
this.tag = tag; |
|
143 |
this.setBackground(color); |
|
144 |
this.setBounds(0, posy, 15, 2); |
|
145 |
this.setOpaque(true); |
|
146 |
this.setToolTipText(tooltip); |
|
147 |
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
148 |
this.addMouseListener(new MouseAdapter() { |
|
149 |
|
|
150 |
@Override |
|
151 |
public void mouseClicked(MouseEvent e) { |
|
152 |
gotoline(lineno); |
|
153 |
} |
|
154 |
}); |
|
155 |
// Rectangle r = this.getBounds(); |
|
156 |
// logger.info("LineTracker: created lineno:"+lineno+", tag:"+tag+", x:"+ r.x + ", y:"+ r.y + ", w:"+ r.width+", h:"+ r.height); |
|
157 |
} |
|
158 |
|
|
159 |
public int getLineno() { |
|
160 |
return this.lineno; |
|
161 |
} |
|
162 |
|
|
163 |
public String getTag() { |
|
164 |
return this.tag; |
|
165 |
} |
|
166 |
} |
|
167 |
|
|
168 |
public LineTrackerPanel() { |
|
169 |
setLayout(null); |
|
170 |
} |
|
171 |
|
|
172 |
@Override |
|
173 |
public Dimension getPreferredSize() { |
|
174 |
Dimension d = super.getPreferredSize(); |
|
175 |
return new Dimension(15, d.height); |
|
176 |
} |
|
177 |
|
|
178 |
public void addLineTracker(String tag, int lineno, String tooltip, Color color) { |
|
179 |
int posy = (int) (((float)lineno)*this.getSize().height / textArea.getLineCount()); |
|
180 |
Line line = new Line(tag,lineno,posy,color,tooltip); |
|
181 |
this.add(line); |
|
182 |
this.repaint(); |
|
183 |
} |
|
184 |
|
|
185 |
public void removeLineTrackers() { |
|
186 |
this.removeAll(); |
|
187 |
this.repaint(); |
|
188 |
} |
|
189 |
|
|
190 |
public void removeLineTrackers(String tag) { |
|
191 |
if( StringUtils.isEmpty(tag) ) { |
|
192 |
return; |
|
193 |
} |
|
194 |
List<Line> toremove = new ArrayList<>(); |
|
195 |
for( int i=0; i<this.getComponentCount(); i++ ) { |
|
196 |
Line line = (Line) this.getComponent(i); |
|
197 |
if( tag.equalsIgnoreCase(line.getTag()) ) { |
|
198 |
toremove.add(line); |
|
199 |
} |
|
200 |
} |
|
201 |
for (Line line : toremove) { |
|
202 |
this.remove(line); |
|
203 |
} |
|
204 |
this.repaint(); |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
private static class IconsTracker { |
|
209 |
|
|
210 |
private Map<String,Set<GutterIconInfo>>iconInfos = new HashMap<>(); |
|
211 |
|
|
212 |
public IconsTracker() { |
|
213 |
|
|
214 |
} |
|
215 |
|
|
216 |
public void add(String tag, GutterIconInfo x) { |
|
217 |
Set<GutterIconInfo> set = this.iconInfos.get(tag); |
|
218 |
if( set == null ) { |
|
219 |
set = new HashSet<>(); |
|
220 |
this.iconInfos.put(tag, set); |
|
221 |
} |
|
222 |
set.add(x); |
|
223 |
} |
|
224 |
|
|
225 |
public void removeAll() { |
|
226 |
this.iconInfos = new HashMap<>(); |
|
227 |
} |
|
228 |
|
|
229 |
public void remove(String tag) { |
|
230 |
this.iconInfos.remove(tag); |
|
231 |
} |
|
232 |
|
|
233 |
public void remove(String tag, GutterIconInfo x) { |
|
234 |
Set<GutterIconInfo> set = this.iconInfos.get(tag); |
|
235 |
if( set == null ) { |
|
236 |
return; |
|
237 |
} |
|
238 |
set.remove(x); |
|
239 |
} |
|
240 |
|
|
241 |
public boolean exists(String tag) { |
|
242 |
return this.iconInfos.containsKey(tag); |
|
243 |
} |
|
244 |
|
|
245 |
public Set<GutterIconInfo> get(String tag) { |
|
246 |
Set<GutterIconInfo> set = this.iconInfos.get(tag); |
|
247 |
return set; |
|
248 |
} |
|
249 |
} |
|
250 |
|
|
251 |
private final FindToolBar findToolBar; |
|
252 |
private final ReplaceToolBar replaceToolBar; |
|
253 |
private final CollapsibleSectionPanel csp; |
|
254 |
|
|
255 |
public class DefaultUpdateCaretPositionActionEvent extends ActionEvent implements UpdateCaretPositionActionEvent { |
|
256 |
|
|
257 |
/** |
|
258 |
* |
|
259 |
*/ |
|
260 |
private static final long serialVersionUID = 8238486105726094074L; |
|
261 |
int line = -1; |
|
262 |
int column = -1; |
|
263 |
|
|
264 |
public DefaultUpdateCaretPositionActionEvent(Object source, int id, |
|
265 |
String command, int line, int column) { |
|
266 |
super(source, id, command); |
|
267 |
this.line = line; |
|
268 |
this.column = column; |
|
269 |
} |
|
270 |
|
|
271 |
public int getLine() { |
|
272 |
return this.line + 1; |
|
273 |
} |
|
274 |
|
|
275 |
public int getColumn() { |
|
276 |
return this.column; |
|
277 |
} |
|
278 |
|
Also available in: Unified diff