Revision 704

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/About.java
8 8

  
9 9
import com.iver.andami.PluginServices;
10 10
import com.iver.andami.plugins.Extension;
11
import com.iver.cit.gvsig.gui.legendmanager.panels.FPanelAbout;
11
import com.iver.cit.gvsig.gui.Panels.FPanelAbout;
12 12

  
13 13
/**
14 14
 * DOCUMENT ME!
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/DEMO/SingleView.java
53 53
import com.iver.cit.gvsig.gui.IView;
54 54
import com.iver.cit.gvsig.gui.InfoListener;
55 55
import com.iver.cit.gvsig.gui.Dialogs.FInfoDialog;
56
import com.iver.cit.gvsig.gui.legendmanager.panels.FPanelAbout;
56
import com.iver.cit.gvsig.gui.Panels.FPanelAbout;
57 57
import com.iver.cit.gvsig.gui.toc.TOC;
58 58

  
59 59

  
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/Panels/FPanelAbout.java
1
/*
2
 * Created on 02-sep-2004
3
 *
4
 * TODO To change the template for this generated file go to
5
 * Window - Preferences - Java - Code Generation - Code and Comments
6
 */
7
package com.iver.cit.gvsig.gui.Panels;
8

  
9
import java.awt.BorderLayout;
10
import java.io.BufferedReader;
11
import java.io.FileNotFoundException;
12
import java.io.FileReader;
13
import java.io.IOException;
14
import java.util.StringTokenizer;
15

  
16
import javax.swing.JButton;
17
import javax.swing.JDialog;
18
import javax.swing.JEditorPane;
19
import javax.swing.JLabel;
20
import javax.swing.JPanel;
21
import javax.swing.JScrollPane;
22
import javax.swing.event.HyperlinkEvent;
23

  
24
import org.apache.log4j.Logger;
25

  
26
import com.hardcode.gdbms.engine.instruction.Utilities;
27
import com.iver.andami.PluginServices;
28
import com.iver.andami.ui.mdiManager.View;
29
import com.iver.andami.ui.mdiManager.ViewInfo;
30
/**
31
 * @author FJP
32
 *
33
 * TODO To change the template for this generated type comment go to
34
 * Window - Preferences - Java - Code Generation - Code and Comments
35
 */
36
public class FPanelAbout extends JPanel implements View {
37

  
38
	private static Logger logger = Logger.getLogger(FPanelAbout.class.getName());
39
	private JEditorPane jEditorPane = null;
40
	private JScrollPane jScrollPane = null;
41
	private JEditorPane jEditorPane1 = null;
42
	private JPanel jPanel = null;
43
	private JButton jButton = null;
44
	
45
	private JLabel jLblVersion = null;
46
	/**
47
	 * This is the default constructor
48
	 * @throws FileNotFoundException
49
	 */
50
	public FPanelAbout(){
51
		super();
52
		initialize();
53
	}
54
	/**
55
	 * This method initializes this
56
	 * 
57
	 * @return void
58
	 * @throws FileNotFoundException
59
	 */
60
	private  void initialize(){
61
		this.setLayout(new BorderLayout());
62
		this.setSize(600, 450);
63
		this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
64
		this.add(getJPanel(), java.awt.BorderLayout.SOUTH);
65
		try {
66
			// Leemos el n? de versi?n y se lo pegamos a jLblVersion
67
			BufferedReader fich = new BufferedReader(
68
					new FileReader(FPanelAbout.class.getResource("/build.number").getFile()));
69
			fich.readLine();
70
			fich.readLine();
71
			String strVer = fich.readLine();
72
			StringTokenizer strTokenizer = new StringTokenizer(strVer);
73
			String strToken = strTokenizer.nextToken("=");
74
			strToken = strTokenizer.nextToken();
75
			jLblVersion.setText(jLblVersion.getText() + " (" + strToken + ")");
76
			fich.close();
77
		} catch (Exception e) {
78
			e.printStackTrace();
79
		}
80
	}
81

  
82
	/**
83
	 * This method initializes jScrollPane	
84
	 * 	
85
	 * @return javax.swing.JScrollPane	
86
	 */    
87
	private JScrollPane getJScrollPane() {
88
		if (jScrollPane == null) {
89
			jScrollPane = new JScrollPane();
90
			jScrollPane.setPreferredSize(new java.awt.Dimension(300,400));
91
			jScrollPane.setViewportView(getJEditorPane());
92
		}
93
		return jScrollPane;
94
	}
95
	/**
96
	 * This method initializes jEditorPane1	
97
	 * 	
98
	 * @return javax.swing.JEditorPane	
99
	 */    
100
		private JEditorPane getJEditorPane() {
101
			if (jEditorPane == null) {
102
				jEditorPane = new JEditorPane();
103
				
104
				jEditorPane.setEditable(false);
105
				jEditorPane.setContentType("text/html");
106
				jEditorPane.setPreferredSize(new java.awt.Dimension(300,200));
107
				
108
				java.net.URL aboutURL = FPanelAbout.class.getResource(
109
				                                "/about.htm");
110
				if (aboutURL != null) {
111
				    try {
112
				    	jEditorPane.setPage(aboutURL);
113
				    	jEditorPane.addHyperlinkListener(new javax.swing.event.HyperlinkListener() { 
114
				    		public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e) {
115
				    			if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
116
				    			{
117
				    	 		      JEditorPane pane = (JEditorPane) e.getSource();
118
				    	 		      System.out.println("hyperlinkUpdate()"); // TODO Auto-generated Event stub hyperlinkUpdate()
119
				    	 		      BrowserControl.displayURL(e.getURL().toString());
120
				    	 		      // if (e instanceof HTMLFrameHyperlinkEvent) {
121
				    			}
122

  
123
				    			
124
				    		}
125
				    	});
126
				    } catch (IOException e) {
127
				        System.err.println("Attempted to read a bad URL: " + aboutURL);
128
				    }
129
				} else {
130
				    System.err.println("Couldn't find file: about.html" + aboutURL.getPath());
131
				}
132
				
133
			}
134
			return jEditorPane;
135
		}
136
	/**
137
	 * This method initializes jPanel	
138
	 * 	
139
	 * @return javax.swing.JPanel	
140
	 */    
141
	private JPanel getJPanel() {
142
		if (jPanel == null) {
143
			jLblVersion = new JLabel();
144
			jPanel = new JPanel();
145
			jPanel.setLayout(null);
146
			jPanel.setPreferredSize(new java.awt.Dimension(10,50));
147
			jLblVersion.setBounds(31, 20, 172, 17);
148
			jLblVersion.setText("Version 0.3  ");
149
			jPanel.add(getJButton(), null);
150
			jPanel.add(jLblVersion, null);
151
		}
152
		return jPanel;
153
	}
154
	/**
155
	 * This method initializes jButton	
156
	 * 	
157
	 * @return javax.swing.JButton	
158
	 */    
159
	private JButton getJButton() {
160
		if (jButton == null) {
161
			jButton = new JButton();
162
			jButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
163
			jButton.setText("Cerrar");
164
			jButton.setBounds(266, 12, 94, 25);
165
			jButton.addActionListener(new java.awt.event.ActionListener() { 
166
				public void actionPerformed(java.awt.event.ActionEvent e) {    
167
					System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
168
					if (PluginServices.getMainFrame() != null)
169
					{
170
						PluginServices.getMDIManager().closeView(FPanelAbout.this);
171
					}
172
					else 
173
					{
174
						((JDialog) (getParent().getParent().getParent().getParent())).dispose();
175
					}
176
					
177
				}
178
			});
179
		}
180
		return jButton;
181
	}
182
	/* (non-Javadoc)
183
	 * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
184
	 */
185
	public ViewInfo getViewInfo() {
186
		ViewInfo m_ViewInfo = new ViewInfo(ViewInfo.MODALDIALOG|ViewInfo.RESIZABLE);
187
		m_ViewInfo.setTitle(PluginServices.getText(this,"acerca_de"));
188

  
189
		return m_ViewInfo;
190
	}
191
	/* (non-Javadoc)
192
	 * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
193
	 */
194
	public void viewActivated() {
195
		// TODO Auto-generated method stub
196
		
197
	}
198
}  //  @jve:decl-index=0:visual-constraint="10,10"
0 199

  
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/legendmanager/panels/FPanelAbout.java
1
/*
2
 * Created on 02-sep-2004
3
 *
4
 * TODO To change the template for this generated file go to
5
 * Window - Preferences - Java - Code Generation - Code and Comments
6
 */
7
package com.iver.cit.gvsig.gui.legendmanager.panels;
8

  
9
import java.awt.BorderLayout;
10
import java.io.BufferedReader;
11
import java.io.FileNotFoundException;
12
import java.io.FileReader;
13
import java.io.IOException;
14
import java.util.StringTokenizer;
15

  
16
import javax.swing.JButton;
17
import javax.swing.JDialog;
18
import javax.swing.JEditorPane;
19
import javax.swing.JLabel;
20
import javax.swing.JPanel;
21
import javax.swing.JScrollPane;
22
import javax.swing.event.HyperlinkEvent;
23

  
24
import org.apache.log4j.Logger;
25

  
26
import com.hardcode.gdbms.engine.instruction.Utilities;
27
import com.iver.andami.PluginServices;
28
import com.iver.andami.ui.mdiManager.View;
29
import com.iver.andami.ui.mdiManager.ViewInfo;
30
import com.iver.cit.gvsig.gui.Panels.BrowserControl;
31
/**
32
 * @author FJP
33
 *
34
 * TODO To change the template for this generated type comment go to
35
 * Window - Preferences - Java - Code Generation - Code and Comments
36
 */
37
public class FPanelAbout extends JPanel implements View {
38

  
39
	private static Logger logger = Logger.getLogger(FPanelAbout.class.getName());
40
	private JEditorPane jEditorPane = null;
41
	private JScrollPane jScrollPane = null;
42
	private JEditorPane jEditorPane1 = null;
43
	private JPanel jPanel = null;
44
	private JButton jButton = null;
45
	
46
	private JLabel jLblVersion = null;
47
	/**
48
	 * This is the default constructor
49
	 * @throws FileNotFoundException
50
	 */
51
	public FPanelAbout(){
52
		super();
53
		initialize();
54
	}
55
	/**
56
	 * This method initializes this
57
	 * 
58
	 * @return void
59
	 * @throws FileNotFoundException
60
	 */
61
	private  void initialize(){
62
		this.setLayout(new BorderLayout());
63
		this.setSize(600, 450);
64
		this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
65
		this.add(getJPanel(), java.awt.BorderLayout.SOUTH);
66
		try {
67
			// Leemos el n? de versi?n y se lo pegamos a jLblVersion
68
			BufferedReader fich = new BufferedReader(
69
					new FileReader(FPanelAbout.class.getResource("/build.number").getFile()));
70
			fich.readLine();
71
			fich.readLine();
72
			String strVer = fich.readLine();
73
			StringTokenizer strTokenizer = new StringTokenizer(strVer);
74
			String strToken = strTokenizer.nextToken("=");
75
			strToken = strTokenizer.nextToken();
76
			jLblVersion.setText(jLblVersion.getText() + " (" + strToken + ")");
77
			fich.close();
78
		} catch (Exception e) {
79
			e.printStackTrace();
80
		}
81
	}
82

  
83
	/**
84
	 * This method initializes jScrollPane	
85
	 * 	
86
	 * @return javax.swing.JScrollPane	
87
	 */    
88
	private JScrollPane getJScrollPane() {
89
		if (jScrollPane == null) {
90
			jScrollPane = new JScrollPane();
91
			jScrollPane.setPreferredSize(new java.awt.Dimension(300,400));
92
			jScrollPane.setViewportView(getJEditorPane());
93
		}
94
		return jScrollPane;
95
	}
96
	/**
97
	 * This method initializes jEditorPane1	
98
	 * 	
99
	 * @return javax.swing.JEditorPane	
100
	 */    
101
		private JEditorPane getJEditorPane() {
102
			if (jEditorPane == null) {
103
				jEditorPane = new JEditorPane();
104
				
105
				jEditorPane.setEditable(false);
106
				jEditorPane.setContentType("text/html");
107
				jEditorPane.setPreferredSize(new java.awt.Dimension(300,200));
108
				
109
				java.net.URL aboutURL = FPanelAbout.class.getResource(
110
				                                "/about.htm");
111
				if (aboutURL != null) {
112
				    try {
113
				    	jEditorPane.setPage(aboutURL);
114
				    	jEditorPane.addHyperlinkListener(new javax.swing.event.HyperlinkListener() { 
115
				    		public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e) {
116
				    			if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
117
				    			{
118
				    	 		      JEditorPane pane = (JEditorPane) e.getSource();
119
				    	 		      System.out.println("hyperlinkUpdate()"); // TODO Auto-generated Event stub hyperlinkUpdate()
120
				    	 		      BrowserControl.displayURL(e.getURL().toString());
121
				    	 		      // if (e instanceof HTMLFrameHyperlinkEvent) {
122
				    			}
123

  
124
				    			
125
				    		}
126
				    	});
127
				    } catch (IOException e) {
128
				        System.err.println("Attempted to read a bad URL: " + aboutURL);
129
				    }
130
				} else {
131
				    System.err.println("Couldn't find file: about.html" + aboutURL.getPath());
132
				}
133
				
134
			}
135
			return jEditorPane;
136
		}
137
	/**
138
	 * This method initializes jPanel	
139
	 * 	
140
	 * @return javax.swing.JPanel	
141
	 */    
142
	private JPanel getJPanel() {
143
		if (jPanel == null) {
144
			jLblVersion = new JLabel();
145
			jPanel = new JPanel();
146
			jPanel.setLayout(null);
147
			jPanel.setPreferredSize(new java.awt.Dimension(10,50));
148
			jLblVersion.setBounds(31, 20, 172, 17);
149
			jLblVersion.setText("Version 0.3  ");
150
			jPanel.add(getJButton(), null);
151
			jPanel.add(jLblVersion, null);
152
		}
153
		return jPanel;
154
	}
155
	/**
156
	 * This method initializes jButton	
157
	 * 	
158
	 * @return javax.swing.JButton	
159
	 */    
160
	private JButton getJButton() {
161
		if (jButton == null) {
162
			jButton = new JButton();
163
			jButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
164
			jButton.setText("Cerrar");
165
			jButton.setBounds(266, 12, 94, 25);
166
			jButton.addActionListener(new java.awt.event.ActionListener() { 
167
				public void actionPerformed(java.awt.event.ActionEvent e) {    
168
					System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
169
					if (PluginServices.getMainFrame() != null)
170
					{
171
						PluginServices.getMDIManager().closeView(FPanelAbout.this);
172
					}
173
					else 
174
					{
175
						((JDialog) (getParent().getParent().getParent().getParent())).dispose();
176
					}
177
					
178
				}
179
			});
180
		}
181
		return jButton;
182
	}
183
	/* (non-Javadoc)
184
	 * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
185
	 */
186
	public ViewInfo getViewInfo() {
187
		ViewInfo m_ViewInfo = new ViewInfo(ViewInfo.MODALDIALOG|ViewInfo.RESIZABLE);
188
		m_ViewInfo.setTitle(PluginServices.getText(this,"acerca_de"));
189

  
190
		return m_ViewInfo;
191
	}
192
	/* (non-Javadoc)
193
	 * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
194
	 */
195
	public void viewActivated() {
196
		// TODO Auto-generated method stub
197
		
198
	}
199
}  //  @jve:decl-index=0:visual-constraint="10,10"
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/legendmanager/panels/FPanelLegendLabels.java
30 30
 * @author fjp
31 31
 *
32 32
 */
33
public class FPanelLegendLabels extends JPanel {
33
public class FPanelLegendLabels extends JPanel implements ILegendPanel {
34 34
	private static final Font DEFAULT_FONT = 
35 35
		  new Font("SansSerif", Font.PLAIN, 9);
36 36
	
......
134 134
			fPreviewSymbol.setSymbol(sym);
135 135
		}
136 136
	}
137
	public void updateValuesFromControls() {
137
	private void updateValuesFromControls() {
138 138
		if (getJCheckBox().isSelected())
139 139
		{
140 140
			m_Renderer.setLabelField((String) getJComboBox().getSelectedItem());
......
463 463
		}
464 464
		return jLabel4;
465 465
	}
466
	/* (non-Javadoc)
467
	 * @see com.iver.cit.gvsig.gui.legendmanager.panels.ILegendPanel#getLegend()
468
	 */
469
	public Legend getLegend() {
470
		updateValuesFromControls();
471
		return m_Renderer;
472
	}
466 473

  
467 474
        }  //  @jve:visual-info  decl-index=0 visual-constraint="10,10"
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/legendmanager/FLegendManagerWindow.java
266 266
           	m_Renderer = m_breaksLegendPanel.getLegend();
267 267
           	break;
268 268
        case 3://text
269
        	m_labelsLegendPanel.updateValuesFromControls();
269
        	m_Renderer = m_labelsLegendPanel.getLegend();
270 270
        }
271 271
        try {
272 272
			aux.setLegend((VectorialLegend) m_Renderer);

Also available in: Unified diff