Revision 40354

View differences:

branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/DataTransformSelectionAction.java
27 27
 
28 28
package org.gvsig.daltransform.swing.impl;
29 29

  
30
import javax.swing.JOptionPane;
31

  
30 32
import jwizardcomponent.FinishAction;
31 33

  
32 34
import org.slf4j.Logger;
33 35
import org.slf4j.LoggerFactory;
34 36

  
35 37
import org.gvsig.andami.PluginServices;
38
import org.gvsig.app.ApplicationLocator;
36 39
import org.gvsig.daltransform.swing.DataTransformGui;
37 40
import org.gvsig.fmap.dal.exception.DataException;
38 41
import org.gvsig.fmap.dal.feature.FeatureStore;
39 42
import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
43
import org.gvsig.fmap.mapcontext.MapContext;
40 44
import org.gvsig.fmap.mapcontext.MapContextLocator;
41 45
import org.gvsig.fmap.mapcontext.MapContextManager;
42 46
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
43 47
import org.gvsig.fmap.mapcontext.layers.FLayer;
48
import org.gvsig.i18n.Messages;
44 49

  
45 50

  
46 51
/**
......
98 103
			    FLayer layer = manager.createLayer(
99 104
			        featureTransformGui.toString(),
100 105
			        fsto);
101
				dataTransformWizard.getMapContext().getLayers().addLayer(layer);
106
			    
107
			    MapContext mco = dataTransformWizard.getMapContext();
108
			    if (mco != null) {
109
			        mco.getLayers().addLayer(layer);
110
			    } else {
111
			        ApplicationLocator.getManager().messageDialog(
112
                        Messages.getText("_Layer_was_not_added_to_any_view"),
113
                        Messages.getText("transform_apply"),
114
			            JOptionPane.ERROR_MESSAGE);
115
			    }
116
				
102 117
				layer.dispose();
103 118
			}
104 119
		} catch (DataException e) {
branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/SelectTransformWizardPanel.java
28 28
package org.gvsig.daltransform.swing.impl;
29 29

  
30 30
import java.awt.Dimension;
31
import java.awt.Font;
31 32
import java.util.List;
32 33

  
33 34
import javax.swing.DefaultListModel;
......
93 94
		descriptionText.setEditable(false);
94 95
		descriptionText.setRows(5);
95 96
		descriptionText.setLineWrap(true);
97
		descriptionText.setWrapStyleWord(true);
98
		descriptionText.setBackground(this.getBackground());
99
		
100
		
101
		Font fnt = descriptionText.getFont();
102
		fnt = fnt.deriveFont(Font.PLAIN);
103
		descriptionText.setFont(fnt);
104
		
96 105
		descriptionText.setBorder(null);
97 106
		descriptionScrollPane.setBorder(null);
98 107
		descriptionScrollPane.setViewportView(descriptionText);
branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/LoadLayerWizardPanel.java
27 27

  
28 28
package org.gvsig.daltransform.swing.impl;
29 29

  
30
import java.awt.Font;
30 31
import java.awt.event.ItemEvent;
31 32
import java.awt.event.ItemListener;
32 33
import java.util.List;
33 34

  
34
import javax.swing.DefaultListModel;
35 35
import javax.swing.JCheckBox;
36
import javax.swing.JComboBox;
36 37
import javax.swing.JLabel;
37
import javax.swing.JList;
38 38
import javax.swing.JPanel;
39 39
import javax.swing.JScrollPane;
40 40
import javax.swing.JTextArea;
41 41

  
42
import org.slf4j.Logger;
43
import org.slf4j.LoggerFactory;
44

  
42 45
import org.gvsig.andami.PluginServices;
43 46
import org.gvsig.andami.ui.mdiManager.IWindow;
44 47
import org.gvsig.app.project.ProjectManager;
......
54 57
import org.gvsig.fmap.dal.feature.FeatureStoreTransform;
55 58
import org.gvsig.fmap.dal.feature.FeatureType;
56 59
import org.gvsig.fmap.mapcontext.MapContext;
57
import org.slf4j.Logger;
58
import org.slf4j.LoggerFactory;
59 60

  
60 61

  
61 62
/**
......
73 74
	private JTextArea messageTextArea = null;
74 75
	private JPanel northPanel = null;
75 76
	private JLabel selectViewLabel;
76
	private JList selectViewList;
77
	private JScrollPane selectViewScroll;
77
	private JComboBox selectViewCombo;
78 78
    private JPanel centerPanel;
79 79
	private FeatureStoreTransform transform = null;
80
//	private boolean hasViews = false;
81 80

  
82 81
	/**
83 82
	 * @param wizardComponents
84 83
	 */
85 84
	public LoadLayerWizardPanel() {
86 85
		super();	
86

  
87 87
		initComponents();
88 88
		initLabels();	
89 89
		addViews();
90 90
		loadLayerCb.addItemListener(this);
91
		itemStateChanged(null);		
91
		itemStateChanged(null);	
92 92
	}
93 93

  
94 94
	private void initLabels(){
......
105 105
        loadLayerCb = new javax.swing.JCheckBox();
106 106
        selectViewLabel = new javax.swing.JLabel();
107 107
        centerPanel = new javax.swing.JPanel();
108
        selectViewScroll = new javax.swing.JScrollPane();
109
        selectViewList = new javax.swing.JList();
110
        selectViewList.setModel(new DefaultListModel());
108
        selectViewCombo = new JComboBox();
111 109

  
112 110
        setLayout(new java.awt.BorderLayout());
113 111

  
......
118 116
        messageTextArea.setColumns(20);
119 117
        messageTextArea.setEditable(false);
120 118
        messageTextArea.setLineWrap(true);
119

  
120
        messageTextArea.setWrapStyleWord(true);
121
        messageTextArea.setBackground(northPanel.getBackground());
122
        Font fnt = messageTextArea.getFont();
123
        fnt = fnt.deriveFont(Font.PLAIN);
124
        messageTextArea.setFont(fnt);
125

  
126
        
121 127
        messageTextArea.setRows(5);
122 128
        messageTextArea.setBorder(null);
123 129
        messageScroll.setViewportView(messageTextArea);
124 130

  
125 131
        gridBagConstraints = new java.awt.GridBagConstraints();
126 132
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
133
        gridBagConstraints.gridx = 0;
134
        gridBagConstraints.gridy = 0;
127 135
        gridBagConstraints.weightx = 1.0;
128 136
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 5, 2);
129 137
        northPanel.add(messageScroll, gridBagConstraints);
......
137 145
        gridBagConstraints.weightx = 1.0;
138 146
        gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2);
139 147
        northPanel.add(loadLayerCb, gridBagConstraints);
148
        
149
        add(northPanel, java.awt.BorderLayout.NORTH);
150
        
151
        centerPanel.setLayout(new java.awt.GridBagLayout());
140 152

  
141 153
        selectViewLabel.setText("jLabel1");
142 154
        gridBagConstraints = new java.awt.GridBagConstraints();
143 155
        gridBagConstraints.gridx = 0;
144
        gridBagConstraints.gridy = 2;
156
        gridBagConstraints.gridy = 0;
145 157
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
146 158
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
147 159
        gridBagConstraints.weightx = 1.0;
148 160
        gridBagConstraints.insets = new java.awt.Insets(5, 2, 5, 2);
149
        northPanel.add(selectViewLabel, gridBagConstraints);
161
        centerPanel.add(selectViewLabel, gridBagConstraints);
150 162

  
151
        add(northPanel, java.awt.BorderLayout.NORTH);
152

  
153
        centerPanel.setLayout(new java.awt.GridBagLayout());
154

  
155
        selectViewScroll.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
156
        selectViewScroll.setPreferredSize(null);
157

  
158
        selectViewScroll.setViewportView(selectViewList);
159

  
160 163
        gridBagConstraints = new java.awt.GridBagConstraints();
161 164
        gridBagConstraints.gridx = 0;
162
        gridBagConstraints.gridy = 0;
163
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
165
        gridBagConstraints.gridy = 1;
166
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
167
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
164 168
        gridBagConstraints.weightx = 1.0;
165 169
        gridBagConstraints.weighty = 1.0;
166 170
        gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2);
167
        centerPanel.add(selectViewScroll, gridBagConstraints);
171
        centerPanel.add(selectViewCombo, gridBagConstraints);
168 172

  
169 173
        add(centerPanel, java.awt.BorderLayout.CENTER);
170 174
	}
......
210 214
			}
211 215
		}
212 216
		if (hasGeometry){
213
			if (selectViewList.getModel().getSize() == 0){
217
			if (selectViewCombo.getItemCount() == 0){
214 218
				messageTextArea.setText(PluginServices.getText(this, "transform_layout_not_view_to_load"));
215 219
				setLoadLayerVisible(false);
216 220
			}else{
......
231 235
	private void setLoadLayerVisible(boolean isVisible){
232 236
		loadLayerCb.setVisible(isVisible);
233 237
		selectViewLabel.setVisible(isVisible);
234
		selectViewScroll.setVisible(isVisible);
235
		selectViewList.setVisible(isVisible);
238
		selectViewCombo.setVisible(isVisible);
236 239
	}
237 240

  
238 241
	/**
239 242
	 * Add the project views
240 243
	 */
241 244
	private void addViews(){
242
		selectViewList.removeAll();
245
	    selectViewCombo.removeAllItems();
243 246
		
244 247
		List<Document> views = ProjectManager.getInstance().getCurrentProject().getDocuments(ViewManager.TYPENAME);
245 248
		for (Document view : views) {
246
			((DefaultListModel)selectViewList.getModel()).addElement(view);
249
		    selectViewCombo.addItem(view);
247 250
		}
248 251
//		ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
249 252
//		ArrayList<ProjectDocument> projects = ext.getProject().getDocumentsByType(ProjectViewFactory.registerName);
......
256 259
//		}
257 260
		IWindow window = PluginServices.getMDIManager().getActiveWindow();
258 261
		if (window instanceof IView){
259
			selectViewList.setSelectedValue(window, true);
260
		}else{
261
			selectViewList.setSelectedIndex(0);
262
		    selectViewCombo.setSelectedItem(window);
262 263
		}
263 264
	}
264 265

  
266
    public boolean isNextButtonEnabled() {
267
        return true;
268
    }
269

  
270
	
265 271
	/**
266 272
	 * Update the form when the transform has been applied in
267 273
	 * to a layer
......
294 300
	 * @return The mapcontext
295 301
	 */
296 302
	public MapContext getMapContext(){
297
		Object obj = selectViewList.getSelectedValue();
303
		Object obj = selectViewCombo.getSelectedItem();
298 304
		if (obj != null){
299 305
			return ((BaseViewDocument)obj).getMapContext();
300 306
		}
......
307 313
	public void itemStateChanged(ItemEvent arg0) {
308 314
		boolean isSelected = loadLayerCb.isSelected();
309 315
		selectViewLabel.setEnabled(isSelected);
310
		selectViewList.setEnabled(isSelected);
316
		selectViewCombo.setEnabled(isSelected);
311 317
	}
312 318

  
313 319
	/* (non-Javadoc)
......
316 322
	public String getPanelTitle() {
317 323
		return PluginServices.getText(this, "transform_apply");
318 324
	}
325
	
319 326
}
320 327

  
branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin/src/main/resources/org/gvsig/daltransform/i18n/text.properties
17 17
select_transform=Selecciona una transformaci?n
18 18
select_layer=Selecciona una capa
19 19
view_transforms=Ver transformaciones
20
not_featurestore_loaded=No hay ning?n almac?n de datos vectorial cargado
20
not_featurestore_loaded=No hay ning?n almac?n de datos vectorial cargado
21
_Layer_was_not_added_to_any_view=No se a?adi? la capa a ninguna vista
branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin/src/main/resources/org/gvsig/daltransform/i18n/text_en.properties
17 17
select_transform=Select a transform
18 18
select_layer=Select a layer
19 19
view_transforms=View transforms
20
not_featurestore_loaded=There is not any feature store loaded
20
not_featurestore_loaded=There is not any feature store loaded
21
_Layer_was_not_added_to_any_view=Layer was not added to any view

Also available in: Unified diff