Revision 547

View differences:

org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/resources/README.txt
1
Put into this folder the resources needed by your classes.
2

  
3
This folder is added to the classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your classes.
0 9

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.construc">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/DefaultDataPropertiesPanel.java
1
package org.gvsig.chart.main;
2

  
3
import java.awt.GridBagConstraints;
4
import java.awt.GridBagLayout;
5
import java.awt.Insets;
6
import java.awt.event.ActionEvent;
7
import java.awt.event.ActionListener;
8
import java.util.ArrayList;
9

  
10
import javax.swing.JButton;
11
import javax.swing.JComboBox;
12
import javax.swing.JLabel;
13
import javax.swing.SwingConstants;
14

  
15
import org.gvsig.chart.ChartLocator;
16
import org.gvsig.chart.ChartProperties;
17
import org.gvsig.chart.lib.spi.ChartServiceManager;
18
import org.gvsig.chart.main.panels.ChartUsedFieldPropertiesPanel;
19
import org.gvsig.chart.main.utils.ChartJPanel;
20
import org.gvsig.chart.model.variables.ObservableUsedChartServices;
21
import org.gvsig.chart.model.variables.RequiredField;
22
import org.gvsig.chart.swing.ChartSwingLocator;
23
import org.gvsig.chart.swing.spi.ChartSwingServiceManager;
24

  
25
public class DefaultDataPropertiesPanel extends ChartJPanel{
26

  
27
	/**
28
	 * 
29
	 */
30
	private static final long serialVersionUID = 3973104135478200344L;
31
	
32
	private ArrayList<JComboBox> cbos = new ArrayList<JComboBox>();
33
	private JButton backButton; 
34
	private JButton FinishButton;
35
	private JButton cancelButton;
36
	
37
	private ChartUsedFieldPropertiesPanel previousPanel;
38
	private ChartServiceManager serviceManager;
39
	private ChartSwingServiceManager swingManager;
40
	
41
	public DefaultDataPropertiesPanel(ChartProperties props, ChartUsedFieldPropertiesPanel chartUsedFieldPropertiesPanel) {
42
		
43
		this.previousPanel = chartUsedFieldPropertiesPanel;
44
		
45
		serviceManager = ChartLocator.getServiceManager();
46
		swingManager = ChartSwingLocator.getSwingManager();
47
		
48
		GridBagLayout gridBagLayout = new GridBagLayout();
49
		setLayout(gridBagLayout);
50
		
51
		JLabel lblChartDataDefinition = new JLabel("Chart Data Definition");
52
		GridBagConstraints gbc_lblChartDataDefinition = new GridBagConstraints();
53
		gbc_lblChartDataDefinition.gridwidth = 4;
54
		gbc_lblChartDataDefinition.anchor = GridBagConstraints.WEST;
55
		gbc_lblChartDataDefinition.insets = new Insets(0, 0, 5, 0);
56
		gbc_lblChartDataDefinition.gridx = 0;
57
		gbc_lblChartDataDefinition.gridy = 0;
58
		add(lblChartDataDefinition, gbc_lblChartDataDefinition);
59
		
60
//		JLabel lblNewLabel = new JLabel("Tabla");
61
//		add(lblNewLabel);
62
//		JComboBox cboTable = new JComboBox();
63
//		add(cboTable);
64
		
65
		int i = 0;
66
		for (i = 0; i < props.getRequiredFields().size(); i++) {
67
//			RequiredField f = props.getRequiredFields().get(i);
68
//			JLabel lbl = new JLabel(f.getDescription());
69
//			add(lbl);
70
//			JComboBox cbo = new JComboBox();
71
//			cbo.setName("cbo" + f.getName());
72
//			cbos.add(cbo);
73
//			add(cbo);
74
				
75
			RequiredField f = props.getRequiredFields().get(i);
76
			JLabel lblNewLabel = new JLabel(f.getDescription());
77
			GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
78
			gbc_lblNewLabel.fill = GridBagConstraints.BOTH;
79
			gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
80
			gbc_lblNewLabel.gridx = 0;
81
			gbc_lblNewLabel.gridy = 1+i;
82
			add(lblNewLabel, gbc_lblNewLabel);
83
			JComboBox cboTable = new JComboBox();
84
			GridBagConstraints gbc_cboTable = new GridBagConstraints();
85
			gbc_cboTable.gridwidth = 3;
86
			gbc_cboTable.insets = new Insets(0, 0, 5, 0);
87
			gbc_cboTable.fill = GridBagConstraints.BOTH;
88
			gbc_cboTable.gridx = 1;
89
			gbc_cboTable.gridy = 1+i;
90
			add(cboTable, gbc_cboTable);
91
			
92
			cbos.add(cboTable);
93
		}
94
		
95
		backButton = new JButton("<  Back");
96
		backButton.setHorizontalAlignment(SwingConstants.LEFT);
97
		GridBagConstraints gbc_backButton = new GridBagConstraints();
98
		gbc_backButton.anchor = GridBagConstraints.EAST;
99
		gbc_backButton.insets = new Insets(0, 0, 0, 5);
100
		gbc_backButton.gridx = 1;
101
		gbc_backButton.gridy = 3+i;
102
		add(backButton, gbc_backButton);
103
		
104
		FinishButton = new JButton("Finish");
105
		GridBagConstraints gbc_FinishButton = new GridBagConstraints();
106
		gbc_FinishButton.insets = new Insets(0, 0, 0, 5);
107
		gbc_FinishButton.gridx = 2;
108
		gbc_FinishButton.gridy = 3+i;
109
		add(FinishButton, gbc_FinishButton);
110
		
111
		cancelButton = new JButton("Cancel");
112
		GridBagConstraints gbc_cancelButton = new GridBagConstraints();
113
		gbc_cancelButton.gridx = 3;
114
		gbc_cancelButton.gridy = 3+i;
115
		add(cancelButton, gbc_cancelButton);
116
		
117
		createButtons();
118
	}
119
	
120
	private void createButtons(){
121
		backButton.addActionListener(new ActionListener() {
122
			public void actionPerformed(ActionEvent e) {
123
				backForm();
124
			}
125
		});
126
		
127
		cancelButton.addActionListener(new ActionListener() {
128
			public void actionPerformed(ActionEvent e) {
129
				cancelForm();
130
			}
131
		});
132
		
133
		FinishButton.addActionListener(new ActionListener() {
134
			public void actionPerformed(ActionEvent e) {
135
				finishForm();
136
			}
137
		});
138
	}
139
	
140
	private void cancelForm() {
141
		this.setVisible(false);
142
		this.getParentWindow().setVisible(false);
143
	}
144
	
145
	private void finishForm() {
146
		this.setVisible(false);
147
		this.getParentWindow().setVisible(false);
148
		
149
		if(validateValues()){
150
			this.getParametersToChartProperties();
151
			
152
			ObservableUsedChartServices<ChartProperties> properties = this.getPreviousPanel().getMainContext().getChartProperties();
153
			if(this.getPreviousPanel().getPreviousChartProperties()!=null){
154
				int index = properties.indexOf(this.getPreviousPanel().getPreviousChartProperties());
155
				if(index != -1){
156
					properties.set(index, this.getPreviousPanel().getChartProperties());
157
				}
158
			}else{
159
				properties.add(this.getPreviousPanel().getChartProperties());
160
			}
161
			
162
//			// TODO Provisional
163
//			try {
164
//				ChartProperties props_overlay = serviceManager.getChartManager()
165
//				.createProperties("OverlayChart");
166
//				
167
//				ChartService service_overlay = serviceManager.getChartManager()
168
//				.createChart(props_overlay);
169
//	
170
//				ChartService service_chart = serviceManager.getChartManager()
171
//				.createChart(this.chartProperties);
172
//				
173
//				service_chart.setChartDataSet(((AbstractChart) service_chart).createDataSet());
174
//				
175
//				ArrayList<ChartService> charts = new ArrayList<ChartService>();
176
//				charts.add(service_chart);
177
//	
178
//				((OverlayChartProperties) props_overlay).setCharts(charts);
179
//	
180
//				ChartSwingPanel panel = swingManager.getChartSwingManager()
181
//						.createPanel(props_overlay);
182
//				panel.setChartService(service_overlay);
183
//	
184
//				panel.setPreferredSize(new Dimension(800, 400));
185
//				swingManager
186
//						.getChartSwingManager()
187
//						.getWindowManager()
188
//						.showWindow(panel, "Chart window",
189
//								ChartWindowManager.MODE_WINDOW);
190
//				
191
//			} catch (ServiceException e) {
192
//				// TODO Auto-generated catch block
193
//				e.printStackTrace();
194
//			}
195
		}else{
196
			
197
		}
198

  
199
		
200
	}
201
	
202
	/**
203
	 * Check if the values have the correct format
204
	 * @return boolean
205
	 */
206
	private boolean validateValues() {
207
		// TODO Auto-generated method stub
208
		return true;
209
	}
210

  
211
	// Rellena el ChartProperties con el contenido de los 2 paneles
212
	private void getParametersToChartProperties() {
213
		this.getPreviousPanel().getChartProperties();
214
		this.getChartProperties();
215
	}
216

  
217
	private void backForm() {
218
		this.setVisible(false);
219
		this.getParentWindow().setVisible(false);
220
		
221
		this.getPreviousPanel().setVisible(true);
222
		this.getPreviousPanel().getParentWindow().setVisible(true);
223
		
224
	}
225
	
226
	public void getChartProperties(){
227
		ChartProperties chartProperties = this.getPreviousPanel().getChartProperties();
228
		for (int i = 0; i < chartProperties.getRequiredFields().size(); i++) {
229
			RequiredField f = chartProperties.getRequiredFields().get(i);
230
			JComboBox cbo = cbos.get(i);
231
			f.setValue(cbo.getSelectedItem().toString());
232
		}
233
	}
234

  
235
	public ChartUsedFieldPropertiesPanel getPreviousPanel() {
236
		return previousPanel;
237
	}
238
}
0 239

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/package.html
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title>org.gvsig.construc package documentation</title>
7
</head>
8
<body>
9

  
10
	<p>Construc library testing and demo application.</p>
11

  
12
</body>
13
</html>
0 14

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/utils/ChartCellRenderer.java
1
package org.gvsig.chart.main.utils;
2

  
3
import java.awt.Color;
4
import java.awt.Component;
5

  
6
import javax.swing.JLabel;
7
import javax.swing.JList;
8
import javax.swing.JPanel;
9
import javax.swing.JTable;
10
import javax.swing.ListCellRenderer;
11
import javax.swing.table.TableCellRenderer;
12

  
13

  
14
public class ChartCellRenderer extends JLabel implements ListCellRenderer, TableCellRenderer {
15
	  /**
16
	 * 
17
	 */
18
	private static final long serialVersionUID = 1493992436327160367L;
19
	private final Color HIGHLIGHT_COLOR = new Color(195, 212, 232);
20
	private JPanel parentPanel;
21

  
22
	  public ChartCellRenderer(JPanel parentPanel) {
23
	    setOpaque(true);
24
	    setIconTextGap(12);
25
	    this.parentPanel = parentPanel;
26
	  } 
27
	  		  
28
	  public Component getListCellRendererComponent(JList list, Object value,
29
	      int index, boolean isSelected, boolean cellHasFocus) {
30
	    ChartEntry entry = (ChartEntry) value;
31
	    setText(entry.getTitle());
32
	    setIcon(entry.getIcon());
33
	    if (isSelected) {
34
	      setBackground(HIGHLIGHT_COLOR);
35
	      setForeground(Color.black);
36
	    } else {
37
	      setBackground(Color.white);
38
	      setForeground(Color.black);
39
	    }
40
	    return this;
41
	  }
42

  
43
	public JPanel getParentPanel() {
44
		return parentPanel;
45
	}
46

  
47
	public Component getTableCellRendererComponent(JTable table, Object value,
48
			boolean isSelected, boolean arg3, int arg4, int arg5) {
49
		if(value==null)
50
			return null;
51
		ChartEntry entry = (ChartEntry) value;
52
		    setText(entry.getTitle());
53
		    setIcon(entry.getIcon());
54
		    if (isSelected) {
55
		      setBackground(HIGHLIGHT_COLOR);
56
		      setForeground(Color.black);
57
		    } else {
58
		      setBackground(Color.white);
59
		      setForeground(Color.black);
60
		    }
61
		    return this;
62
	}
63
}
0 64

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/utils/ChartJDialog.java
1
package org.gvsig.chart.main.utils;
2

  
3
import java.awt.event.ComponentEvent;
4
import java.awt.event.ComponentListener;
5

  
6
import javax.swing.JDialog;
7
import javax.swing.JPanel;
8

  
9
public class ChartJDialog extends JDialog implements ComponentListener{
10

  
11
	/**
12
	 * 
13
	 */
14
	private static final long serialVersionUID = -1850855026936065122L;
15

  
16
	private ChartJPanel panel;
17
	
18
	public ChartJDialog(ChartJPanel panel){
19
		this.panel = panel;
20
		this.panel.setParentWindow(this);
21
		panel.addComponentListener(this);
22
		getContentPane().add(panel);
23
		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
24
		setModal(true);
25
		
26
		pack();
27
		setVisible(true);
28
	}
29
	
30
	public void componentHidden(ComponentEvent e) {
31
		this.dispose();
32
	}
33

  
34
	public void componentMoved(ComponentEvent e) {
35
		// TODO Auto-generated method stub
36
		
37
	}
38

  
39
	public void componentResized(ComponentEvent e) {
40
		// TODO Auto-generated method stub
41
		
42
	}
43

  
44
	public void componentShown(ComponentEvent e) {
45
		// TODO Auto-generated method stub
46
		
47
	}
48

  
49
	public JPanel getContentPanel() {
50
		return panel;
51
	}
52

  
53
}
0 54

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/utils/ChartJPanel.java
1
package org.gvsig.chart.main.utils;
2

  
3
import javax.swing.JPanel;
4

  
5
public class ChartJPanel extends JPanel{
6

  
7
	/**
8
	 * 
9
	 */
10
	private static final long serialVersionUID = 1L;
11
	private ChartJDialog chartParentWindow;
12

  
13
	public void setParentWindow(ChartJDialog jDialog){
14
		this.chartParentWindow = jDialog;
15
	}
16
	
17
	public ChartJDialog getParentWindow(){
18
		return chartParentWindow;
19
	}
20
}
0 21

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/utils/CheckBoxRenderer.java
1
package org.gvsig.chart.main.utils;
2

  
3
import java.awt.Component;
4

  
5
import javax.swing.JCheckBox;
6
import javax.swing.JLabel;
7
import javax.swing.JTable;
8
import javax.swing.table.TableCellRenderer;
9

  
10
public class CheckBoxRenderer extends JCheckBox implements TableCellRenderer {
11

  
12
    /**
13
	 * 
14
	 */
15
	private static final long serialVersionUID = 3586418802127664068L;
16

  
17
	public CheckBoxRenderer() {
18
      setHorizontalAlignment(JLabel.CENTER);
19
    }
20

  
21
    public Component getTableCellRendererComponent(JTable table, Object value,
22
        boolean isSelected, boolean hasFocus, int row, int column) {
23
      if (isSelected) {
24
        setForeground(table.getSelectionForeground());
25
        //super.setBackground(table.getSelectionBackground());
26
        setBackground(table.getSelectionBackground());
27
      } else {
28
        setForeground(table.getForeground());
29
        setBackground(table.getBackground());
30
      }
31
      setSelected((value != null && ((Boolean) value).booleanValue()));
32
      return this;
33
    }
34
}
35

  
0 36

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/utils/ChartEntry.java
1
package org.gvsig.chart.main.utils;
2

  
3
import javax.swing.ImageIcon;
4

  
5
import org.gvsig.andami.PluginServices;
6
import org.gvsig.chart.swing.ChartSwingLocator;
7
import org.gvsig.chart.swing.spi.panels.ChartServiceTypePanel;
8
import org.gvsig.fmap.IconThemeHelper;
9

  
10
/**
11
 * Clase que define una entrada de la lista de Charts registrados.
12
 * Contiene el identificador, el nombre, icono y la preview.
13
 */
14
public class ChartEntry {
15
	  private final String id;
16
	  private final String title;
17
	  private ImageIcon icon;
18
	  private ImageIcon image;
19

  
20
	  public ChartEntry(String id, String title) {
21
	    this.id = id;
22
		this.title = title;
23
	  }
24

  
25
	  public String getChartType() {
26
	    return id;
27
	  }
28
	  
29
	  public String getChartPanelType() {
30
	    return id + "Panel";
31
	  }
32
	  
33
	  public String getTitle() {
34
		    return title;
35
	  }
36

  
37
	  public ImageIcon getIcon() {
38
	    if (icon == null) {
39
	    	ChartServiceTypePanel panel = ChartSwingLocator.getSwingManager().getSwingServices().get(this.getChartPanelType());
40
	    	if(panel!=null)
41
	    		icon = panel.getChartIcon();
42
	    }
43
	    if (icon==null)
44
	    	icon = IconThemeHelper.getImageIcon("no-chart-icon");
45
	    return icon;
46
	  }
47
	  
48

  
49
	public String toString() {
50
		    return title;
51
		  }
52
	  
53
	  public ImageIcon getExampleImage() {
54
		    if (image == null) {
55
		    	ChartServiceTypePanel panel = ChartSwingLocator.getSwingManager().getSwingServices().get(this.getChartPanelType());
56
		    	if(panel!=null)
57
		    		image = panel.getChartExample();
58
		    }
59
		    if (image==null)
60
		    	image = IconThemeHelper.getImageIcon("no-chart-example");
61
		    return image;
62
	  }
63
}
0 64

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/panels/ChartUsedFieldPropertiesPanel.java
1
package org.gvsig.chart.main.panels;
2

  
3
import java.awt.Color;
4
import java.awt.Dimension;
5
import java.awt.GridBagConstraints;
6
import java.awt.GridBagLayout;
7
import java.awt.Insets;
8
import java.awt.event.ActionEvent;
9
import java.awt.event.ActionListener;
10
import java.util.HashMap;
11
import java.util.List;
12
import java.util.Map;
13

  
14
import javax.swing.DefaultListModel;
15
import javax.swing.JButton;
16
import javax.swing.JLabel;
17
import javax.swing.JList;
18
import javax.swing.JPanel;
19
import javax.swing.JTextField;
20
import javax.swing.JTextPane;
21
import javax.swing.ListSelectionModel;
22
import javax.swing.event.ListSelectionEvent;
23
import javax.swing.event.ListSelectionListener;
24

  
25
import org.gvsig.andami.PluginServices;
26
import org.gvsig.andami.ui.mdiManager.IWindow;
27
import org.gvsig.andami.ui.mdiManager.WindowInfo;
28
import org.gvsig.chart.ChartLocator;
29
import org.gvsig.chart.ChartProperties;
30
import org.gvsig.chart.ChartService;
31
import org.gvsig.chart.lib.spi.ChartServiceManager;
32
import org.gvsig.chart.main.DefaultDataPropertiesPanel;
33
import org.gvsig.chart.main.MainContext;
34
import org.gvsig.chart.main.utils.ChartCellRenderer;
35
import org.gvsig.chart.main.utils.ChartEntry;
36
import org.gvsig.chart.main.utils.ChartJDialog;
37
import org.gvsig.chart.main.utils.ChartJPanel;
38
import org.gvsig.chart.swing.ChartSwingLocator;
39
import org.gvsig.chart.swing.spi.ChartPanel;
40
import org.gvsig.chart.swing.spi.ChartSwingServiceManager;
41
import org.gvsig.tools.service.ServiceException;
42

  
43
public class ChartUsedFieldPropertiesPanel extends ChartJPanel implements IWindow, ActionListener, ListSelectionListener{
44

  
45
	/**
46
	 * 
47
	 */
48
	private static final long serialVersionUID = -301224990996378683L;
49

  
50
	private static final int SUBPANEL_WIDTH = 400;
51
	private static final int SUBPANEL_HEIGHT = 210;
52
	
53
    private JButton accept;
54
	private JButton cancel;
55
    
56
	private String selectedChartType = null;
57
	private ChartPanel currentSubtypePanel = null;
58

  
59
	private JPanel panel_chartType = null;
60
	private JPanel panelSubtype = null;
61
	private Map<String, JPanel> cardPanel = new HashMap<String, JPanel>();
62
	private JList list = null;
63
	private DefaultListModel listModel;
64
	private JLabel chartTypesLabel;
65
	private JLabel chartOptionsLabel;
66

  
67
	private ChartServiceManager serviceManager;
68

  
69
	private ChartSwingServiceManager swingManager;
70
	private JLabel lblName;
71
	private JTextField nameTextField;
72
	private JTextField unitsTextField;
73
	private JLabel lblUnits;
74
	private JLabel lblDescription;
75
	private JTextPane descriptionTextField;
76

  
77
	private MainContext mainContext;
78

  
79
	private ChartJDialog chartJDialog;
80
	
81
	private ChartProperties chartProperties;
82
	private ChartProperties previousChartProperties;
83
	
84
	/**
85
	 * @wbp.parser.constructor
86
	 */
87
	public ChartUsedFieldPropertiesPanel(MainContext mainContext) {
88
		serviceManager = ChartLocator.getServiceManager();
89
		swingManager = ChartSwingLocator.getSwingManager();
90
		
91
		this.mainContext = mainContext;
92
//		this.usedField = usedField;
93
//		this.chartUsedFieldPanel = chartUsedFieldPanel;
94
		
95
		createMainPanel();
96
		createButtonPanelEvents();
97
	}
98
	
99
	public ChartUsedFieldPropertiesPanel(MainContext mainContext, ChartProperties props) {
100
		this(mainContext);
101
		chartProperties = props;
102
		previousChartProperties = props;
103
		this.completeForm();
104
	}
105
	
106
	public void completeForm(){
107
		
108
		// Rellenamos todos los campos
109
		nameTextField.setText(chartProperties.getChartName());
110
		
111
		// Seleccionamos el tipo de gr?fica
112
		for(int i=0;i<listModel.getSize();i++){
113
			ChartEntry entry = (ChartEntry) listModel.get(i);
114
			if(entry.getChartType()==chartProperties.getChartType()){
115
				list.setSelectedIndex(i);
116
			}
117
		}
118
		
119
		// Rellenamos el panel caracter?stico de cada tipo de gr?fica
120
		ChartPanel panel = (ChartPanel) cardPanel.get((String)chartProperties.getChartType());
121
		panel.setChartProperties(chartProperties);
122
		
123
		// TODO ??Refrescar el panel??
124
	}
125
	
126
	public ChartProperties getPreviousChartProperties(){
127
		return previousChartProperties;
128
	}
129
	
130
	private void createMainPanel(){
131
		GridBagLayout gridBagLayout = new GridBagLayout();
132
		gridBagLayout.columnWidths = new int[]{303, 0, 0, 88, 0};
133

  
134
		setLayout(gridBagLayout);
135
		
136
		GridBagConstraints gbc_panel_chartType = new GridBagConstraints();
137
		gbc_panel_chartType.gridheight = 2;
138
		gbc_panel_chartType.insets = new Insets(0, 0, 5, 0);
139
		gbc_panel_chartType.gridy = 0;
140
		gbc_panel_chartType.gridwidth = 5;
141
		gbc_panel_chartType.gridx = 0;
142
		add(getTypePanel(), gbc_panel_chartType);
143
		
144
		accept = new JButton("Next  >");
145
		GridBagConstraints gbc_accept = new GridBagConstraints();
146
		gbc_accept.insets = new Insets(0, 0, 0, 5);
147
		gbc_accept.gridx = 3;
148
		gbc_accept.gridy = 2;
149
		add(accept, gbc_accept);
150
		
151
		cancel = new JButton("Cancel");
152
		GridBagConstraints gbc_cancel = new GridBagConstraints();
153
		gbc_cancel.gridx = 4;
154
		gbc_cancel.gridy = 2;
155
		add(cancel, gbc_cancel);
156
		
157
	}
158
	
159
	private JPanel getTypePanel(){
160
		if (panel_chartType==null){
161
		panel_chartType = new JPanel();
162
		
163
		GridBagLayout gbl_panel_chartType = new GridBagLayout();
164
		gbl_panel_chartType.columnWidths = new int[]{150, 0, 210, 0, 0, 203, 0};
165
		gbl_panel_chartType.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 208, 0, 0};
166
		gbl_panel_chartType.columnWeights = new double[]{1.0, 0.0, 1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
167
		gbl_panel_chartType.rowWeights = new double[]{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE};
168
		panel_chartType.setLayout(gbl_panel_chartType);
169
		
170
		lblName = new JLabel("Name");
171
		GridBagConstraints gbc_lblName = new GridBagConstraints();
172
		gbc_lblName.anchor = GridBagConstraints.WEST;
173
		gbc_lblName.insets = new Insets(0, 0, 5, 5);
174
		gbc_lblName.gridx = 0;
175
		gbc_lblName.gridy = 0;
176
		panel_chartType.add(lblName, gbc_lblName);
177
		
178
		nameTextField = new JTextField();
179
		GridBagConstraints gbc_nameTextField = new GridBagConstraints();
180
		gbc_nameTextField.gridwidth = 4;
181
		gbc_nameTextField.insets = new Insets(0, 0, 5, 0);
182
		gbc_nameTextField.fill = GridBagConstraints.HORIZONTAL;
183
		gbc_nameTextField.gridx = 2;
184
		gbc_nameTextField.gridy = 0;
185
		panel_chartType.add(nameTextField, gbc_nameTextField);
186
		nameTextField.setColumns(10);
187
		
188
		lblUnits = new JLabel("Units");
189
		GridBagConstraints gbc_lblUnits = new GridBagConstraints();
190
		gbc_lblUnits.anchor = GridBagConstraints.WEST;
191
		gbc_lblUnits.insets = new Insets(0, 0, 5, 5);
192
		gbc_lblUnits.gridx = 0;
193
		gbc_lblUnits.gridy = 1;
194
		panel_chartType.add(lblUnits, gbc_lblUnits);
195
		
196
		unitsTextField = new JTextField();
197
		GridBagConstraints gbc_unitsTextField = new GridBagConstraints();
198
		gbc_unitsTextField.gridwidth = 4;
199
		gbc_unitsTextField.insets = new Insets(0, 0, 5, 0);
200
		gbc_unitsTextField.fill = GridBagConstraints.HORIZONTAL;
201
		gbc_unitsTextField.gridx = 2;
202
		gbc_unitsTextField.gridy = 1;
203
		panel_chartType.add(unitsTextField, gbc_unitsTextField);
204
		unitsTextField.setColumns(10);
205
		
206
		lblDescription = new JLabel("Description");
207
		GridBagConstraints gbc_lblDescription = new GridBagConstraints();
208
		gbc_lblDescription.anchor = GridBagConstraints.WEST;
209
		gbc_lblDescription.insets = new Insets(0, 0, 5, 5);
210
		gbc_lblDescription.gridx = 0;
211
		gbc_lblDescription.gridy = 2;
212
		panel_chartType.add(lblDescription, gbc_lblDescription);
213
		
214
		descriptionTextField = new JTextPane();
215
		GridBagConstraints gbc_descriptionTextField = new GridBagConstraints();
216
		gbc_descriptionTextField.gridheight = 3;
217
		gbc_descriptionTextField.gridwidth = 4;
218
		gbc_descriptionTextField.insets = new Insets(0, 0, 5, 0);
219
		gbc_descriptionTextField.fill = GridBagConstraints.BOTH;
220
		gbc_descriptionTextField.gridx = 2;
221
		gbc_descriptionTextField.gridy = 2;
222
		panel_chartType.add(descriptionTextField, gbc_descriptionTextField);
223
		
224
		chartTypesLabel = new JLabel("Chart renderer types");
225
		GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
226
		gbc_lblNewLabel_2.anchor = GridBagConstraints.WEST;
227
		gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5);
228
		gbc_lblNewLabel_2.gridx = 0;
229
		gbc_lblNewLabel_2.gridy = 5;
230
		panel_chartType.add(chartTypesLabel, gbc_lblNewLabel_2);
231
		
232
		chartOptionsLabel= new JLabel("Drawing options");
233
		GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints();
234
		gbc_lblNewLabel_3.anchor = GridBagConstraints.WEST;
235
		gbc_lblNewLabel_3.gridwidth = 4;
236
		gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 0);
237
		gbc_lblNewLabel_3.gridx = 2;
238
		gbc_lblNewLabel_3.gridy = 5;
239
		panel_chartType.add(chartOptionsLabel, gbc_lblNewLabel_3);
240
		
241
		list = new JList();
242
		GridBagConstraints gbc_list = new GridBagConstraints();
243
		gbc_list.insets = new Insets(0, 0, 5, 5);
244
		gbc_list.fill = GridBagConstraints.BOTH;
245
		gbc_list.gridx = 0;
246
		gbc_list.gridy = 6;
247
		panel_chartType.add(list, gbc_list);
248
		
249
		panelSubtype = new JPanel(); 
250
		GridBagConstraints gbc_panelSubtype = new GridBagConstraints();
251
		gbc_panelSubtype.insets = new Insets(0, 0, 5, 0);
252
		gbc_panelSubtype.gridwidth = 4;
253
		gbc_panelSubtype.fill = GridBagConstraints.BOTH;
254
		gbc_panelSubtype.gridx = 2;
255
		gbc_panelSubtype.gridy = 6;
256
		panelSubtype.setAutoscrolls(true);
257
		Dimension dimension = new Dimension(SUBPANEL_WIDTH, SUBPANEL_HEIGHT);
258
		panelSubtype.setMaximumSize(dimension);
259
		panelSubtype.setMinimumSize(dimension);
260
		panel_chartType.add(panelSubtype, gbc_panelSubtype);
261
		}
262
		return panel_chartType;
263
		
264
	}
265
	
266
	public WindowInfo getWindowInfo() {
267
		WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
268
   		m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_variable"));
269
		m_viewinfo.setWidth(575);
270
		m_viewinfo.setHeight(500);
271
		return m_viewinfo;
272
	}
273

  
274
	public Object getWindowProfile() {
275
		return WindowInfo.PROPERTIES_PROFILE;
276
	}
277

  
278
//	public Object getWindowModel() {
279
//		return chartDocument;
280
//	}
281

  
282
	public String getSelectedChartType(){
283
		return selectedChartType;
284
	}
285
		
286
	/**
287
	 * Crea el panel de la ChartPropertiesPanel usando un dise?o de Abeille
288
	 */
289
	private void createButtonPanelEvents(){
290
		cardPanel.put("empty", new JPanel());
291
		
292
		accept.addActionListener(new ActionListener() {
293
			public void actionPerformed(ActionEvent e) {
294
				acceptForm();
295
			}
296
		});
297
		cancel.addActionListener(new ActionListener() {
298
			public void actionPerformed(ActionEvent arg0) {
299
				cancelForm();
300
			}
301
		});
302
				
303
		//Inicializamos componentes
304
		initializeChartList();
305
	}
306
	
307
	private void acceptForm(){
308
			//chartProperties = serviceManager.getChartManager().createProperties(((ChartEntry)listModel.get(list.getSelectedIndex())).getChartType());
309
//		if(!(chartProperties!=null && !(chartProperties.getChartType().equals(this.currentSubtypePanel.getChartProviderClass().toString()) ))){
310
//			chartProperties = this.currentSubtypePanel.getChartProperties();
311
//		}
312
		
313
		if(this.previousChartProperties != null){
314
			if(this.chartProperties == null &&
315
					previousChartProperties.getChartType().equals(this.currentSubtypePanel.getChartProviderClass().toString())){
316
				chartProperties = previousChartProperties;
317
			}else{
318
				if(this.chartProperties != null &&
319
						!(chartProperties.getChartType().equals(this.currentSubtypePanel.getChartProviderClass().toString()))){
320
					chartProperties = this.currentSubtypePanel.getChartProperties();
321
					//TODO autorrellenar campos en com?n
322
					// this.copyChartProperties();
323
				}
324
			}
325
		}else{
326
			chartProperties = this.currentSubtypePanel.getChartProperties();
327
		}
328
		this.setVisible(false);
329
		this.getParentWindow().setVisible(false);
330
		DefaultDataPropertiesPanel panelProps = new DefaultDataPropertiesPanel(chartProperties, this);
331
		
332
		ChartJDialog dlg = new ChartJDialog(panelProps);
333
		dlg.getContentPane().setPreferredSize(new Dimension(800, 400));
334
		dlg.setSize(new Dimension(350, 75 + (30 * chartProperties.getRequiredFields().size())));
335
		dlg.setVisible(true);
336
	}
337
	
338
	private void cancelForm(){
339
		//Close the window
340
		this.setVisible(false);
341
		this.getParentWindow().setVisible(false);
342
	}
343
		
344
	private void initializeChartList() {
345
		DefaultListModel charts = getCharts();
346
		list.setModel(charts);
347
		list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
348
		list.setCellRenderer(new ChartCellRenderer(this));
349
        list.addListSelectionListener(this);
350
		if(!charts.isEmpty()){
351
			this.setSelectedRenderType();
352
		}
353

  
354
	}
355
	
356
	private void setSelectedRenderType(){
357
		list.setSelectedIndex(1);
358
//		for(int i=0; i< list.getModel().getSize(); i++){
359
//			if(((ChartEntry)list.getModel().getElementAt(i)).getChartType() == usedField.getRenderType()){
360
//				list.setSelectedIndex(i);
361
//			}
362
//		}
363
	}
364
	
365
	/**
366
	 * Manejador de eventos para que cuando se selecciona un tipo de gr?fica
367
	 * actualice la preview y cargue el panel con los subtipos correspondientes
368
	 */
369
	public void valueChanged(ListSelectionEvent evt) {
370
		this.setSelectedChartType(((ChartEntry)list.getSelectedValue()).getChartType());
371
	}
372
	
373
	public void setSelectedChartType(String type){
374
		this.selectedChartType = type;
375
		this.getSubtypePanel(type);
376
	}
377
	
378
	/**
379
	 * Obtiene los tipos de chart registrados
380
	 * @return DefaultListModel listModel
381
	 */
382
	private DefaultListModel getCharts() {
383
	    listModel = new DefaultListModel(); 
384
		List<ChartService> registeredServices = serviceManager.getChartServices();
385
	        for(int i=0; i<registeredServices.size();i++){
386
	        	String auxType = registeredServices.get(i).getChartType();
387
	        	String auxName = registeredServices.get(i).getChartName();
388
	        	
389
	        	listModel.addElement(new ChartEntry(auxType, auxName));
390
	        }  
391
				
392
		return listModel;
393
	}
394
	
395
	/**
396
	 * Panel proporcionado por el Proveedor del Chart escogido
397
	 * @param tipo de Chart
398
	 */
399
	private void getSubtypePanel(String type){
400
		if(type == null){
401
			panelSubtype.setBackground(Color.WHITE);
402
		}else{
403
			if(cardPanel.containsKey(type)){
404
				panelSubtype.removeAll();
405
//				panelSubtype.validate();
406
				this.currentSubtypePanel = (ChartPanel) cardPanel.get(type);
407
			}else{
408
				if(this.currentSubtypePanel!=null)
409
					panelSubtype.removeAll();
410
				this.currentSubtypePanel = swingManager.getSwingServices().get(type+"Panel");
411
				cardPanel.put(type, (JPanel) this.currentSubtypePanel);
412
			}
413
//			panelSubtype.revalidate();
414
//			panelSubtype.repaint();
415
//			((JPanel)this.currentSubtypePanel).setPreferredSize(new Dimension(SUBPANEL_WIDTH, SUBPANEL_HEIGHT));
416
//			((JPanel)this.currentSubtypePanel).setMinimumSize(new Dimension(SUBPANEL_WIDTH, SUBPANEL_HEIGHT));
417
//			((JPanel)this.currentSubtypePanel).setMaximumSize(new Dimension(SUBPANEL_WIDTH, SUBPANEL_HEIGHT));
418
			((JPanel)this.currentSubtypePanel).setAutoscrolls(true);
419
			
420
//			panelSubtype.setPreferredSize(new Dimension(SUBPANEL_WIDTH, SUBPANEL_HEIGHT));
421
//			panelSubtype.setMinimumSize(new Dimension(SUBPANEL_WIDTH, SUBPANEL_HEIGHT));
422
//			panelSubtype.setMaximumSize(new Dimension(SUBPANEL_WIDTH, SUBPANEL_HEIGHT));
423
			panelSubtype.setAutoscrolls(true);
424
			panelSubtype.add((JPanel) this.currentSubtypePanel);
425
			repaintPanel();
426
			
427
		}
428

  
429
	}
430
	
431
	public void repaintPanel(){
432
		((JPanel) this.currentSubtypePanel).revalidate();
433
		((JPanel) this.currentSubtypePanel).repaint();
434
		panelSubtype.revalidate();
435
		panelSubtype.repaint();
436
		list.revalidate();
437
		list.repaint();
438
		chartTypesLabel.revalidate();
439
		chartTypesLabel.repaint();
440
		chartOptionsLabel.revalidate();
441
		chartOptionsLabel.repaint();
442
	}
443
	
444

  
445
	public void actionPerformed(ActionEvent e) {
446
		
447
		if (e.getActionCommand().equalsIgnoreCase("OK")) {
448
//			chartDocument.setModified(true);
449
//			TableDocument selDoc = (TableDocument) cboTables.getSelectedItem();
450
//			if (selDoc != null)
451
//				chartDocument.setTableDocument(selDoc);
452
		}
453
		if (e.getActionCommand().equalsIgnoreCase("CANCEL")) {
454
			
455
		}
456
		
457
	}
458
//	
459
//	public ChartDocument getDocument(){
460
//		return this.chartDocument;
461
//	}
462

  
463
	public void setChartWindow(ChartJDialog chartJDialog) {
464
		this.chartJDialog = chartJDialog;
465
	}
466

  
467
	public ChartJDialog getChartJDialog() {
468
		return chartJDialog;
469
	}
470

  
471
	public ChartProperties getChartProperties() {
472
		if(chartProperties==null){
473
			chartProperties = this.currentSubtypePanel.getChartProperties();
474
		}
475
		
476
		chartProperties.setChartDynValue("title", nameTextField.getText());
477
		chartProperties.setChartDynValue("name", nameTextField.getText());
478
		chartProperties.setChartDynValue("description", descriptionTextField.getText());
479
		
480
		chartProperties.setChartDynValue("type", ((ChartEntry)listModel.get(list.getSelectedIndex())).getChartType());
481
		//chartProperties.setChartDynValue("renderer", descriptionTextField.getText());
482

  
483
		return chartProperties;
484
	}
485
	
486
	public MainContext getMainContext() {
487
		return mainContext;
488
	}
489
}
490

  
0 491

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/panels/ChartPropertiesPanelObserver.java
1
package org.gvsig.chart.main.panels;
2

  
3
import org.gvsig.chart.ChartProperties;
4
import org.gvsig.chart.model.variables.AbstractUsedFieldsObserver;
5
import org.gvsig.chart.swing.base.overlay.OverlayChartPanel;
6

  
7
public class ChartPropertiesPanelObserver<ChartProperties> extends AbstractUsedFieldsObserver<ChartProperties> {
8

  
9
	private ChartPropertiesPanel chartPropertiesPanel;
10
	
11
	public ChartPropertiesPanelObserver(ChartPropertiesPanel chartPropertiesPanel) {
12
		super();
13
		this.chartPropertiesPanel = chartPropertiesPanel;
14
	}
15

  
16
	public ChartPropertiesPanel getChartPropertiesPanel() {
17
		return chartPropertiesPanel;
18
	}
19

  
20
    @Override
21
    public void onAdd( ChartProperties element ) {
22
 
23
        System.out.println( "Added element: " + element.toString() );
24
        chartPropertiesPanel.refreshTableData();
25
 
26
    }
27
    
28
    @Override
29
    public void onSet( int index, ChartProperties element ) {
30
 
31
        System.out.println( "Edited element: " + element.toString() );
32
        chartPropertiesPanel.refreshTableData();
33
 
34
    }
35
 
36
    @Override
37
    public void onClear() {
38
 
39
        System.out.println( "Cleared list!" );
40
        chartPropertiesPanel.refreshTableData();
41
 
42
    }
43
 
44
    @Override
45
    public void onRemove( Object obj ) {
46
 
47
        System.out.println( "Removed object: " + obj.toString() );
48
        chartPropertiesPanel.refreshTableData();
49
 
50
    }
51

  
52
}
0 53

  
org.gvsig.chart/tags/org.gvsig.chart-1.0.97/org.gvsig.chart.main/src/main/java/org/gvsig/chart/main/panels/ChartUsedFieldPanel.java
1
//package org.gvsig.chart.main.panels;
2
//
3
//import java.awt.Component;
4
//import java.awt.GridBagConstraints;
5
//import java.awt.GridBagLayout;
6
//import java.awt.Insets;
7
//import java.awt.event.ActionEvent;
8
//import java.awt.event.ActionListener;
9
//import java.util.Iterator;
10
//import java.util.List;
11
//import java.util.Map;
12
//
13
//import javax.swing.JButton;
14
//import javax.swing.JCheckBox;
15
//import javax.swing.JComboBox;
16
//import javax.swing.JLabel;
17
//import javax.swing.JPanel;
18
//import javax.swing.JTextArea;
19
//import javax.swing.JTextField;
20
//
21
//import org.gvsig.chart.main.MainContext;
22
//import org.gvsig.chart.main.utils.ChartJDialog;
23
//import org.gvsig.chart.model.variables.ObservableUsedFields;
24
//import org.gvsig.chart.model.variables.UsedField;
25
//import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
26
//
27
//public class ChartUsedFieldPanel extends JPanel{
28
//	
29
//	/**
30
//	 * 
31
//	 */
32
//	private static final long serialVersionUID = 5486488191957354490L;
33
//
34
//
35
//	private Map<String,FeatureAttributeDescriptor> tableAttributes;
36
//	private JComboBox cboKey;
37
//	private JComboBox cboTable;
38
//	private JComboBox cboTableFields;
39
//	
40
//	private JButton acceptButton;
41
//	private JButton cancelButton;
42
//	private JButton chooseButton;
43
//	
44
//	private JCheckBox chckbxUseSelectedRows;
45
//	
46
//	private JTextField nameTextField;
47
//	private JTextArea descriptionField;
48
//	private JTextField unitsTextField;
49
//
50
//	private UsedField usedField;
51
//	private boolean isNewUsedField = true;
52
//	private JLabel lblUnits_1;
53
//	private JComboBox typeComboBox;
54
//	private JLabel lblDrawOptions;
55
//	private JTextField RenderTypeTextField;
56
//
57
//	private MainContext document;
58
//	private JLabel lblKey;
59
//
60
//
61
//	private List<String> fields;
62
//
63
//	/**
64
//	 * @wbp.parser.constructor
65
//	 */
66
//	public ChartUsedFieldPanel(MainContext document, UsedField usedField) {
67
//		this(document);
68
//		this.usedField = usedField;
69
//		fillUsedFieldData();
70
//		this.isNewUsedField = false;
71
//		
72
//	}
73
//	
74
//
75
//	public ChartUsedFieldPanel(MainContext document) {
76
//		this.setDocument(document);
77
//		fields = document.getDataset().getAttributeNames();
78
//		this.usedField = new UsedField();
79
//		initialize();
80
//		setPanelButtonEvents();
81
//		fillTablesComboBox();
82
//	}
83
//	
84
//	private void fillTablesComboBox(){
85
//		Iterator it = fields.iterator();
86
//		while(it.hasNext()){
87
//			String next = (String)it.next();
88
//			cboKey.addItem(next);
89
//			cboTable.addItem(next);
90
//			cboTableFields.addItem(next);
91
//		}
92
//		
93
////		ApplicationManager appManager = ApplicationLocator.getManager();
94
////		Project project = appManager.getCurrentProject();
95
////
96
////        List<Document> tableDocuments = project.getDocuments(TableManager.TYPENAME);
97
////        TableDocument[] pts = tableDocuments.toArray(new TableDocument[tableDocuments.size()]);
98
////        
99
////        for (TableDocument t : pts) {
100
////        	cboTable.addItem(t);
101
////        }
102
////        if (pts.length>0){
103
////        	cboTable.setSelectedIndex(0);
104
////        	setFieldsForTable();
105
////        }
106
////        
107
////		cboTable.addActionListener(new ActionListener() {
108
////			public void actionPerformed(ActionEvent e) {
109
////				System.out.println("Seleccionado " + e.getActionCommand());	
110
////				setFieldsForTable();
111
////			}
112
////		});
113
//	}
114
//	
115
//	public void initialize(){
116
//		GridBagLayout gridBagLayout = new GridBagLayout();
117
//		gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 27, 0, 0};
118
//		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
119
//		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0};
120
//		setLayout(gridBagLayout);
121
//		
122
//		JLabel lblName = new JLabel("Name");
123
//		GridBagConstraints gbc_lblName = new GridBagConstraints();
124
//		gbc_lblName.anchor = GridBagConstraints.WEST;
125
//		gbc_lblName.insets = new Insets(0, 0, 5, 5);
126
//		gbc_lblName.gridx = 1;
127
//		gbc_lblName.gridy = 0;
128
//		add(lblName, gbc_lblName);
129
//		
130
//		nameTextField = new JTextField();
131
//		GridBagConstraints gbc_NameTextField = new GridBagConstraints();
132
//		gbc_NameTextField.gridwidth = 3;
133
//		gbc_NameTextField.insets = new Insets(0, 0, 5, 5);
134
//		gbc_NameTextField.fill = GridBagConstraints.HORIZONTAL;
135
//		gbc_NameTextField.gridx = 3;
136
//		gbc_NameTextField.gridy = 0;
137
//		add(nameTextField, gbc_NameTextField);
138
//		nameTextField.setColumns(10);
139
//		
140
//		JLabel lblDescription = new JLabel("Description");
141
//		GridBagConstraints gbc_lblDescription = new GridBagConstraints();
142
//		gbc_lblDescription.anchor = GridBagConstraints.WEST;
143
//		gbc_lblDescription.insets = new Insets(0, 0, 5, 5);
144
//		gbc_lblDescription.gridx = 1;
145
//		gbc_lblDescription.gridy = 1;
146
//		add(lblDescription, gbc_lblDescription);
147
//		
148
//		descriptionField = new JTextArea();
149
//		GridBagConstraints gbc_textArea = new GridBagConstraints();
150
//		gbc_textArea.gridheight = 2;
151
//		gbc_textArea.gridwidth = 3;
152
//		gbc_textArea.insets = new Insets(0, 0, 5, 5);
153
//		gbc_textArea.fill = GridBagConstraints.BOTH;
154
//		gbc_textArea.gridx = 3;
155
//		gbc_textArea.gridy = 1;
156
//		add(descriptionField, gbc_textArea);
157
//		
158
//		JLabel lblUnits = new JLabel("Type");
159
//		GridBagConstraints gbc_lblUnits = new GridBagConstraints();
160
//		gbc_lblUnits.anchor = GridBagConstraints.WEST;
161
//		gbc_lblUnits.insets = new Insets(0, 0, 5, 5);
162
//		gbc_lblUnits.gridx = 1;
163
//		gbc_lblUnits.gridy = 3;
164
//		add(lblUnits, gbc_lblUnits);
165
//		
166
//		typeComboBox = new JComboBox(UsedField.typeStrings);
167
//		GridBagConstraints gbc_typeComboBox = new GridBagConstraints();
168
//		gbc_typeComboBox.gridwidth = 3;
169
//		gbc_typeComboBox.insets = new Insets(0, 0, 5, 5);
170
//		gbc_typeComboBox.fill = GridBagConstraints.HORIZONTAL;
171
//		gbc_typeComboBox.gridx = 3;
172
//		gbc_typeComboBox.gridy = 3;
173
//		add(typeComboBox, gbc_typeComboBox);
174
//		
175
//		lblUnits_1 = new JLabel("Units");
176
//		GridBagConstraints gbc_lblUnits_1 = new GridBagConstraints();
177
//		gbc_lblUnits_1.anchor = GridBagConstraints.WEST;
178
//		gbc_lblUnits_1.insets = new Insets(0, 0, 5, 5);
179
//		gbc_lblUnits_1.gridx = 1;
180
//		gbc_lblUnits_1.gridy = 4;
181
//		add(lblUnits_1, gbc_lblUnits_1);
182
//		
183
//		unitsTextField = new JTextField();
184
//		GridBagConstraints gbc_textField_1 = new GridBagConstraints();
185
//		gbc_textField_1.gridwidth = 3;
186
//		gbc_textField_1.insets = new Insets(0, 0, 5, 5);
187
//		gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
188
//		gbc_textField_1.gridx = 3;
189
//		gbc_textField_1.gridy = 4;
190
//		add(unitsTextField, gbc_textField_1);
191
//		unitsTextField.setColumns(10);
192
//		
193
//		lblDrawOptions = new JLabel("Drawing options");
194
//		GridBagConstraints gbc_lblDrawOptions = new GridBagConstraints();
195
//		gbc_lblDrawOptions.gridwidth = 2;
196
//		gbc_lblDrawOptions.insets = new Insets(0, 0, 5, 5);
197
//		gbc_lblDrawOptions.gridx = 1;
198
//		gbc_lblDrawOptions.gridy = 6;
199
//		add(lblDrawOptions, gbc_lblDrawOptions);
200
//		
201
//		chooseButton = new JButton("Elegir...");
202
//		GridBagConstraints gbc_ChooseButton;
203
//		gbc_ChooseButton = new GridBagConstraints();
204
//		gbc_ChooseButton.insets = new Insets(0, 0, 5, 5);
205
//		gbc_ChooseButton.gridx = 5;
206
//		gbc_ChooseButton.gridy = 6;
207
//		add(chooseButton, gbc_ChooseButton);
208
//		
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff