Revision 8352

View differences:

trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/package.html
1
este package debe de estar en appgvSIG
0 2

  
trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelector.java
44 44
package com.iver.cit.gvsig.gvsig.gui.styling;
45 45

  
46 46
import java.awt.BorderLayout;
47
import java.awt.CardLayout;
48 47
import java.awt.Color;
49 48
import java.awt.Component;
50 49
import java.awt.Dimension;
51 50
import java.awt.FlowLayout;
51
import java.awt.Font;
52 52
import java.awt.GridLayout;
53
import java.awt.LayoutManager;
53
import java.awt.event.ActionEvent;
54
import java.awt.event.ActionListener;
54 55
import java.io.File;
55 56
import java.io.FileFilter;
56 57

  
57 58
import javax.swing.BorderFactory;
58 59
import javax.swing.BoxLayout;
59
import javax.swing.JComboBox;
60 60
import javax.swing.JLabel;
61 61
import javax.swing.JList;
62 62
import javax.swing.JOptionPane;
......
65 65
import javax.swing.JSplitPane;
66 66
import javax.swing.JTree;
67 67
import javax.swing.ListCellRenderer;
68
import javax.swing.event.ListSelectionEvent;
69
import javax.swing.event.ListSelectionListener;
68 70
import javax.swing.event.TreeModelListener;
69 71
import javax.swing.tree.TreeModel;
70 72
import javax.swing.tree.TreePath;
71 73

  
72 74
import org.gvsig.gui.beans.AcceptCancelPanel;
75
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
76
import org.gvsig.gui.beans.swing.JButton;
73 77

  
74 78
import com.iver.andami.PluginServices;
75 79
import com.iver.andami.ui.mdiManager.IWindow;
76 80
import com.iver.andami.ui.mdiManager.WindowInfo;
81
import com.iver.cit.gvsig.fmap.core.FShape;
77 82
import com.iver.cit.gvsig.fmap.core.ISymbol;
78
import com.sun.java.swing.plaf.windows.WindowsInternalFrameTitlePane;
83
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
79 84

  
85
import de.ios.framework.swing.JDecimalField;
86
import de.ios.framework.swing.JNumberField;
87

  
80 88
/**
81
 * @author FJP
82
 *
83
 * TODO To change the template for this generated type comment go to
84
 * Window - Preferences - Java - Code Generation - Code and Comments
89
 * @author jaume dominguez faus - jaume.dominguez@iver.es
85 90
 */
86 91
public class SymbolSelector extends JPanel implements IWindow{
87 92

  
......
91 96
    private JScrollPane jScrollPane = null;
92 97
    private JScrollPane jScrollPane1 = null;
93 98
    private SymbolPreview jPanelPreview = null;
94
    private JPanel jPanelOptions = null;
95
	private JPanel jPanel1 = null;
96
	private JLabel jLabel = null;
97
	private JComboBox cmbFamily = null;
99
    private GridBagLayoutPanel jPanelOptions = null;
98 100
	private WindowInfo wi;
99 101
	private JSplitPane jSplitPane = null;
100 102
	private File symbolDir;
101 103
	private AcceptCancelPanel okCancelPanel;
104
	private ISymbol selectedSymbol = null;
105
	private JPanel northPanel;
106
	private ColorChooserPanel jcc;
107
	private JNumberField txtSize;
108
	private JDecimalField txtAngle;
109
	private JPanel jPanelButtons;
110
	private JButton btnProperties;
111
	private int shapeType;
102 112
    /**
103 113
     * This method initializes
104 114
     *
105 115
     */
106
    public SymbolSelector() {
116
    public SymbolSelector(int shapeType) {
107 117
    	super();
118
    	this.shapeType = shapeType;
108 119
    	symbolDir = new File(getClass().
109 120
  				getClassLoader().
110 121
  				getResource("symbols").
111 122
  				getFile());
112 123
    	initialize();
113
    	ListCellRenderer renderer = new ListCellRenderer() {
114

  
115
			public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
116
				ISymbol sym = (ISymbol) value;
117
				JPanel pnl = new JPanel();
118
				BoxLayout layout = new BoxLayout(pnl, BoxLayout.Y_AXIS);
119
				pnl.setLayout(layout);
120
				Color bgColor = getJListSymbols().getBackground();
121
				pnl.setBackground(bgColor);
122
				SymbolPreview sp = new SymbolPreview();
123
				sp.setAlignmentX(Component.CENTER_ALIGNMENT);
124
				sp.setPreferredSize(new Dimension(50, 50));
125
				sp.setSymbol(sym);
126
				pnl.add(sp);
127
				JLabel lbl = new JLabel(sym.getDescription());
128
				lbl.setBackground(bgColor);
129
				lbl.setAlignmentX(Component.CENTER_ALIGNMENT);
130
				pnl.add(lbl);
131

  
132
				return pnl;
133
			}
134

  
135
    	};
136
        getJListSymbols().setCellRenderer(renderer);
137 124
    }
138 125

  
139 126
    /**
......
141 128
     *
142 129
     */
143 130
    private void initialize() {
131

  
144 132
        this.setLayout(new BorderLayout());
145 133
        this.setSize(400, 221);
146 134

  
135
        this.add(getJNorthPanel(), BorderLayout.NORTH);
147 136
        this.add(getJSplitPane(), BorderLayout.CENTER);
148
        this.add(getJPanel(), BorderLayout.EAST);
149
        okCancelPanel = new AcceptCancelPanel();
137
        this.add(getJEastPanel(), BorderLayout.EAST);
138
        ActionListener okAction = new ActionListener() {
139
    		public void actionPerformed(ActionEvent e) {
140
    			PluginServices.getMDIManager().closeWindow(SymbolSelector.this);
141
    		}
142
    	}, cancelAction = new ActionListener() {
143
    		public void actionPerformed(ActionEvent e) {
144
    			selectedSymbol = null;
145
    			PluginServices.getMDIManager().closeWindow(SymbolSelector.this);
146
    		}
147
    	};
148

  
149
        okCancelPanel = new AcceptCancelPanel(okAction, cancelAction);
150 150
        this.add(okCancelPanel, BorderLayout.SOUTH);
151 151
    }
152 152

  
153
    /**
153
    private JPanel getJNorthPanel() throws IllegalArgumentException {
154
		if (northPanel == null) {
155
			String text = "";
156
			switch (shapeType) {
157
			case FShape.POINT:
158
				text = PluginServices.getText(this, "point_symbols");
159
				break;
160
			case FShape.LINE:
161
				text = PluginServices.getText(this, "line_symbols");
162
				break;
163
			case FShape.POLYGON:
164
				text = PluginServices.getText(this, "polygon_symbols");
165
				break;
166
			default:
167
				throw new IllegalArgumentException(PluginServices.getText(this, "shape_type_not_yet_supported"));
168
			}
169
			northPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
170
			JLabel lbl = new JLabel(text);
171
			lbl.setFont(lbl.getFont().deriveFont(Font.BOLD));
172
			northPanel.add(lbl);
173
		}
174
		return northPanel;
175
	}
176

  
177
	/**
154 178
     * This method initializes jList
155 179
     *
156 180
     * @return javax.swing.JList
......
253 277
    		jListSymbols.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
254 278
            jListSymbols.setLayoutOrientation(JList.HORIZONTAL_WRAP);
255 279
            jListSymbols.setVisibleRowCount(-1);
256

  
257
            /*jListSymbols.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
258
            	public void valueChanged(javax.swing.event.ListSelectionEvent e) {
259
            		System.out.println("valueChanged()"); // TODO Auto-generated Event stub valueChanged()
260
                    // TODO: Aqu? hay que extraer el Paint, el Stroke
261
                    // o lo que necesitemos del svg para generar nuestro propio
262
                    // s?mbolo.
280
            jListSymbols.addListSelectionListener(new ListSelectionListener() {
281
            	public void valueChanged(ListSelectionEvent e) {
282
            		selectedSymbol = (ISymbol) jListSymbols.getSelectedValue();
283
            		jPanelPreview.setSymbol(selectedSymbol);
263 284
            	}
264
            });*/
285
            });
286
            ListCellRenderer renderer = new ListCellRenderer() {
287
        		private Color mySelectedBGColor = new Color(255,145,100,255);
288
    			public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
289
    				ISymbol sym = (ISymbol) value;
290
    				JPanel pnl = new JPanel();
291
    				BoxLayout layout = new BoxLayout(pnl, BoxLayout.Y_AXIS);
292
    				pnl.setLayout(layout);
293
    				Color bgColor = (isSelected) ? mySelectedBGColor
294
    							 : getJListSymbols().getBackground();
265 295

  
296
    				pnl.setBackground(bgColor);
297
    				SymbolPreview sp = new SymbolPreview();
298
    				sp.setAlignmentX(Component.CENTER_ALIGNMENT);
299
    				sp.setPreferredSize(new Dimension(50, 50));
300
    				sp.setSymbol(sym);
301
    				sp.setBackground(bgColor);
302
    				pnl.add(sp);
303
    				JLabel lbl = new JLabel(sym.getDescription());
304
    				lbl.setBackground(bgColor);
305
    				lbl.setAlignmentX(Component.CENTER_ALIGNMENT);
306
    				pnl.add(lbl);
307

  
308
    				return pnl;
309
    			}
310

  
311
        	};
312
        	jListSymbols.setCellRenderer(renderer);
266 313
    	}
267 314
    	return jListSymbols;
268 315
    }
......
272 319
     *
273 320
     * @return javax.swing.JPanel
274 321
     */
275
    private JPanel getJPanel() {
322
    private JPanel getJEastPanel() {
276 323
    	if (jPanel == null) {
277 324
    		jPanel = new JPanel();
278 325
    		jPanel.setLayout(new BorderLayout());
279
    		jPanel.setPreferredSize(new java.awt.Dimension(100,10));
280
    		jPanel.add(getJPanelOptions(), java.awt.BorderLayout.CENTER);
281
    		jPanel.add(getJPanelPreview(), java.awt.BorderLayout.NORTH);
326
    		jPanel.add(getJPanelOptions(), BorderLayout.CENTER);
327
    		JPanel aux = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
328
    		aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "preview")));
329
    		aux.add(getJPanelPreview());
330
    		jPanel.add(aux, BorderLayout.NORTH);
331

  
332
    		aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
333
    		aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "options")));
334
    		aux.add(getJPanelOptions());
335
    		jPanel.add(aux, BorderLayout.CENTER);
336
    		aux = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
337
    		aux.add(getJPanelButtons());
338
    		jPanel.add(aux, BorderLayout.SOUTH);
282 339
    	}
283 340
    	return jPanel;
284 341
    }
285 342

  
286
    /**
343
    private JPanel getJPanelButtons() {
344
		if (jPanelButtons == null) {
345
			jPanelButtons = new JPanel();
346
			GridLayout layout = new GridLayout();
347
			layout.setColumns(1);
348

  
349
			jPanelButtons.add(getBtnProperties());
350

  
351

  
352
			// do not add components bellow this line!
353
			layout.setRows(jPanelButtons.getComponentCount());
354
			jPanelButtons.setLayout(layout);
355
		}
356
		return jPanelButtons;
357
	}
358

  
359
	private JButton getBtnProperties() {
360
		if (btnProperties == null) {
361
			btnProperties = new JButton();
362
			btnProperties.setText(PluginServices.getText(this, "properties"));
363
		}
364
		return btnProperties;
365
	}
366

  
367
	/**
287 368
     * This method initializes jScrollPane
288 369
     *
289 370
     * @return javax.swing.JScrollPane
......
332 413
     */
333 414
    private JPanel getJPanelOptions() {
334 415
    	if (jPanelOptions == null) {
335
    		jPanelOptions = new JPanel();
416
    		jPanelOptions = new GridBagLayoutPanel();
417
    		jPanelOptions.addComponent(
418
    				PluginServices.getText(this, "color")+":",
419
    				jcc = new ColorChooserPanel());
420
    		jPanelOptions.addComponent(
421
    				PluginServices.getText(this, "size")+":",
422
    				txtSize = new JNumberField());
423
    		jPanelOptions.addComponent(
424
    				PluginServices.getText(this, "angle")+":",
425
    				txtAngle = new JDecimalField());
426

  
336 427
    	}
337 428
    	return jPanelOptions;
338 429
    }
339 430

  
340
	/**
341
	 * This method initializes jPanel1
342
	 *
343
	 * @return javax.swing.JPanel
344
	 */
345
	private JPanel getJPanel1() {
346
		if (jPanel1 == null) {
347
			jLabel = new JLabel();
348
			jLabel.setText(PluginServices.getText(this, ""));
349
			jPanel1 = new JPanel();
350
//			jPanel1.add(jLabel, );
351

  
352
		}
353
		return jPanel1;
354
	}
355

  
356

  
357

  
358 431
	public WindowInfo getWindowInfo() {
359 432
		if (wi == null) {
360 433
			wi = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
......
376 449
			jSplitPane.setDividerLocation(200);
377 450
	        jSplitPane.setLeftComponent(getJScrollPane());
378 451
	        jSplitPane.setRightComponent(getJScrollPane1());
379

  
380 452
		}
381 453
		return jSplitPane;
382 454
	}
383 455

  
456
	/**
457
	 * Returns the symbol selected by the user or null if none
458
	 * @return
459
	 */
460
	public ISymbol getSymbol() {
461
		return selectedSymbol;
462
	}
463

  
384 464
}  //  @jve:decl-index=0:visual-constraint="10,10"
trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolPreview.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.1  2006-10-25 10:50:41  jaume
46
* Revision 1.2  2006-10-26 07:46:58  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.1  2006/10/25 10:50:41  jaume
47 50
* movement of classes and gui stuff
48 51
*
49 52
* Revision 1.2  2006/10/24 19:54:55  jaume
......
83 86

  
84 87
	public void setSymbol(ISymbol symbol) {
85 88
		this.symbol = symbol;
89
		repaint();
86 90
	}
87 91

  
88 92
	public void paint(Graphics g) {
......
90 94
		Graphics2D g2 = (Graphics2D) g;
91 95
		Rectangle r = getBounds();
92 96

  
93
		r.setBounds(hGap, (int) r.getHeight()+(vGap), (int) (r.getWidth()-(hGap*2)), (int) (r.getHeight()-(vGap*2)));
97
		r.setBounds(hGap, (int) r.getHeight()-(vGap), (int) (r.getWidth()-(hGap*2)), (int) (r.getHeight()-(vGap*2)));
94 98
		if (symbol != null) {
95 99
			symbol.drawInsideRectangle(g2, new AffineTransform(), r);
96 100
		} else {
97
			// TODO: jaume. falta ajustar la cadena al centro del graphics y reescalarla segun el tama?o del mismo
98 101
			g2.drawString("["+PluginServices.getText(this, "none_selected")+"]", r.x, r.y/2+5);
99 102
		}
100 103
	}
trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/preferences/RoutePage.java
43 43
 *
44 44
 * $Id$
45 45
 * $Log$
46
 * Revision 1.4  2006-10-25 10:50:41  jaume
46
 * Revision 1.5  2006-10-26 07:46:58  jaume
47
 * *** empty log message ***
48
 *
49
 * Revision 1.4  2006/10/25 10:50:41  jaume
47 50
 * movement of classes and gui stuff
48 51
 *
49 52
 * Revision 1.3  2006/10/24 16:31:40  jaume
......
59 62
 */
60 63
package com.iver.cit.gvsig.graph.preferences;
61 64

  
62
import java.awt.Color;
63 65
import java.awt.Dimension;
64
import java.awt.Font;
65 66
import java.awt.event.ActionEvent;
66 67
import java.awt.event.ActionListener;
67 68

  
68 69
import javax.swing.BorderFactory;
69 70
import javax.swing.ImageIcon;
70
import javax.swing.JOptionPane;
71 71
import javax.swing.JPanel;
72 72

  
73 73
import org.gvsig.gui.beans.swing.JButton;
......
75 75
import com.iver.andami.PluginServices;
76 76
import com.iver.andami.preferences.AbstractPreferencePage;
77 77
import com.iver.andami.preferences.StoreException;
78
import com.iver.cit.gvsig.fmap.core.symbols.CharacterMarker;
78
import com.iver.cit.gvsig.fmap.core.FShape;
79
import com.iver.cit.gvsig.fmap.core.ISymbol;
79 80
import com.iver.cit.gvsig.gvsig.gui.styling.SymbolPreview;
80 81
import com.iver.cit.gvsig.gvsig.gui.styling.SymbolSelector;
81 82

  
......
89 90
				"images/net-analyst-icon.png"));
90 91
		symbolPreview = new SymbolPreview();
91 92
		symbolPreview.setPreferredSize(new Dimension(100, 100));
92
		symbolPreview.setSymbol(new CharacterMarker(new Font("ESRI Public1", Font.PLAIN, 0), (int) 'b', Color.BLACK));
93 93
		symbolPreview.setBorder(BorderFactory.createBevelBorder(1));
94 94

  
95 95
		JPanel aux = new JPanel();
......
99 99
		aux.add(btnChangeSymbol = new JButton(PluginServices.getText(this, "change")));
100 100
		btnChangeSymbol.addActionListener(new ActionListener() {
101 101
			public void actionPerformed(ActionEvent e) {
102
				SymbolSelector symbSelec = new SymbolSelector();
102
				SymbolSelector symbSelec = new SymbolSelector(FShape.POINT);
103 103
				PluginServices.getMDIManager().addWindow(symbSelec);
104
				ISymbol sym = symbSelec.getSymbol();
105
				if (sym!=null)
106
					symbolPreview.setSymbol(sym);
104 107
			}
105 108
		});
106 109
		addComponent("", aux);
trunk/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractMarker.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.1  2006-10-25 10:50:41  jaume
46
* Revision 1.2  2006-10-26 07:46:58  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.1  2006/10/25 10:50:41  jaume
47 50
* movement of classes and gui stuff
48 51
*
49 52
* Revision 1.1  2006/10/18 07:54:06  jaume
......
60 63
	protected boolean isShapeVisible = true;
61 64
	protected String desc;
62 65
	private double rotation;
66
	private double xOffset, yOffset;
63 67

  
64 68
	public String getDescription() {
65 69
		return desc;
......
79 83
	public void setRotation(double r) {
80 84
		this.rotation = r;
81 85
	}
86
	public double getXOffset() {
87
		return xOffset;
88
	}
89
	public void setXOffset(double offset) {
90
		xOffset = offset;
91
	}
92
	public double getYOffset() {
93
		return yOffset;
94
	}
95
	public void setYOffset(double offset) {
96
		yOffset = offset;
97
	}
82 98

  
83 99
}
trunk/extensions/extGraph_predes/build.xml
16 16
    <mkdir dir="${build}"/>
17 17
    <mkdir dir="${dist}"/>
18 18
  	<!-- Creamos un fichero con el timeStamp para que lo lea el FPanelAbout -->
19
  	<buildnumber/> 
20
  	
19
  	<buildnumber/>
20

  
21 21
  </target>
22 22

  
23 23
  <target name="generate-without-source" description="generate the distribution without the source file" >
......
25 25
    <mkdir dir="${dist}"/>
26 26
    <mkdir dir="${dist}/lib"/>
27 27

  
28
   
29
    
28

  
29

  
30 30
  	<!--
31
  	-->
31
  	- - >
32 32
  	<jar jarfile="${fmapLibs}/jts-1.7.jar" basedir="${build}" update="yes" includes="com/vividsolutions/**"/>
33
  	
34
  	<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
33

  
34
  	<! - - Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
35 35
  	<jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}" includes="com/iver/**"/>
36
  	
37
  	
38
  	
39
  	
36

  
37

  
38

  
39

  
40 40
    <copy file="config/config.xml" todir="${dist}"/>
41 41
    <!-- <copy file="config/about.htm" todir="${dist}"/> -->
42 42
    <copy todir="${dist}">
trunk/extensions/extGraph_predes/.classpath
13 13
	<classpathentry sourcepath="/JUNG_1_7_4" path="lib/jung-1.7.4.jar" kind="lib"/>
14 14
	<classpathentry path="/libGDBMS" combineaccessrules="false" kind="src"/>
15 15
	<classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.1/src/org.junit_3.8.1/junitsrc.zip" path="JUNIT_HOME/junit.jar" kind="var"/>
16
	<classpathentry sourcepath="/libUI/src" path="/_fwAndami/lib/beans.jar" kind="lib"/>
17 16
	<classpathentry sourcepath="" path="/_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/fmap.jar" kind="lib"/>
18 17
	<classpathentry path="/extGeoProcessing" combineaccessrules="false" kind="src"/>
19 18
	<classpathentry sourcepath="D:/eclipse_3_1/workspace_pruebas/jts/src" path="/libFMap/lib/jts-1.7.jar" kind="lib"/>
20 19
	<classpathentry path="/appgvSIG/lib/batik-awt-util.jar" kind="lib"/>
21 20
	<classpathentry path="/_fwAndami/lib/castor-0.9.5.3-xml.jar" kind="lib"/>
21
	<classpathentry sourcepath="/libUI/src" path="/_fwAndami/lib/beans.jar" kind="lib"/>
22 22
	<classpathentry path="bin" kind="output"/>
23 23
</classpath>

Also available in: Unified diff