Revision 42907

View differences:

tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/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.desktop.framework</artifactId>
6
    <packaging>pom</packaging>
7
    <name>${project.artifactId}</name>
8
    <parent>
9
        <groupId>org.gvsig</groupId>
10
        <artifactId>org.gvsig.desktop</artifactId>
11
        <version>2.0.145</version>
12
    </parent>
13

  
14
    <modules>
15
        <module>org.gvsig.andami</module>
16
        <module>org.gvsig.andami.updater</module>
17
    </modules>
18

  
19
    <description>Contains the launcher and plugin framework used in gvSIG.</description>
20
</project>
21

  
0 22

  
tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/org.gvsig.andami/src/test/java/org/gvsig/andami/AllTests.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.andami;
25

  
26
import junit.framework.Test;
27
import junit.framework.TestSuite;
28

  
29
public class AllTests {
30

  
31
	public static Test suite() {
32
		TestSuite suite = new TestSuite("Test for com.iver.andami");
33
		//$JUnit-BEGIN$
34

  
35
		//$JUnit-END$
36
		return suite;
37
	}
38

  
39
}
0 40

  
tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/org.gvsig.andami/src/main/assembly/gvsig-andami-package.xml
1
<!--
2

  
3
    gvSIG. Desktop Geographic Information System.
4

  
5
    Copyright (C) 2007-2013 gvSIG Association.
6

  
7
    This program is free software; you can redistribute it and/or
8
    modify it under the terms of the GNU General Public License
9
    as published by the Free Software Foundation; either version 3
10
    of the License, or (at your option) any later version.
11

  
12
    This program is distributed in the hope that it will be useful,
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
    GNU General Public License for more details.
16

  
17
    You should have received a copy of the GNU General Public License
18
    along with this program; if not, write to the Free Software
19
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
    MA  02110-1301, USA.
21

  
22
    For any additional information, do not hesitate to contact us
23
    at info AT gvsig.com, or visit our website www.gvsig.com.
24

  
25
-->
26
<assembly>
27
  <id>gvsig-andami-package</id>
28
  <formats>
29
    <format>zip</format>
30
  </formats>
31
  <baseDirectory>.</baseDirectory>
32
  <!-- 
33
  <includeBaseDirectory>true</includeBaseDirectory>
34
   -->
35
  <files>
36
    <file>
37
      <source>target/${project.artifactId}-${project.version}.jar</source>
38
      <outputDirectory>lib</outputDirectory>
39
    </file>
40
    <file>
41
      <source>src/main/resources/default-log4j/log4j.properties</source>
42
      <outputDirectory>.</outputDirectory>
43
    </file>  
44
  </files>
45
  <fileSets>
46
    <fileSet>
47
      <directory>src/main/resources-application</directory>
48
      <outputDirectory>.</outputDirectory>
49
    </fileSet>
50
    <fileSet>
51
      <directory>src/main/resources/org/gvsig/andami</directory>
52
      <outputDirectory>i18n/andami</outputDirectory>
53
    </fileSet>
54
  </fileSets>
55
  
56
  <dependencySets>
57
    <dependencySet>
58
      <useProjectArtifact>false</useProjectArtifact>
59
      <useTransitiveDependencies>true</useTransitiveDependencies>
60
      <outputDirectory>lib</outputDirectory>
61
    </dependencySet>
62
  </dependencySets>
63

  
64
</assembly>
65

  
0 66

  
tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/fonts/FontUtils.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.andami.ui.fonts;
25

  
26
import java.awt.Font;
27
import java.awt.GraphicsEnvironment;
28
import java.util.HashSet;
29
import java.util.Iterator;
30
import java.util.Locale;
31

  
32
import javax.swing.UIManager;
33

  
34
import org.gvsig.andami.PluginServices;
35
import org.gvsig.andami.messages.Messages;
36
import org.slf4j.Logger;
37
import org.slf4j.LoggerFactory;
38

  
39

  
40
/**
41
 * Several methods to manage the user interface fonts.
42
 * 
43
 * @author Cesar Martinez Izquierdo <cesar.martinez@iver.es>
44
 *
45
 */
46
public class FontUtils {
47
	private static Logger logger = LoggerFactory.getLogger(FontUtils.class);
48

  
49
	/**
50
	 * Changes the default UIManager font to the provided font.
51
	 * 
52
	 * @param fontName
53
	 */
54
	public static void setFont(String fontName) {
55
		String[] fieldList = {
56
				"Button.font",
57
				"CheckBox.font",
58
				"CheckBoxMenuItem.font",
59
				"ColorChooser.font",
60
				"ComboBox.font",
61
				"DesktopIcon.font",
62
				"EditorPane.font",
63
				"FormattedTextField.font",
64
				"Label.font",
65
				"List.font",
66
				"Menu.font",
67
				"MenuBar.font",
68
				"MenuItem.font",
69
				"OptionPane.font",
70
				"Panel.font",
71
				"PasswordField.font",
72
				"PopupMenu.font",
73
				"ProgressBar.font",
74
				"RadioButton.font",
75
				"RadioButtonMenuItem.font",
76
				"ScrollPane.font",
77
				"Slider.font",
78
				"Spinner.font",
79
				"TabbedPane.font",
80
				"Table.font",
81
				"TableHeader.font",
82
				"TextArea.font",
83
				"TextField.font",
84
				"TextPane.font",
85
				"TitledBorder.font",
86
				"ToggleButton.font",
87
				"ToolBar.font",
88
				"ToolTip.font",
89
				"Tree.font",
90
				"Viewport.font",
91
				"InternalFrame.titleFont"
92
		} ;
93
		
94
		Font font;
95
		
96
		for (int i = fieldList.length-1; i>=0; i--) {
97
			font = UIManager.getFont(fieldList[i]);
98
			if (font!=null)
99
				UIManager.put(fieldList[i], new Font(fontName, Font.PLAIN, font.getSize()));
100
		}
101
	}
102
	
103
	/**
104
	 * Inits the UIManager fonts, so that it can display current's language
105
	 * symbols. The font is only changed when necessary.
106
	 */
107
	public static void initFonts() {
108
		// conservative behaviour: we just change the font, if the default one
109
		// can't correctly display the current language
110
		Font defaultFont = UIManager.getFont("Label.font");
111
		if (defaultFont==null) {
112
			return;
113
		}
114
		if (defaultFont.canDisplayUpTo(Messages.getString("MDIFrame.quiere_salir"))==-1) {
115
			logger.debug("Fonts configuration was not necessary");
116
			return;			
117
		}
118

  
119
		
120
		Font[] allfonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
121
		HashSet workingFonts = new HashSet();
122
		
123
		for (int i=allfonts.length-1; i>=0; i--) {			
124
			if (allfonts[i].canDisplayUpTo(Messages.getString("MDIFrame.quiere_salir"))==-1) {
125
				workingFonts.add(allfonts[i].getName());
126
			}
127
		}
128
		
129
		// try to set the preferred font
130
		String[] preferredFonts = getPreferedFonts(Locale.getDefault().getLanguage());
131
		for (int i=0;i<preferredFonts.length; i++) {
132
			if (workingFonts.contains(preferredFonts[i])){
133
				setFont(preferredFonts[i]);
134
				PluginServices.getLogger().info("FontSet: "+preferredFonts[i]);
135
				return;
136
			}
137
		}
138
		
139
		// try to set any working font
140
		Iterator iterator = workingFonts.iterator();
141
		
142
		if (iterator.hasNext()) {
143
			String fontName = (String) iterator.next();
144
			setFont(fontName);
145
			PluginServices.getLogger().info("FontSet: "+fontName);	
146
		}
147
	}
148
	
149
	/**
150
	 * Returns an ordered list of preferred fonts for the provided language.
151
	 * As there is several fonts which can be used to display each language,
152
	 * this list provides a hint about which is the more suitable font for
153
	 * this language.
154
	 * 
155
	 * This method does not check whether the fonts are available in the
156
	 * running system.
157
	 * 
158
	 * @param lang
159
	 * @return
160
	 */
161
	private static String [] getPreferedFonts(String lang) {
162
		//TODO this should be read from a file, for each language
163
		if (lang.equals("zh")) {
164
			String []preferredChineseFonts = {
165
					"AR PL KaitiM GB",
166
					"AR PL SungtiL GB",
167
					"Kochi Gothic",
168
					"SimSun"
169
			} ;
170
			return preferredChineseFonts;
171
		}
172
		return new String[0];
173
	}
174
	
175
	private static void listSystemFonts() {
176
		Font[] allfonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
177

  
178
		for (int i=allfonts.length-1; i>=0; i--) {
179
			System.out.println(allfonts[i].getName()+" --- "+allfonts[i].getFontName());
180
		}
181
	}
182
}
0 183

  
tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/splash/MultiSplashWindow.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

  
25
package org.gvsig.andami.ui.splash;
26

  
27
import java.awt.BorderLayout;
28
import java.awt.Color;
29
import java.awt.Dimension;
30
import java.awt.Font;
31
import java.awt.Frame;
32
import java.awt.Graphics;
33
import java.awt.Graphics2D;
34
import java.awt.Point;
35
import java.awt.RenderingHints;
36
import java.awt.Toolkit;
37
import java.awt.event.ActionEvent;
38
import java.awt.event.ActionListener;
39
import java.awt.event.MouseEvent;
40
import java.awt.event.MouseListener;
41

  
42
import javax.swing.BorderFactory;
43
import javax.swing.ImageIcon;
44
import javax.swing.JLabel;
45
import javax.swing.JProgressBar;
46
import javax.swing.JWindow;
47
import javax.swing.Timer;
48

  
49
import org.gvsig.andami.PluginServices;
50
import org.gvsig.andami.messages.Messages;
51
import org.gvsig.andami.ui.theme.Theme;
52
import org.slf4j.Logger;
53
import org.slf4j.LoggerFactory;
54

  
55

  
56

  
57
public class MultiSplashWindow extends JWindow implements 
58
    MouseListener {
59
	private static final Logger logger = LoggerFactory.getLogger(MultiSplashWindow.class);
60
	
61
    private static final long serialVersionUID = 572592158521767258L;
62
    private JProgressBar pb;
63
    private int progress = 0;
64
    private JLabel lblStatus;
65
    private Timer timer;
66
    private int numLogos = 0;
67
    private ImageIcon[] img = null;
68
    private Dimension splashDimension;
69
    private int index = 0;
70
    private int current;
71
    private int lastIndex = -1;
72
    private Theme theme;
73
    private int[] timers;
74

  
75
    private String version="";
76
    private String[] versions=null;
77
    private Point point=new Point(270,240);
78
    private Point[] points=null;
79
    private int fontsize=18;
80
    private int[] fontSizes=null;
81
    private Color fontcolor=new Color(80,170,240);
82
    private Color[] fontColors=null;
83

  
84
    public MultiSplashWindow(Frame f, Theme theme, int progressBarStepCount) {
85
        super(f);
86
        this.theme = theme;
87
        this.timers = theme.getTimers();
88
        lblStatus = new JLabel(Messages.getString("SplashWindow.Iniciando"));
89
        lblStatus.setBorder(BorderFactory.createEtchedBorder());
90
        lblStatus.setBackground(Color.WHITE);
91

  
92
        pack();
93
        pb = new JProgressBar(0, progressBarStepCount);
94
        getContentPane().setLayout(new BorderLayout());
95
        getContentPane().add(lblStatus, BorderLayout.NORTH);
96
        getContentPane().add(pb, BorderLayout.SOUTH);
97

  
98
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
99

  
100
        init();
101
        setLocation((screenSize.width / 2) - (splashDimension.width / 2),
102
            (screenSize.height / 2) - (splashDimension.height / 2));
103
        index = 0;
104
        setVisible(true);
105
        this.addMouseListener(this);
106
    }
107

  
108
    public void init() {
109
        img = theme.getSplashImages();
110
        numLogos = img.length;
111

  
112
        if (numLogos == 0) {
113
            numLogos = 1;
114
            img = new ImageIcon[1];
115
            img[0] = PluginServices.getIconTheme().get("splash-default"); 
116
            timers = new int[1];
117
            timers[0] = 1000;
118
        }
119
        versions=theme.getVersions();
120
        points=theme.getPositions();
121
        fontSizes=theme.getFontSizes();
122
        fontColors=theme.getFontColors();
123
        int splashWidth = img[0].getIconWidth();
124
        int splashHeight = img[0].getIconHeight();
125

  
126
        for (int i = 1; i < numLogos; i++) {
127
            splashWidth = Math.max(splashWidth, img[i].getIconWidth());
128
            splashHeight = Math.max(splashHeight, img[i].getIconHeight());
129
        }
130

  
131
        splashDimension = new Dimension(splashWidth, splashHeight);
132
        setSize(splashDimension.width, splashDimension.height + 45);
133

  
134
        start();
135
    }
136

  
137
    public void paint(Graphics g) {
138
        if (lastIndex == current) {
139
            return;
140
        }
141

  
142
        super.paint(g);
143

  
144
        if ((img == null) || (img[current] == null)) {
145
            return;
146
        }
147

  
148
        ImageIcon image = img[current];
149
        g.drawImage(image.getImage(),
150
            (getWidth() / 2) - (image.getIconWidth() / 2),
151
            ((getHeight() / 2) - (image.getIconHeight() / 2)), this);
152

  
153
        // Activate antialias for text
154
        if (g instanceof Graphics2D) {
155
            ((Graphics2D) g).setRenderingHint(
156
                RenderingHints.KEY_TEXT_ANTIALIASING,
157
                RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
158
        }
159

  
160
        Font font = new Font("SansSerif", Font.BOLD, fontsize);
161
        if (fontSizes.length>0 && fontSizes[current]!=0) {
162
            font = new Font("SansSerif", Font.BOLD, fontSizes[current]);
163
        }
164
    	g.setFont(font);
165

  
166
    	Color color=fontcolor;
167
        if (fontColors.length>0 && fontColors[current]!=null) {
168
        	color=fontColors[current];
169
        }
170
        g.setColor(color);
171

  
172
        String ver=version;
173
        if (versions.length>0 && versions[current]!=null) {
174
        	ver=versions[current];
175
        }
176

  
177
        Point p=point;
178
        if (points.length>0 && points[current]!=null){
179
        	p=points[current];
180
        }
181

  
182
        g.drawString(PluginServices.getText(this,ver),(int)p.getX(),(int)p.getY());
183

  
184
        lastIndex = current;
185
    }
186

  
187
    public void tick() {
188
        current = index;
189
        timer.setDelay(timers[current]);
190
        repaint();
191
        index++;
192

  
193
        if (index >= numLogos) {
194
            index = 0;
195
        }
196
    }
197

  
198
    public void start() {
199
        timer = new Timer(1000,new ActionListener() {
200

  
201
            @Override
202
            public void actionPerformed(ActionEvent e) {
203
                tick();
204
            }
205
        });
206
        timer.start();
207
    }
208

  
209
    /**
210
     * Cierra la ventana
211
     */
212
    public void close() {
213
    	if( this.progress != this.pb.getMaximum() ) {
214
    		logger.warn("Max value of launch progress can be set to "+this.progress);
215
    	}
216
        setVisible(false);
217
        stop();
218
        dispose();
219
    }
220

  
221
    public void stop() {
222
        timer.stop();
223
        timer = null;
224
    }
225

  
226
    /**
227
     * DOCUMENT ME!
228
     *
229
     * @param args DOCUMENT ME!
230
     */
231
    public static void main(String[] args) {
232
        Frame frame = new Frame();
233
        Theme theme = new Theme();
234
        MultiSplashWindow ba = new MultiSplashWindow(frame, theme, 5);
235
        ba.setVisible(true);
236
        ba.setSize(500, 500);
237
        ba.init();
238
        ba.start();
239
    }
240

  
241
    /**
242
     * @see com.iver.mdiApp.ui.AppLoadingListener#process(int)
243
     */
244
    public void process(int p, String str) {
245
        lblStatus.setText(str);
246
        if( this.progress < p ) {
247
            this.progress = p;
248
        }
249
        if (pb.getValue() != this.progress && this.progress <= pb.getMaximum() ) {
250
            pb.setValue(this.progress);
251
        }
252
        doLayout();
253
        repaint();
254
    }
255

  
256
    public void process(String str) {
257
        lblStatus.setText(str);
258
        this.progress++;
259
        if( this.progress <= pb.getMaximum() ) {
260
        	pb.setValue(this.progress);
261
        }
262
        doLayout();
263
        repaint();
264
    }
265

  
266
    public void mouseClicked(MouseEvent e) {
267
        this.setVisible(false);
268
    }
269

  
270
	public void mouseEntered(MouseEvent e) { }
271
	public void mouseExited(MouseEvent e) { }
272
	public void mousePressed(MouseEvent e) { }
273
	public void mouseReleased(MouseEvent e) { }
274
    }
275

  
0 276

  
tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/AndamiEventQueue.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.andami.ui;
25

  
26
import java.awt.AWTEvent;
27
import java.awt.EventQueue;
28
import java.awt.event.MouseEvent;
29

  
30
import javax.swing.JOptionPane;
31

  
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.andami.messages.Messages;
34
import org.gvsig.andami.messages.NotificationManager;
35
import org.slf4j.Logger;
36
import org.slf4j.LoggerFactory;
37

  
38

  
39

  
40
/**
41
 * DOCUMENT ME!
42
 *
43
 * @author Fernando Gonz?lez Cort?s
44
 */
45
public class AndamiEventQueue extends EventQueue {
46
	private static Logger logger = LoggerFactory.getLogger(AndamiEventQueue.class);
47
	
48
	protected void dispatchEvent(AWTEvent event){
49
		try{
50
			super.dispatchEvent(event);
51
		} catch(RuntimeException e){
52
		    
53
		    if (canShowWindow(e, event)) {
54
		        NotificationManager.addError(e);//Messages.getString("PluginServices.Bug en el c?digo"), e);
55
		    } else {
56
                try {
57
                    PluginServices.getMainFrame().getStatusBar().message(e.getMessage(), JOptionPane.ERROR_MESSAGE);
58
                } catch(Throwable ex) {
59
                    // Ignora cualquier error que se produzca intentando mostrar el mensaje de error y nos
60
                    // conformaremos con que este en el log.
61
                }
62
                logger.info("Error dispaching event",e);
63
			}
64
			
65
		} catch (Error e){
66
			NotificationManager.addError(
67
			    Messages.getString("Error de la applicacion.  \nEs conveniente que salga de la aplicaci?n\n\n"+e.getLocalizedMessage()), e);
68
		}
69
	}
70
	
71
	private boolean canShowWindow(Throwable th, AWTEvent event) {
72
	    
73
	    try {
74
	        if( event instanceof MouseEvent ) {
75
	            MouseEvent me = (MouseEvent)event;
76
	            if( me.getButton() == 0 && me.getClickCount()==0 ) {
77
	                // Intentamos que los errores que se produzcan con los eventos de movimiento del raton
78
                    // no provoquen la aparicion de la ventana de errores ya que llega a bloquear al usuario.
79
                    // Intentaremos sacarlos en la barra de estado si podemos.
80
	                return false;
81
	            }
82
	        }
83
	        StackTraceElement[] stack_ee = th.getStackTrace();
84
	        for (int i=0; i<stack_ee.length; i++) {
85
	            StackTraceElement se = stack_ee[i];
86
	            if (se.getClassName().startsWith("org.gvsig.fmap.mapcontrol.MapControl")) {
87
	                return false;
88
	            }
89
	        }
90
	    } catch (Throwable t) {
91
	        
92
	    }
93
        return true;
94
	    
95
	}
96
}
0 97

  
tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/wizard/WizardAndami.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.andami.ui.wizard;
25

  
26
import java.awt.BorderLayout;
27

  
28
import javax.swing.ImageIcon;
29
import javax.swing.JPanel;
30

  
31
import org.gvsig.andami.PluginServices;
32
import org.gvsig.andami.ui.mdiManager.IWindow;
33
import org.gvsig.andami.ui.mdiManager.WindowInfo;
34

  
35
import jwizardcomponent.CancelAction;
36
import jwizardcomponent.DefaultJWizardComponents;
37
import jwizardcomponent.FinishAction;
38

  
39

  
40
public class WizardAndami extends JPanel implements IWindow {
41
	WindowInfo viewInfo = null;
42
	WizardPanelWithLogo wizardPanel;
43

  
44
	// No deber?an necesitarse un FinishAction y un CancelAction, pero bueno,
45
	// lo mantengo por ahora.
46
	private class CloseAction extends FinishAction
47
	{
48
		IWindow v;
49
		public CloseAction(IWindow view)
50
		{
51
			super(wizardPanel.getWizardComponents());
52
			v = view;
53
		}
54
		public void performAction() {
55
			PluginServices.getMDIManager().closeWindow(v);
56
		}
57

  
58
	}
59
	private class CloseAction2 extends CancelAction
60
	{
61

  
62
		IWindow v;
63
		public CloseAction2(IWindow view)
64
		{
65
			super(wizardPanel.getWizardComponents());
66
			v = view;
67
		}
68
		public void performAction() {
69
			PluginServices.getMDIManager().closeWindow(v);
70
		}
71

  
72
	}
73

  
74

  
75
	public WizardAndami(ImageIcon logo)
76
	{
77
		wizardPanel = new WizardPanelWithLogo(logo);
78
		CloseAction closeAction = new CloseAction(this);
79
		CloseAction2 closeAction2 = new CloseAction2(this);
80
		wizardPanel.getWizardComponents().setFinishAction(closeAction);
81
		wizardPanel.getWizardComponents().setCancelAction(closeAction2);
82

  
83
		this.setLayout(new BorderLayout());
84
		this.add(wizardPanel, BorderLayout.CENTER);
85
	}
86

  
87
	public DefaultJWizardComponents getWizardComponents()
88
	{
89
		return wizardPanel.getWizardComponents();
90
	}
91

  
92

  
93
	public WindowInfo getWindowInfo() {
94
		if (viewInfo == null)
95
		{
96
			viewInfo = new WindowInfo(WindowInfo.MODALDIALOG|WindowInfo.RESIZABLE);
97
		}
98
		return viewInfo;
99
	}
100

  
101
	public Object getWindowProfile() {
102
		// TODO Auto-generated method stub
103
		return WindowInfo.DIALOG_PROFILE;
104
	}
105

  
106
}
0 107

  
tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/wizard/WizardPanelWithLogo.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.andami.ui.wizard;
25

  
26
import java.awt.BorderLayout;
27
import java.awt.Color;
28

  
29
import javax.swing.ImageIcon;
30
import javax.swing.JLabel;
31
import javax.swing.JPanel;
32
import javax.swing.JSeparator;
33

  
34
import jwizardcomponent.CancelAction;
35
import jwizardcomponent.DefaultJWizardComponents;
36
import jwizardcomponent.FinishAction;
37
import jwizardcomponent.common.SimpleButtonPanel;
38

  
39
public class WizardPanelWithLogo extends JPanel {
40
	  DefaultJWizardComponents wizardComponents;
41

  
42
	  JPanel buttonPanel;
43
	  JLabel statusLabel = new JLabel();
44

  
45
	  ImageIcon logo;
46

  
47
	  public WizardPanelWithLogo(ImageIcon logo) {
48
	    this.logo = logo;
49
	    wizardComponents = new DefaultJWizardComponents();
50
	    init();
51
	  }
52

  
53
	  private void init() {
54
	    
55

  
56
	    JPanel logoPanel = new JPanel();
57

  
58
	    String fileString;
59
	    if (logo.toString().indexOf("file:") < 0 &&
60
	        logo.toString().indexOf("http:") < 0) {
61
	      fileString = "file:///" +System.getProperty("user.dir") +"/"
62
	                        +logo.toString();
63
	      fileString = fileString.replaceAll("\\\\", "/");
64
	    } else {
65
	      fileString = logo.toString();
66
	    }
67
	    logoPanel.add(new JLabel(logo));
68
	    logoPanel.setBackground(Color.WHITE);
69
	    this.setLayout(new BorderLayout());
70
	    this.add(logoPanel, BorderLayout.WEST);
71
	    this.add(wizardComponents.getWizardPanelsContainer(),
72
	    							BorderLayout.CENTER);
73

  
74
	    JPanel auxPanel = new JPanel(new BorderLayout());
75
	    auxPanel.add(new JSeparator(), BorderLayout.NORTH);
76

  
77
	    buttonPanel = new SimpleButtonPanel(wizardComponents);
78
	    auxPanel.add(buttonPanel);
79
	    this.add(auxPanel, BorderLayout.SOUTH);
80
	    
81

  
82
	    wizardComponents.setFinishAction(new FinishAction(wizardComponents) {
83
	      public void performAction() {
84
	        // dispose();
85
	      }
86
	    });
87
	    wizardComponents.setCancelAction(new CancelAction(wizardComponents) {
88
	      public void performAction() {
89
	        // dispose();
90
	      }
91
	    });
92
	  }
93

  
94
	  public DefaultJWizardComponents getWizardComponents(){
95
	    return wizardComponents;
96
	  }
97

  
98
	  public void setWizardComponents(DefaultJWizardComponents aWizardComponents){
99
	    wizardComponents = aWizardComponents;
100
	  }
101

  
102
	  public void show() {
103
	    wizardComponents.updateComponents();
104
	    super.setVisible(true);
105
	  }
106

  
107
}
0 108

  
tags/org.gvsig.desktop-2.0.145/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/ui/wizard/UnsavedDataPanel.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.andami.ui.wizard;
25

  
26
import java.awt.BorderLayout;
27
import java.awt.Color;
28
import java.awt.Dimension;
29
import java.awt.FlowLayout;
30
import java.awt.GridBagConstraints;
31
import java.awt.GridBagLayout;
32
import java.awt.GridLayout;
33
import java.awt.Insets;
34
import java.awt.event.ActionEvent;
35
import java.awt.event.ActionListener;
36
import java.awt.event.MouseEvent;
37
import java.awt.event.MouseListener;
38
import java.awt.image.BufferedImage;
39
import java.util.ArrayList;
40
import java.util.Arrays;
41
import java.util.Iterator;
42
import java.util.List;
43

  
44
import javax.swing.BorderFactory;
45
import javax.swing.ImageIcon;
46
import javax.swing.JCheckBox;
47
import javax.swing.JLabel;
48
import javax.swing.JPanel;
49
import javax.swing.JScrollPane;
50

  
51
import org.gvsig.andami.IconThemeHelper;
52
import org.gvsig.andami.PluginServices;
53
import org.gvsig.andami.plugins.status.IUnsavedData;
54
import org.gvsig.andami.ui.mdiManager.IWindow;
55
import org.gvsig.andami.ui.mdiManager.WindowInfo;
56
import org.gvsig.gui.beans.swing.JButton;
57

  
58

  
59
/**
60
 * Ask for elements to save before application exit
61
 *
62
 *
63
 */
64
public class UnsavedDataPanel extends JPanel implements IWindow, ActionListener {
65
	/**
66
	 *
67
	 */
68
	private static final long serialVersionUID = -4745219917358767905L;
69

  
70

  
71
	private static ImageIcon blanckIcon = null;
72
	private JPanel pResources = null;
73
	private JPanel pButtons = null;
74
	private JScrollPane pScrollList = null;
75
	private myList list = null;
76
	private JLabel lblDescription = null;
77
	private JButton botSave = null;
78
	private JButton botDiscard = null;
79
	private JButton botDontExit = null;
80
	private JPanel pActionButtons = null;
81
	private JPanel pSelectionButtons = null;
82
	private JButton botSelectAll = null;
83
	private JButton botDeselectAll = null;
84

  
85
	private ArrayList listeners = new ArrayList();
86
	private JLabel lblResourceDescription = null;
87
	private IUnsavedData[] unsavedDataList;
88
	private String windowTitle = PluginServices.getText(this, "save_resources");
89
	private String prompt = PluginServices.getText(this, "select_resources_to_save_before_exit");
90

  
91

  
92

  
93
	/**
94
	 * This is the default constructor
95
	 */
96
	public UnsavedDataPanel(IUnsavedData[] unsavedDatalist) {
97
		super();
98
		initialize();
99
		this.setUnsavedDataArray(unsavedDatalist);
100
	}
101

  
102
	public UnsavedDataPanel(String prompt) {
103
        super();
104
        initialize();
105
        this.setUnsavedDataArray(new IUnsavedData[0]);
106
        this.prompt = prompt;
107
    }
108

  
109

  
110
	/**
111
	 * This method initializes this
112
	 *
113
	 * @return void
114
	 */
115
	private void initialize() {
116
		BorderLayout borderLayout = new BorderLayout();
117
		borderLayout.setHgap(5);
118
		borderLayout.setVgap(5);
119
		lblDescription = new JLabel();
120
		lblDescription.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
121
		lblDescription.setText(prompt);
122
		lblDescription.setPreferredSize(new Dimension(497, 30));
123
		lblDescription.setName("lblDescription");
124
		this.setLayout(borderLayout);
125
		this.setSize(396, 272);
126
		this.add(getPResources(), java.awt.BorderLayout.CENTER);
127
		this.add(getPButtons(), java.awt.BorderLayout.SOUTH);
128
		this.add(lblDescription, BorderLayout.NORTH);
129
	}
130

  
131
	/**
132
	 * This method initializes pResources
133
	 *
134
	 * @return javax.swing.JPanel
135
	 */
136
	private JPanel getPResources() {
137
		if (pResources == null) {
138
			pResources = new JPanel();
139
			pResources.setLayout(new BorderLayout());
140
			pResources.add(getPScrollList(), BorderLayout.CENTER);
141
			// pResources.add(getLblResourceDescription(), BorderLayout.SOUTH);
142
		}
143
		return pResources;
144
	}
145

  
146

  
147
	/**
148
	 * This method initializes lblResourceDescription
149
	 *
150
	 * @return javax.swing.JLabel
151
	 */
152
	private JLabel getLblResourceDescription() {
153
		if (lblResourceDescription == null) {
154
			lblResourceDescription = new JLabel();
155
			lblResourceDescription.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
156
			lblResourceDescription.setText("");
157
			lblResourceDescription.setPreferredSize(new Dimension(38, 50));
158
			lblResourceDescription.setName("lblResourceDescription");
159
		}
160
		return lblResourceDescription;
161
	}
162

  
163

  
164
	/**
165
	 * This method initializes pButtons
166
	 *
167
	 * @return javax.swing.JPanel
168
	 */
169
	private JPanel getPButtons() {
170
		if (pButtons == null) {
171
			BorderLayout borderLayout2 = new BorderLayout();
172
			borderLayout2.setHgap(5);
173
			borderLayout2.setVgap(5);
174
			pButtons = new JPanel();
175
			pButtons.setLayout(borderLayout2);
176
			pButtons.add(getPSelectionButtons(), BorderLayout.NORTH);
177
			pButtons.add(getPActionButtons(), BorderLayout.SOUTH);
178
		}
179
		return pButtons;
180
	}
181

  
182
	/**
183
	 * This method initializes pScrollList
184
	 *
185
	 * @return javax.swing.JScrollPane
186
	 */
187
	private JScrollPane getPScrollList() {
188
		if (pScrollList == null) {
189
			pScrollList = new JScrollPane();
190
			pScrollList.setPreferredSize(new java.awt.Dimension(350,350));
191
			pScrollList.setViewportView(getList());
192
		}
193
		return pScrollList;
194
	}
195

  
196
	/**
197
	 * This method initializes list
198
	 *
199
	 * @return javax.swing.JList
200
	 */
201
	private myList getList() {
202
		if (list == null) {
203
			list = new myList();
204
			list.setBackground(Color.white);
205
		}
206
		return list;
207
	}
208

  
209
	/**
210
	 * This method initializes botSave
211
	 *
212
	 * @return javax.swing.JButton
213
	 */
214
	private JButton getBotSave() {
215
		if (botSave == null) {
216
			botSave = new JButton();
217
			botSave.setName("botSave");
218
			botSave.setToolTipText(PluginServices.getText(this, "save_selected_resources_and_exit"));
219
			botSave.setText(PluginServices.getText(this, "ok"));
220
			botSave.setActionCommand("Accept");
221
			botSave.addActionListener(this);
222
		}
223
		return botSave;
224
	}
225

  
226
	/**
227
	 * This method initializes botDiscard
228
	 *
229
	 * @return javax.swing.JButton
230
	 */
231
	private JButton getBotDiscard() {
232
		if (botDiscard == null) {
233
			botDiscard = new JButton();
234
			botDiscard.setName("botDiscard");
235
			botDiscard.setToolTipText(PluginServices.getText(this, "discard_changes_and_exit"));
236
			botDiscard.setText(PluginServices.getText(this, "discard_changes"));
237
			botDiscard.setActionCommand("Discard");
238
			botDiscard.addActionListener(this);
239
		}
240
		return botDiscard;
241
	}
242

  
243
	/**
244
	 * This method initializes botDontExit
245
	 *
246
	 * @return javax.swing.JButton
247
	 */
248
	private JButton getBotDontExit() {
249
		if (botDontExit == null) {
250
			botDontExit = new JButton();
251
			botDontExit.setName("botDontExit");
252
			botDontExit.setToolTipText(PluginServices.getText(this, "cancel_the_application_termination"));
253
			botDontExit.setText(PluginServices.getText(this, "cancelar"));
254
			botDontExit.setActionCommand("Cancel");
255
			botDontExit.addActionListener(this);
256
		}
257
		return botDontExit;
258
	}
259

  
260
	/**
261
	 * This method initializes pActionButtons
262
	 *
263
	 * @return javax.swing.JPanel
264
	 */
265
	private JPanel getPActionButtons() {
266
		if (pActionButtons == null) {
267

  
268
		    GridLayout gl = new GridLayout(1, 3, 8, 0);
269
		    /*
270
			FlowLayout flowLayout = new FlowLayout();
271
			flowLayout.setAlignment(FlowLayout.RIGHT);
272
			*/
273
			pActionButtons = new JPanel();
274
			pActionButtons.setBorder(BorderFactory.createEmptyBorder(8,8,8,8));
275
			pActionButtons.setLayout(gl);
276
			pActionButtons.setName("pActionButtons");
277
			pActionButtons.add(getBotSave());
278
			pActionButtons.add(getBotDiscard());
279
			pActionButtons.add(getBotDontExit());
280
		}
281
		return pActionButtons;
282
	}
283

  
284
	/**
285
	 * This method initializes pSelectionButtons
286
	 *
287
	 * @return javax.swing.JPanel
288
	 */
289
	private JPanel getPSelectionButtons() {
290
		if (pSelectionButtons == null) {
291
		    GridLayout gl = new GridLayout(2, 3, 8, 8);
292
		    /*
293
			FlowLayout flowLayout1 = new FlowLayout();
294
			flowLayout1.setAlignment(FlowLayout.LEFT);
295
			*/
296
			pSelectionButtons = new JPanel();
297
			pSelectionButtons.setBorder(BorderFactory.createEmptyBorder(5,8,8,8));
298
			pSelectionButtons.setLayout(gl);
299
			pSelectionButtons.setName("pSelectionButtons");
300
			pSelectionButtons.add(getBotSelectAll());
301
			pSelectionButtons.add(new JLabel());
302
			pSelectionButtons.add(new JLabel());
303
			// new row
304
			pSelectionButtons.add(getBotDeselectAll());
305
			pSelectionButtons.add(new JLabel());
306
            pSelectionButtons.add(new JLabel());
307

  
308
		}
309
		return pSelectionButtons;
310
	}
311

  
312
	/**
313
	 * This method initializes botSelectAll
314
	 *
315
	 * @return javax.swing.JButton
316
	 */
317
	private JButton getBotSelectAll() {
318
		if (botSelectAll == null) {
319
			botSelectAll = new JButton();
320
			botSelectAll.setText(PluginServices.getText(this, "select_all"));
321
			botSelectAll.setName("botSelectAll");
322
			botSelectAll.setToolTipText(PluginServices.getText(this, "select_all_resources"));
323
			botSelectAll.setActionCommand("SelectAll");
324
			botSelectAll.addActionListener(this);
325
		}
326
		return botSelectAll;
327
	}
328

  
329
	/**
330
	 * This method initializes botDeselectAll
331
	 *
332
	 * @return javax.swing.JButton
333
	 */
334
	private JButton getBotDeselectAll() {
335
		if (botDeselectAll == null) {
336
			botDeselectAll = new JButton();
337
			botDeselectAll.setName("botDeselectAll");
338
			botDeselectAll.setToolTipText(PluginServices.getText(this, "deselect_all_resources"));
339
			botDeselectAll.setText(PluginServices.getText(this, "deselect_all"));
340
			botDeselectAll.setActionCommand("DeselectAll");
341
			botDeselectAll.addActionListener(this);
342
		}
343
		return botDeselectAll;
344
	}
345

  
346
	public WindowInfo getWindowInfo() {
347
		WindowInfo wi = new WindowInfo(WindowInfo.MODALDIALOG
348
				| WindowInfo.RESIZABLE
349
				| WindowInfo.MAXIMIZABLE);
350
		wi.setTitle(windowTitle);
351
		wi.setHeight(270);
352
		wi.setWidth(450);
353
		return wi;
354
	}
355

  
356
	public void setWindowTitle(String windowTitle) {
357
		this.windowTitle = windowTitle;
358
	}
359

  
360
	public void setCancelText(String text, String tooltipText) {
361
		getBotDontExit().setToolTipText(tooltipText);
362
		getBotDontExit().setText(text);
363
	}
364

  
365
	public void setDiscardText(String text, String tooltipText) {
366
		getBotDiscard().setToolTipText(tooltipText);
367
		getBotDiscard().setText(text);
368
	}
369

  
370
	public void setAcceptText(String text, String tooltipText) {
371
		getBotSave().setToolTipText(tooltipText);
372
		getBotSave().setText(text);
373
	}
374

  
375
	public void setHeaderText(String text) {
376
		lblDescription.setText(text);
377
	}
378

  
379
	/**
380
	 * Register a listener to call
381
	 *
382
	 * @param a UnsavedDataPanelListener instance
383
	 */
384
	public void addActionListener(UnsavedDataPanelListener listener){
385
		this.listeners.add(listener);
386
	}
387

  
388
	public void removeActionListener(UnsavedDataPanelListener listener){
389
		this.listeners.remove(listener);
390
	}
391

  
392
	public class UnsavedDataPanelListener {
393
		public void cancel(UnsavedDataPanel panel){
394

  
395
		}
396

  
397
		public void accept(UnsavedDataPanel panel){
398

  
399
		}
400

  
401
		public void discard(UnsavedDataPanel panel) {
402

  
403
		}
404
	}
405

  
406
	private class myList extends JPanel{
407

  
408
		/**
409
		 *
410
		 */
411
		private static final long serialVersionUID = 3179254463477354501L;
412

  
413
		private GridBagConstraints constraints;
414
		private GridBagConstraints constraintsLast;
415

  
416
		public myList(){
417
			super();
418
			initialize();
419
		}
420

  
421
		private void initialize(){
422
			this.setLayout(new GridBagLayout());
423
			this.constraints = new GridBagConstraints();
424
			this.constraints.fill = GridBagConstraints.HORIZONTAL;
425
			this.constraints.gridwidth = GridBagConstraints.REMAINDER;
426
			this.constraints.weightx =0;
427
			this.constraints.gridx =0;
428
			this.constraints.gridy=0;
429
			this.constraints.anchor = GridBagConstraints.WEST;
430
			this.constraints.insets =new Insets(3,3,0,0);
431

  
432
			this.constraintsLast = new GridBagConstraints();
433
			this.constraintsLast.fill = GridBagConstraints.BOTH;
434
			this.constraintsLast.gridheight = GridBagConstraints.REMAINDER;
435
			this.constraintsLast.gridwidth = GridBagConstraints.REMAINDER;
436
			this.constraintsLast.gridx =0;
437
			this.constraintsLast.weightx =1;
438
			this.constraintsLast.weighty =1;
439
			this.constraintsLast.anchor = GridBagConstraints.FIRST_LINE_START;
440

  
441

  
442
		}
443

  
444
		public void addItems(IUnsavedData[] itemList){
445
			int i;
446
			this.removeAll();
447
			if (itemList.length == 0){
448
				return;
449
			}
450

  
451
			for (i=0;i< itemList.length;i++){
452
				this.constraints.gridy = i;
453
				this.add(newItem(itemList[i]), this.constraints);
454
			}
455
			this.constraintsLast.gridy=itemList.length;
456
			this.add(new JLabel(),this.constraintsLast);
457

  
458
		}
459
		public int getItemsCount(){
460
			return this.getComponentCount() -1;
461
		}
462

  
463
		public myUnsavedItem getItem(int i){
464
			if (i>= this.getComponentCount()){
465
				return null;
466
			}
467
			return (myUnsavedItem)this.getComponent(i);
468
		}
469

  
470
		private myUnsavedItem newItem(IUnsavedData itemData){
471
			myUnsavedItem item;
472
			item = new myUnsavedItem(itemData);
473
			item.addMouseListener(new MouseListener(){
474
				public void mouseClicked(MouseEvent e) {
475
					myUnsavedItem item = (myUnsavedItem)e.getComponent();
476
					getLblResourceDescription().setText(item.getDescription());
477
				}
478
				public void mouseEntered(MouseEvent e) {
479
				}
480

  
481
				public void mouseExited(MouseEvent e) {
482
				}
483

  
484
				public void mousePressed(MouseEvent e) {
485
				}
486

  
487
				public void mouseReleased(MouseEvent e) {
488
				}
489

  
490
			});
491
			return item;
492
		}
493

  
494
	}
495

  
496
	private class myUnsavedItem extends JPanel{
497
		/**
498
		 *
499
		 */
500
		private static final long serialVersionUID = -6280057775368437349L;
501
		private JCheckBox chkChecked;
502
		private JLabel lblText;
503
		private IUnsavedData dataItem;
504

  
505
		public myUnsavedItem(IUnsavedData dataItem ){
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff