Revision 1600
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/test/java/org/gvsig/tools/AppTest.java | ||
---|---|---|
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 |
package org.gvsig.tools; |
|
25 |
|
|
26 |
import junit.framework.Test; |
|
27 |
import junit.framework.TestCase; |
|
28 |
import junit.framework.TestSuite; |
|
29 |
|
|
30 |
/** |
|
31 |
* Unit test for simple App. |
|
32 |
*/ |
|
33 |
public class AppTest extends TestCase { |
|
34 |
|
|
35 |
/** |
|
36 |
* @return the suite of tests being tested |
|
37 |
*/ |
|
38 |
public static Test suite() { |
|
39 |
return new TestSuite(AppTest.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Create the test case |
|
44 |
* |
|
45 |
* @param testName |
|
46 |
* name of the test case |
|
47 |
*/ |
|
48 |
public AppTest(String testName) { |
|
49 |
super(testName); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* Rigourous Test :-) |
|
54 |
*/ |
|
55 |
public void testApp() { |
|
56 |
assertTrue(true); |
|
57 |
} |
|
58 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ActionListenerSupport.java | ||
---|---|---|
1 |
package org.gvsig.tools.swing.api; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
|
|
6 |
public interface ActionListenerSupport { |
|
7 |
|
|
8 |
public void addActionListener(ActionListener listener); |
|
9 |
|
|
10 |
public ActionListener[] getActionListeners(); |
|
11 |
|
|
12 |
public void removeActionListener(ActionListener listener); |
|
13 |
|
|
14 |
public void removeAllActionListener(); |
|
15 |
|
|
16 |
public void fireActionEvent(ActionEvent event); |
|
17 |
|
|
18 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/evaluator/EvaluatorPanel.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2013 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.tools.swing.api.evaluator; |
|
24 |
|
|
25 |
import javax.swing.JPanel; |
|
26 |
|
|
27 |
import org.gvsig.tools.dynobject.DynClass; |
|
28 |
import org.gvsig.tools.evaluator.EvaluatorWithDescriptions; |
|
29 |
|
|
30 |
|
|
31 |
/** |
|
32 |
* @author jldominguez |
|
33 |
* |
|
34 |
*/ |
|
35 |
public abstract class EvaluatorPanel extends JPanel { |
|
36 |
|
|
37 |
public abstract void initialize(DynClass dclass, EvaluatorWithDescriptions evaluator); |
|
38 |
public abstract String getExpression(); |
|
39 |
|
|
40 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/evaluator/ComponentSwingManager.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2013 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.tools.swing.api.evaluator; |
|
24 |
|
|
25 |
import org.gvsig.tools.dynobject.DynClass; |
|
26 |
import org.gvsig.tools.evaluator.EvaluatorWithDescriptions; |
|
27 |
|
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
* This manager will provide useful Swing-based components |
|
32 |
* which can be re-used in different parts of the application |
|
33 |
* (for example, a panel to form an expression, a panel to preview |
|
34 |
* and select something, etc) |
|
35 |
* |
|
36 |
* |
|
37 |
* |
|
38 |
* @author jldominguez |
|
39 |
* |
|
40 |
*/ |
|
41 |
public interface ComponentSwingManager { |
|
42 |
|
|
43 |
public EvaluatorPanel getEvaluatorPanel( |
|
44 |
DynClass dclass, EvaluatorWithDescriptions evaluator); |
|
45 |
|
|
46 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/TaskStatusSwingManager.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api.task; |
|
25 |
|
|
26 |
import org.gvsig.tools.task.TaskStatusManager; |
|
27 |
|
|
28 |
public interface TaskStatusSwingManager { |
|
29 |
|
|
30 |
public JTasksStatus createJTasksStatus(); |
|
31 |
|
|
32 |
public JTasksStatus createJTasksStatus(TaskStatusManager manager); |
|
33 |
|
|
34 |
public JTaskStatus createJTaskStatus(); |
|
35 |
|
|
36 |
public JTasksStatusList createJTasksStatusList(TaskStatusManager manager); |
|
37 |
} |
|
0 | 38 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatusList.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api.task; |
|
25 |
|
|
26 |
import javax.swing.JPanel; |
|
27 |
|
|
28 |
import org.gvsig.tools.task.TaskStatusManager; |
|
29 |
|
|
30 |
public abstract class JTasksStatusList extends JPanel { |
|
31 |
|
|
32 |
/** |
|
33 |
* |
|
34 |
*/ |
|
35 |
private static final long serialVersionUID = -2712653249045541115L; |
|
36 |
|
|
37 |
public abstract TaskStatusManager getManager(); |
|
38 |
|
|
39 |
} |
|
40 |
|
|
0 | 41 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTaskStatus.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api.task; |
|
25 |
|
|
26 |
import javax.swing.JPanel; |
|
27 |
|
|
28 |
import org.gvsig.tools.swing.api.Component; |
|
29 |
import org.gvsig.tools.task.TaskStatus; |
|
30 |
|
|
31 |
public abstract class JTaskStatus extends JPanel implements Component { |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* |
|
36 |
*/ |
|
37 |
private static final long serialVersionUID = -6606077362610993539L; |
|
38 |
|
|
39 |
public abstract void bind(TaskStatus taskStatus); |
|
40 |
|
|
41 |
public abstract boolean getShowCancelButton() ; |
|
42 |
|
|
43 |
public abstract void setShowCancelButton(boolean showCancelButton); |
|
44 |
|
|
45 |
public abstract boolean getShowRemoveTaskButton(); |
|
46 |
|
|
47 |
public abstract void setShowRemoveTaskButton(boolean showRemoveTaskButton) ; |
|
48 |
|
|
49 |
/** |
|
50 |
* @deprecated @see {@link JTaskStatus#setTitle(String)}. |
|
51 |
*/ |
|
52 |
public abstract void setTittle(String tittle); |
|
53 |
|
|
54 |
public abstract void setTitle(String title); |
|
55 |
|
|
56 |
public abstract TaskStatus getTaskStatus(); |
|
57 |
|
|
58 |
public abstract void message(String message); |
|
59 |
|
|
60 |
public abstract void setCurValue(long value); |
|
61 |
} |
|
0 | 62 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/task/JTasksStatus.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api.task; |
|
25 |
|
|
26 |
import javax.swing.JPanel; |
|
27 |
|
|
28 |
import org.gvsig.tools.swing.api.Component; |
|
29 |
import org.gvsig.tools.task.TaskStatusManager; |
|
30 |
|
|
31 |
public abstract class JTasksStatus extends JPanel implements Component { |
|
32 |
|
|
33 |
/** |
|
34 |
* |
|
35 |
*/ |
|
36 |
private static final long serialVersionUID = 2543254823980497949L; |
|
37 |
|
|
38 |
public abstract void bind(TaskStatusManager manager); |
|
39 |
|
|
40 |
public abstract void setMaxLabelSize(int maxLabelSize); |
|
41 |
|
|
42 |
public abstract int getMaxLabelSize(); |
|
43 |
|
|
44 |
} |
|
0 | 45 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/Dialog.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api.windowmanager; |
|
3 |
|
|
4 |
import java.awt.Image; |
|
5 |
import javax.swing.JComponent; |
|
6 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
7 |
import org.gvsig.tools.swing.api.Component; |
|
8 |
|
|
9 |
|
|
10 |
public interface Dialog extends ActionListenerSupport, Component { |
|
11 |
|
|
12 |
int getAction(); |
|
13 |
|
|
14 |
void setContents(JComponent contents); |
|
15 |
|
|
16 |
void setHeaderTitle(String header); |
|
17 |
|
|
18 |
void setHeaderLabel(String header); |
|
19 |
|
|
20 |
void setHeaderImage(Image image); |
|
21 |
|
|
22 |
void setButtons(int buttons); |
|
23 |
|
|
24 |
void setButtonLabel(int button, String label); |
|
25 |
|
|
26 |
void show(WindowManager.MODE mode); |
|
27 |
|
|
28 |
void setIcon(Image icon); |
|
29 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/WindowManager.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api.windowmanager; |
|
25 |
|
|
26 |
import javax.swing.JComponent; |
|
27 |
|
|
28 |
public interface WindowManager { |
|
29 |
|
|
30 |
public enum MODE { |
|
31 |
WINDOW, |
|
32 |
DIALOG, |
|
33 |
TOOL; |
|
34 |
|
|
35 |
public static MODE fromInteger(int x) { |
|
36 |
switch (x) { |
|
37 |
default: |
|
38 |
case 0: |
|
39 |
return WINDOW; |
|
40 |
case 1: |
|
41 |
return DIALOG; |
|
42 |
case 2: |
|
43 |
return TOOL; |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
public static int toInteger(MODE x) { |
|
48 |
switch (x) { |
|
49 |
default: |
|
50 |
case WINDOW: |
|
51 |
return 0; |
|
52 |
case DIALOG: |
|
53 |
return 1; |
|
54 |
case TOOL: |
|
55 |
return 2; |
|
56 |
} |
|
57 |
} |
|
58 |
}; |
|
59 |
|
|
60 |
public void showWindow(JComponent componet, String tittle, MODE mode); |
|
61 |
|
|
62 |
} |
|
0 | 63 |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/windowmanager/WindowManager_v2.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api.windowmanager; |
|
3 |
|
|
4 |
import java.awt.Image; |
|
5 |
import javax.swing.JComponent; |
|
6 |
|
|
7 |
|
|
8 |
public interface WindowManager_v2 extends WindowManager { |
|
9 |
|
|
10 |
public final static int BUTTON_OK = 1; |
|
11 |
public final static int BUTTON_CANCEL = 2; |
|
12 |
public final static int BUTTON_APPLY = 4; |
|
13 |
|
|
14 |
public final static int BUTTONS_OK = BUTTON_OK; |
|
15 |
public final static int BUTTONS_OK_CANCEL = BUTTON_OK|BUTTON_CANCEL; |
|
16 |
public final static int BUTTONS_APPLY_OK_CANCEL = BUTTON_OK|BUTTON_CANCEL|BUTTON_APPLY; |
|
17 |
|
|
18 |
public Dialog createDialog(JComponent component, String title, String header, int buttons); |
|
19 |
|
|
20 |
public void showWindow(JComponent componet, String tittle, MODE mode, Image icon); |
|
21 |
|
|
22 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ComponentService.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api; |
|
25 |
|
|
26 |
import org.gvsig.tools.service.Service; |
|
27 |
|
|
28 |
/** |
|
29 |
* Interface for services based on swing components. |
|
30 |
* |
|
31 |
* @author gvSIG team |
|
32 |
* @version $Id$ |
|
33 |
*/ |
|
34 |
public interface ComponentService extends Service, Component { |
|
35 |
|
|
36 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ListElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2015 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify it under |
|
7 |
* the terms of the GNU General Public License as published by the Free Software |
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
9 |
* version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
14 |
* details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us at info AT |
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.tools.swing.api; |
|
24 |
|
|
25 |
public class ListElement<T> { |
|
26 |
|
|
27 |
private final String label; |
|
28 |
private final T value; |
|
29 |
|
|
30 |
public ListElement(String label, T value) { |
|
31 |
this.label = label; |
|
32 |
this.value = value; |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public String toString() { |
|
37 |
return this.label; |
|
38 |
} |
|
39 |
|
|
40 |
public T getValue() { |
|
41 |
return this.value; |
|
42 |
} |
|
43 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/reminder/DialogReminderManager.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api.reminder; |
|
3 |
|
|
4 |
import java.util.Iterator; |
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
|
|
8 |
public interface DialogReminderManager extends Iterable<DialogReminder> { |
|
9 |
|
|
10 |
public boolean exists(String id); |
|
11 |
|
|
12 |
public DialogReminder get(String id); |
|
13 |
|
|
14 |
public DialogReminder add(String id); |
|
15 |
|
|
16 |
public DialogReminder add(String id, int value); |
|
17 |
|
|
18 |
@Override |
|
19 |
public Iterator<DialogReminder> iterator(); |
|
20 |
|
|
21 |
public List<DialogReminder> reminders(); |
|
22 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/reminder/DialogReminder.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api.reminder; |
|
3 |
|
|
4 |
|
|
5 |
public interface DialogReminder { |
|
6 |
|
|
7 |
public String getId(); |
|
8 |
|
|
9 |
public Object getValue(); |
|
10 |
|
|
11 |
public void setValue(Object value); |
|
12 |
|
|
13 |
public void reset(); |
|
14 |
|
|
15 |
public boolean hasValue(); |
|
16 |
|
|
17 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/DynFieldEditor.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api.usability; |
|
25 |
|
|
26 |
import java.text.ParseException; |
|
27 |
|
|
28 |
import javax.swing.JFormattedTextField; |
|
29 |
import javax.swing.JSpinner; |
|
30 |
|
|
31 |
|
|
32 |
public interface DynFieldEditor { |
|
33 |
|
|
34 |
|
|
35 |
public Object getDefaultValue(); |
|
36 |
|
|
37 |
public JSpinner getSpinner(); |
|
38 |
|
|
39 |
public Object parse (String text) throws ParseException; |
|
40 |
|
|
41 |
public JFormattedTextField getTextField(); |
|
42 |
|
|
43 |
public Object getTextFieldValue(); |
|
44 |
|
|
45 |
public void setTextFieldValue(Object object); |
|
46 |
|
|
47 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/usability/UsabilitySwingManager.java | ||
---|---|---|
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 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2010 {} {{Task}} |
|
27 |
*/ |
|
28 |
package org.gvsig.tools.swing.api.usability; |
|
29 |
|
|
30 |
import java.awt.Component; |
|
31 |
import java.awt.event.FocusListener; |
|
32 |
import java.util.Locale; |
|
33 |
|
|
34 |
import javax.swing.Action; |
|
35 |
import javax.swing.Icon; |
|
36 |
import javax.swing.JButton; |
|
37 |
import javax.swing.JSpinner; |
|
38 |
import javax.swing.JTextArea; |
|
39 |
|
|
40 |
import org.gvsig.tools.dynobject.DynField; |
|
41 |
|
|
42 |
/** |
|
43 |
* Creates common Swing components which take into account usability guides |
|
44 |
* defined for the gvSIG project. |
|
45 |
* |
|
46 |
* @author 2010- C?sar Ordi?ana - gvSIG team |
|
47 |
*/ |
|
48 |
public interface UsabilitySwingManager { |
|
49 |
|
|
50 |
/** |
|
51 |
* Creates a button with no set text or icon. |
|
52 |
* |
|
53 |
* @return a button. |
|
54 |
*/ |
|
55 |
JButton createJButton(); |
|
56 |
|
|
57 |
/** |
|
58 |
* Creates a button where properties are taken from the {@link Action} |
|
59 |
* supplied. |
|
60 |
* |
|
61 |
* @param action |
|
62 |
* the {@link Action} used to specify the new button. |
|
63 |
* |
|
64 |
*/ |
|
65 |
JButton createJButton(Action action); |
|
66 |
|
|
67 |
/** |
|
68 |
* Creates a button with an icon. |
|
69 |
* |
|
70 |
* @param icon |
|
71 |
* the Icon image to display on the button. |
|
72 |
* |
|
73 |
* @return a button. |
|
74 |
*/ |
|
75 |
JButton createJButton(Icon icon); |
|
76 |
|
|
77 |
/** |
|
78 |
* Creates a button with text. |
|
79 |
* |
|
80 |
* @param text |
|
81 |
* the text of the button. |
|
82 |
* |
|
83 |
* @return a button. |
|
84 |
*/ |
|
85 |
JButton createJButton(String text); |
|
86 |
|
|
87 |
/** |
|
88 |
* Creates a button with initial text and icon. |
|
89 |
* |
|
90 |
* @param text |
|
91 |
* the text of the button. |
|
92 |
* @param icon |
|
93 |
* the Icon image to display on the button. |
|
94 |
* |
|
95 |
* @return a button. |
|
96 |
*/ |
|
97 |
JButton createJButton(String text, Icon icon); |
|
98 |
|
|
99 |
/** |
|
100 |
* Creates a tool button with text. |
|
101 |
* |
|
102 |
* @param text |
|
103 |
* the text of the tool button. |
|
104 |
* |
|
105 |
* @return a tool button. |
|
106 |
*/ |
|
107 |
JButton createJToolButton(String text); |
|
108 |
|
|
109 |
/** |
|
110 |
* Creates a text area. |
|
111 |
* |
|
112 |
* @param text |
|
113 |
* the text component |
|
114 |
* |
|
115 |
* @return a tool button. |
|
116 |
*/ |
|
117 |
JTextArea createJTextArea(String text); |
|
118 |
|
|
119 |
/** |
|
120 |
* Creates a text area with a default maximum width. |
|
121 |
* |
|
122 |
* @param text |
|
123 |
* the text component |
|
124 |
* @param text |
|
125 |
* the text component |
|
126 |
* |
|
127 |
* @return a tool button. |
|
128 |
*/ |
|
129 |
JTextArea createJTextArea(String text, int filledMaximumWidth); |
|
130 |
|
|
131 |
/** |
|
132 |
* Creates a spinner component that allows null values. It distinguishes between |
|
133 |
* number, date and floating point models based on their dataType. |
|
134 |
* |
|
135 |
* @param text |
|
136 |
* the text component |
|
137 |
* @param value |
|
138 |
* the initial value |
|
139 |
* |
|
140 |
* @param value |
|
141 |
* the maximum filling size |
|
142 |
* |
|
143 |
* @return a spinner GUI component. |
|
144 |
*/ |
|
145 |
JSpinner createJNullSpinner(int dataType, Object value, int filledMaximumWidth); |
|
146 |
|
|
147 |
/** |
|
148 |
* Creates a spinner component that allows null values. It distinguishes between |
|
149 |
* number, date and floating point models based on their dataType. |
|
150 |
* |
|
151 |
* @param int |
|
152 |
* the data type of dynobjectmanager. |
|
153 |
* @param value |
|
154 |
* the initial value |
|
155 |
* @return a spinner GUI component. |
|
156 |
*/ |
|
157 |
JSpinner createJNullSpinner(int dataType, Object value); |
|
158 |
|
|
159 |
|
|
160 |
DynFieldEditor createNullSpinnerEditor(FocusListener listener, DynField dynField, Locale locale); |
|
161 |
|
|
162 |
/** |
|
163 |
* Creates a JBlank panel |
|
164 |
* |
|
165 |
* @param width |
|
166 |
* @param height |
|
167 |
* @return |
|
168 |
*/ |
|
169 |
Component createJBlank(int width, int height); |
|
170 |
|
|
171 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/JListWithCheckbox.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.tools.swing.api; |
|
3 |
|
|
4 |
import javax.swing.JList; |
|
5 |
import javax.swing.ListSelectionModel; |
|
6 |
import javax.swing.event.ListSelectionListener; |
|
7 |
|
|
8 |
public abstract class JListWithCheckbox extends JList { |
|
9 |
|
|
10 |
public abstract void toggleCheck(int index); |
|
11 |
|
|
12 |
public abstract ListSelectionModel getCheckedModel(); |
|
13 |
|
|
14 |
public abstract void addChecksListener(ListSelectionListener listener) ; |
|
15 |
|
|
16 |
public abstract void removeChecksListener(ListSelectionListener listener); |
|
17 |
|
|
18 |
public abstract ListSelectionListener[] getChecksListeners(); |
|
19 |
|
|
20 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/threadsafedialogs/ThreadSafeDialogsManager.java | ||
---|---|---|
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 3 |
|
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 |
package org.gvsig.tools.swing.api.threadsafedialogs; |
|
25 |
|
|
26 |
import java.awt.Component; |
|
27 |
import java.io.File; |
|
28 |
import javax.swing.filechooser.FileFilter; |
|
29 |
|
|
30 |
public interface ThreadSafeDialogsManager { |
|
31 |
|
|
32 |
/** |
|
33 |
* Create a message dialog with an ok button. |
|
34 |
* |
|
35 |
* If message or title start whit a "_" then try to translate. |
|
36 |
* |
|
37 |
* This method is thread safe to use. |
|
38 |
* |
|
39 |
* @param message to present in the dialog |
|
40 |
* @param title title of the dialog |
|
41 |
* @param messageType type of icon to use. |
|
42 |
* |
|
43 |
* @see javax.swing.JOptionPane#showMessageDialog(Component, Object, String, int) |
|
44 |
*/ |
|
45 |
public void messageDialog(String message, String title, int messageType); |
|
46 |
|
|
47 |
/** |
|
48 |
* Create a message dialog with ok button. |
|
49 |
* |
|
50 |
* If message or title start whit a "_" then try to translate. |
|
51 |
* if messageArgs not is null the message can be formated whit MessageFormat. |
|
52 |
* |
|
53 |
* This method is thread safe to use. |
|
54 |
* |
|
55 |
* @param message to present in the dialog |
|
56 |
* @param messageArgs string array of arguments used to format the message |
|
57 |
* @param title title of the dialog |
|
58 |
* @param messageType type of icon to use. |
|
59 |
* |
|
60 |
* @see javax.swing.JOptionPane#showMessageDialog(Component, Object, String, int) |
|
61 |
*/ |
|
62 |
public void messageDialog(String message, String messageArgs[], String title, int messageType); |
|
63 |
|
|
64 |
public void messageDialog(String message, String messageArgs[], String title, int messageType, String msgid); |
|
65 |
|
|
66 |
/** |
|
67 |
* Show a JOptionPane confirm dialog. |
|
68 |
* |
|
69 |
* if this method is invoked out of the event dispatch thread of swing, |
|
70 |
* the dialog is presented in the thread of swing and the calling thread |
|
71 |
* wait to close to continue. |
|
72 |
* |
|
73 |
* @param message |
|
74 |
* @param title |
|
75 |
* @param optionType |
|
76 |
* @param messageType |
|
77 |
* @return |
|
78 |
* |
|
79 |
* @see javax.swing.JOptionPane#showConfirmDialog(Component, Object, String, int, int) |
|
80 |
* |
|
81 |
*/ |
|
82 |
public int confirmDialog(String message, String title, int optionType, int messageType) ; |
|
83 |
|
|
84 |
public int confirmDialog(String message, String title, int optionType, int messageType, String msgid) ; |
|
85 |
|
|
86 |
/** |
|
87 |
* Show a JOptionPane input dialog. |
|
88 |
* |
|
89 |
* if this method is invoked out of the event dispatch thread of swing, |
|
90 |
* the dialog is presented in the thread of swing and the calling thread |
|
91 |
* wait to close to continue. |
|
92 |
* |
|
93 |
* @param message |
|
94 |
* @param title |
|
95 |
* @param optionType |
|
96 |
* an integer designating the options available on the dialog: |
|
97 |
* YES_NO_OPTION, YES_NO_CANCEL_OPTION, or OK_CANCEL_OPTION |
|
98 |
* @param messageType |
|
99 |
* an integer designating the kind of message this is; |
|
100 |
* primarily used to determine the icon from the pluggable |
|
101 |
* Look and Feel: ERROR_MESSAGE, INFORMATION_MESSAGE, |
|
102 |
* WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE |
|
103 |
* @return |
|
104 |
* |
|
105 |
* @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int) |
|
106 |
* |
|
107 |
*/ |
|
108 |
public String inputDialog(String message, String title, int messageType, String initialValue) ; |
|
109 |
|
|
110 |
/** |
|
111 |
* Show a JOptionPane input dialog. |
|
112 |
* |
|
113 |
* if this method is invoked out of the event dispatch thread of swing, |
|
114 |
* the dialog is presented in the thread of swing and the calling thread |
|
115 |
* wait to close to continue. |
|
116 |
* |
|
117 |
* @param message |
|
118 |
* @param title |
|
119 |
* @param optionType |
|
120 |
* @param messageType |
|
121 |
* @return |
|
122 |
* |
|
123 |
* @see javax.swing.JOptionPane#showInputDialog(Component, Object, String, int) |
|
124 |
* |
|
125 |
*/ |
|
126 |
public String inputDialog(String message, String title); |
|
127 |
|
|
128 |
/** |
|
129 |
* Creates an return a new instance of the component specified |
|
130 |
* |
|
131 |
* This method ensure that the component is created in the event dispatch thread of swing. |
|
132 |
* |
|
133 |
* @param theClass of component to be created |
|
134 |
* @param parameters passed to the constructor of the component |
|
135 |
* |
|
136 |
* @return the instance of the component created |
|
137 |
*/ |
|
138 |
public Component createComponent(final Class<? extends Component> theClass, final Object ... parameters); |
|
139 |
|
|
140 |
/** |
|
141 |
* Creates an return a new instance of the component specified |
|
142 |
* |
|
143 |
* This method ensure that the component is created in the event dispatch thread of swing. |
|
144 |
* |
|
145 |
* @param theClass of component to be created |
|
146 |
* @param parameters passed to the constructor of the component |
|
147 |
* |
|
148 |
* @return the instance of the component created |
|
149 |
*/ |
|
150 |
public Component createComponentWithParams(final Class<? extends Component> theClass, final Object[] parameters); |
|
151 |
|
|
152 |
/** |
|
153 |
* Creates and show a JFileChooser dialog. |
|
154 |
* |
|
155 |
* This method return an array whit the selected files. If multiselection is |
|
156 |
* not allowed, an array with one element is returned. |
|
157 |
* |
|
158 |
* If the user select the cancel button, null is returned. |
|
159 |
* |
|
160 |
* if this method is invoked out of the event dispatch thread of swing, |
|
161 |
* the dialog is presented in the thread of swing and the calling thread |
|
162 |
* wait to close to continue. |
|
163 |
* |
|
164 |
* @param title, title of dialog |
|
165 |
* @param type of the dialog, JFileChooser.SAVE_DIALOG or JFileChooser.OPEN_DIALOG |
|
166 |
* @param selectionMode of the dialog, values are: JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES |
|
167 |
* @param multiselection, true if multiselection is allowed |
|
168 |
* @param inihelpertialPath, to show in the dialog |
|
169 |
* @param filter used to filter the files show in the dialog. |
|
170 |
* @param fileHidingEnabled, if true hidden files are show |
|
171 |
* @return an array whit the files selecteds or null. |
|
172 |
*/ |
|
173 |
public File[] showChooserDialog( |
|
174 |
final String title, |
|
175 |
final int type, |
|
176 |
final int selectionMode, |
|
177 |
final boolean multiselection, |
|
178 |
final File inihelpertialPath, |
|
179 |
final FileFilter filter, |
|
180 |
final boolean fileHidingEnabled |
|
181 |
) ; |
|
182 |
|
|
183 |
/** |
|
184 |
* Creates and show a JFileChooser dialog for folder selection. |
|
185 |
* |
|
186 |
* This is an utility method that wrap a showChooserDialog call. |
|
187 |
* |
|
188 |
* @param title, title of dialog |
|
189 |
* @param initialPath, to show in the dialog |
|
190 |
* @return an array whit the files selecteds or null. |
|
191 |
* |
|
192 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean) |
|
193 |
*/ |
|
194 |
public File[] showOpenDirectoryDialog(String title, File initialPath) ; |
|
195 |
|
|
196 |
/** |
|
197 |
* Creates and show a JFileChooser dialog for selection a file for open. |
|
198 |
* |
|
199 |
* This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)} call. |
|
200 |
* |
|
201 |
* @param title, title of dialog |
|
202 |
* @param initialPath, to show in the dialog |
|
203 |
* @return an array whit the files selecteds or null. |
|
204 |
* |
|
205 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean) |
|
206 |
*/ |
|
207 |
public File[] showOpenFileDialog(String title, File initialPath) ; |
|
208 |
|
|
209 |
/** |
|
210 |
* Creates and show a JFileChooser dialog for selection a file for save. |
|
211 |
* |
|
212 |
* This is an utility method that wrap a {@link #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean)} call. |
|
213 |
* |
|
214 |
* @param title, title of dialog |
|
215 |
* @param initialPath, to show in the dialog |
|
216 |
* @return an array whit the files selecteds or null. |
|
217 |
* |
|
218 |
* @see #showChooserDialog(String, int, int, boolean, File, FileFilter, boolean) |
|
219 |
*/ |
|
220 |
public File[] showSaveFileDialog(String title, File initialPath) ; |
|
221 |
|
|
222 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLocator.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api; |
|
25 |
|
|
26 |
import org.gvsig.tools.locator.BaseLocator; |
|
27 |
import org.gvsig.tools.locator.Locator; |
|
28 |
import org.gvsig.tools.locator.LocatorException; |
|
29 |
import org.gvsig.tools.swing.api.evaluator.ComponentSwingManager; |
|
30 |
import org.gvsig.tools.swing.api.reminder.DialogReminderManager; |
|
31 |
import org.gvsig.tools.swing.api.task.TaskStatusSwingManager; |
|
32 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
33 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
34 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
35 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
|
36 |
|
|
37 |
/** |
|
38 |
* {@link Locator} for the tools swing Library. It returns a reference to the |
|
39 |
* library's main |
|
40 |
* utilities. |
|
41 |
* |
|
42 |
* @author 2010- C?sar Ordi?ana - gvSIG team |
|
43 |
*/ |
|
44 |
public class ToolsSwingLocator extends BaseLocator { |
|
45 |
|
|
46 |
private static final String LOCATOR_NAME = "Tools.swing.locator"; |
|
47 |
|
|
48 |
public static final String USABILITY_SWING_MANAGER_NAME = |
|
49 |
"Tools.usability.swing.manager"; |
|
50 |
|
|
51 |
public static final String USABILITY_SWING_MANAGER_DESCRIPTION = |
|
52 |
"Tools Usability Swing Manager"; |
|
53 |
|
|
54 |
private static final String TASKSTATUS_SWING_MANAGER_NAME = "Tools.task.swing.manager"; |
|
55 |
|
|
56 |
private static final String TASKSTATUS_SWING_MANAGER_DESCRIPTION = "Tools Task Swing Manager"; |
|
57 |
|
|
58 |
private static final String WINDOW_MANAGER_NAME = "Tools.swing.windowmanager"; |
|
59 |
|
|
60 |
private static final String WINDOW_MANAGER_DESCRIPTION = "Tools Window Manager"; |
|
61 |
|
|
62 |
private static final String ICONTHEME_MANAGER_NAME = "Tools.swing.iconthememanager"; |
|
63 |
|
|
64 |
private static final String ICONTHEME_MANAGER_DESCRIPTION = "Tools Icon Theme Manager"; |
|
65 |
|
|
66 |
private static final String COMPONENT_SWING_MANAGER_NAME = "Tools.swing.componentmanager"; |
|
67 |
|
|
68 |
private static final String COMPONENT_SWING_MANAGER_DESCRIPTION = "Tools Swing Component Manager"; |
|
69 |
|
|
70 |
private static final String THREADSAFEDIALOGS_MANAGER_NAME = "Tools.swing.threadsafedialogs"; |
|
71 |
|
|
72 |
private static final String THREADSAFEDIALOGS_MANAGER_DESCRIPTION = "Thread safe dialogs Manager"; |
|
73 |
|
|
74 |
private static final String SWING_MANAGER_NAME = "Tools.swing.manager"; |
|
75 |
|
|
76 |
private static final String SWING_MANAGER_DESCRIPTION = "Tools Swing Manager"; |
|
77 |
|
|
78 |
public static final String PLUGINS_DIALOGREMINDER_MANAGER_NAME = "DialogReminderManager"; |
|
79 |
private static final String PLUGINS_DIALOGREMINDER_MANAGER_DESCRIPTION = "DialogReminderManager"; |
|
80 |
|
|
81 |
/** |
|
82 |
* Unique instance. |
|
83 |
*/ |
|
84 |
private static final ToolsSwingLocator instance = new ToolsSwingLocator(); |
|
85 |
|
|
86 |
/** |
|
87 |
* Return the {@link Singleton} instance. |
|
88 |
* |
|
89 |
* @return the {@link Singleton} instance |
|
90 |
*/ |
|
91 |
public static ToolsSwingLocator getInstance() { |
|
92 |
return instance; |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* Return the {@link Locator}'s name |
|
97 |
* |
|
98 |
* @return a String with the {@link Locator}'s name |
|
99 |
*/ |
|
100 |
@Override |
|
101 |
public String getLocatorName() { |
|
102 |
return LOCATOR_NAME; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* Gets the instance of the {@link UsabilitySwingManager} registered. |
|
107 |
* |
|
108 |
* @return {@link UsabilitySwingManager} |
|
109 |
*/ |
|
110 |
public static UsabilitySwingManager getUsabilitySwingManager() { |
|
111 |
return (UsabilitySwingManager) getInstance().get( |
|
112 |
USABILITY_SWING_MANAGER_NAME); |
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Registers the Class implementing the {@link UsabilitySwingManager} |
|
117 |
* interface. |
|
118 |
* |
|
119 |
* @param clazz |
|
120 |
* implementing the {@link UsabilitySwingManager} interface |
|
121 |
*/ |
|
122 |
public static void registerUsabilitySwingManager( |
|
123 |
Class<? extends UsabilitySwingManager> clazz) { |
|
124 |
getInstance().register(USABILITY_SWING_MANAGER_NAME, |
|
125 |
USABILITY_SWING_MANAGER_DESCRIPTION, clazz); |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Gets the instance of the {@link TaskStatusSwingManager} registered. |
|
130 |
* |
|
131 |
* @return {@link TaskStatusSwingManager} |
|
132 |
*/ |
|
133 |
public static TaskStatusSwingManager getTaskStatusSwingManager() { |
|
134 |
return (TaskStatusSwingManager) getInstance().get( |
|
135 |
TASKSTATUS_SWING_MANAGER_NAME); |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Registers the Class implementing the {@link TaskStatusSwingManager} |
|
140 |
* interface. |
|
141 |
* |
|
142 |
* @param clazz |
|
143 |
* implementing the {@link TaskStatusSwingManager} interface |
|
144 |
*/ |
|
145 |
public static void registerTaskStatusSwingManager( |
|
146 |
Class<? extends TaskStatusSwingManager> clazz) { |
|
147 |
getInstance().register(TASKSTATUS_SWING_MANAGER_NAME, |
|
148 |
TASKSTATUS_SWING_MANAGER_DESCRIPTION, clazz); |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* Gets the instance of the {@link WindowManager} registered. |
|
153 |
* |
|
154 |
* @return {@link WindowManager} |
|
155 |
*/ |
|
156 |
public static WindowManager getWindowManager() { |
|
157 |
return (WindowManager) getInstance().get( |
|
158 |
WINDOW_MANAGER_NAME); |
|
159 |
} |
|
160 |
|
|
161 |
/** |
|
162 |
* Registers the Class implementing the {@link WindowManager} |
|
163 |
* interface. |
|
164 |
* |
|
165 |
* @param clazz |
|
166 |
* implementing the {@link WindowManager} interface |
|
167 |
*/ |
|
168 |
public static void registerWindowManager( |
|
169 |
Class<? extends WindowManager> clazz) { |
|
170 |
getInstance().register(WINDOW_MANAGER_NAME, |
|
171 |
WINDOW_MANAGER_DESCRIPTION, clazz); |
|
172 |
} |
|
173 |
|
|
174 |
/** |
|
175 |
* Gets the instance of the {@link IconThemeManager} registered. |
|
176 |
* |
|
177 |
* @return {@link IconThemeManager} |
|
178 |
*/ |
|
179 |
public static IconThemeManager getIconThemeManager() { |
|
180 |
return (IconThemeManager) getInstance().get( |
|
181 |
ICONTHEME_MANAGER_NAME); |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* Registers the Class implementing the {@link IconThemeManager} |
|
186 |
* interface. |
|
187 |
* |
|
188 |
* @param clazz |
|
189 |
* implementing the {@link IconThemeManager} interface |
|
190 |
*/ |
|
191 |
public static void registerIconThemeManager( |
|
192 |
Class<? extends IconThemeManager> clazz) { |
|
193 |
getInstance().register(ICONTHEME_MANAGER_NAME, |
|
194 |
ICONTHEME_MANAGER_DESCRIPTION, clazz); |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* Gets the instance of the {@link ComponentSwingManager} registered. |
|
199 |
* |
|
200 |
* @return {@link ComponentSwingManager} |
|
201 |
*/ |
|
202 |
public static ComponentSwingManager getComponentSwingManager() { |
|
203 |
return (ComponentSwingManager) getInstance().get( |
|
204 |
COMPONENT_SWING_MANAGER_NAME); |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* Registers the Class implementing the {@link ComponentSwingManager} |
|
209 |
* interface. |
|
210 |
* |
|
211 |
* @param clazz |
|
212 |
* implementing the {@link ComponentSwingManager} interface |
|
213 |
*/ |
|
214 |
public static void registerComponentSwingManager( |
|
215 |
Class<? extends ComponentSwingManager> clazz) { |
|
216 |
getInstance().register( |
|
217 |
COMPONENT_SWING_MANAGER_NAME, |
|
218 |
COMPONENT_SWING_MANAGER_DESCRIPTION, clazz); |
|
219 |
} |
|
220 |
|
|
221 |
|
|
222 |
/** |
|
223 |
* Gets the instance of the {@link ThreadSafeDialogsManager} registered. |
|
224 |
* |
|
225 |
* @return {@link ThreadSafeDialogsManager} |
|
226 |
*/ |
|
227 |
public static ThreadSafeDialogsManager getThreadSafeDialogsManager() { |
|
228 |
return (ThreadSafeDialogsManager) getInstance().get( |
|
229 |
THREADSAFEDIALOGS_MANAGER_NAME); |
|
230 |
} |
|
231 |
|
|
232 |
/** |
|
233 |
* Registers the Class implementing the {@link ThreadSafeDialogsManager} |
|
234 |
* interface. |
|
235 |
* |
|
236 |
* @param clazz |
|
237 |
* implementing the {@link ThreadSafeDialogsManager} interface |
|
238 |
*/ |
|
239 |
public static void registerThreadSafeDialogsManager( |
|
240 |
Class<? extends ThreadSafeDialogsManager> clazz) { |
|
241 |
getInstance().register(THREADSAFEDIALOGS_MANAGER_NAME, |
|
242 |
THREADSAFEDIALOGS_MANAGER_DESCRIPTION, clazz); |
|
243 |
} |
|
244 |
|
|
245 |
/** |
|
246 |
* Gets the instance of the {@link ToolsSwingManager} registered. |
|
247 |
* |
|
248 |
* @return {@link ToolsSwingManager} |
|
249 |
*/ |
|
250 |
public static ToolsSwingManager getToolsSwingManager() { |
|
251 |
return (ToolsSwingManager) getInstance().get( |
|
252 |
SWING_MANAGER_NAME); |
|
253 |
} |
|
254 |
|
|
255 |
/** |
|
256 |
* Registers the Class implementing the {@link ToolsSwingManager} |
|
257 |
* interface. |
|
258 |
* |
|
259 |
* @param clazz |
|
260 |
* implementing the {@link ToolsSwingManager} interface |
|
261 |
*/ |
|
262 |
public static void registerToolsSwingManager( |
|
263 |
Class<? extends ToolsSwingManager> clazz) { |
|
264 |
getInstance().register(SWING_MANAGER_NAME, |
|
265 |
SWING_MANAGER_DESCRIPTION, clazz); |
|
266 |
} |
|
267 |
|
|
268 |
//Dialog reminder |
|
269 |
public static DialogReminderManager getDialogReminderManager() throws LocatorException { |
|
270 |
return (DialogReminderManager) getInstance().get(PLUGINS_DIALOGREMINDER_MANAGER_NAME); |
|
271 |
} |
|
272 |
|
|
273 |
public static void registerDialogReminderManager(Class clazz) { |
|
274 |
getInstance().register(PLUGINS_DIALOGREMINDER_MANAGER_NAME, PLUGINS_DIALOGREMINDER_MANAGER_DESCRIPTION, |
|
275 |
clazz); |
|
276 |
} |
|
277 |
|
|
278 |
public static void registerDefaultDialogReminderManager(Class clazz) { |
|
279 |
getInstance().registerDefault(PLUGINS_DIALOGREMINDER_MANAGER_NAME, PLUGINS_DIALOGREMINDER_MANAGER_DESCRIPTION, |
|
280 |
clazz); |
|
281 |
} |
|
282 |
} |
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.128/org.gvsig.tools.swing/org.gvsig.tools.swing.api/src/main/java/org/gvsig/tools/swing/api/ToolsSwingLibrary.java | ||
---|---|---|
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 |
package org.gvsig.tools.swing.api; |
|
25 |
|
|
26 |
import org.gvsig.tools.ToolsLibrary; |
|
27 |
import org.gvsig.tools.library.AbstractLibrary; |
|
28 |
import org.gvsig.tools.library.LibraryException; |
|
29 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
30 |
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager; |
|
31 |
|
|
32 |
/** |
|
33 |
* Initialization of the Tools swing library. |
|
34 |
* |
|
35 |
* @author 2010- C?sar Ordi?ana - gvSIG team |
|
36 |
*/ |
|
37 |
public class ToolsSwingLibrary extends AbstractLibrary { |
|
38 |
|
|
39 |
@Override |
|
40 |
public void doRegistration() { |
|
41 |
super.doRegistration(); |
|
42 |
registerAsAPI(ToolsSwingLibrary.class); |
|
43 |
require(ToolsLibrary.class); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
protected void doInitialize() throws LibraryException { |
|
48 |
// Do nothing |
|
49 |
} |
Also available in: Unified diff