Revision 23074 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/fframes/gui/dialogs/FFrameGraphicsDialog.java

View differences:

FFrameGraphicsDialog.java
44 44
 */
45 45
package com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs;
46 46

  
47
import java.awt.Dimension;
48
import java.awt.event.ActionEvent;
49
import java.awt.event.ActionListener;
47 50
import java.awt.geom.Rectangle2D;
48 51

  
52
import org.gvsig.gui.beans.AcceptCancelPanel;
53
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
54

  
49 55
import com.iver.andami.PluginServices;
50 56
import com.iver.andami.ui.mdiManager.WindowInfo;
51
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
52
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
57
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
58
import com.iver.cit.gvsig.gui.styling.SymbolSelector;
53 59
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGraphics;
54 60
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame;
55 61
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.JPRotation;
56 62
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
57
import com.iver.cit.gvsig.project.documents.view.legend.gui.SingleSymbol;
58 63

  
59 64

  
60 65
/**
......
62 67
 *
63 68
 * @author Vicente Caballero Navarro
64 69
 */
65
public class FFrameGraphicsDialog extends SingleSymbol
66
	implements IFFrameDialog {
67
	private Rectangle2D rect = new Rectangle2D.Double();
68
	private Layout m_layout = null; //  @jve:visual-info  decl-index=0 visual-constraint="393,10"
69
	private boolean isAcepted = false;
70
	private FFrameGraphics fframegraphics = null;
71
	private javax.swing.JButton bAceptar = null;
72
	private javax.swing.JButton bCancelar = null;
73
	private JPRotation pRotation = null;
74
	private FFrameGraphics newFFrameGraphics;
70
public class FFrameGraphicsDialog extends SymbolSelector
71
    implements IFFrameDialog {
72
    private Rectangle2D rect = new Rectangle2D.Double();
73
    private Layout m_layout = null; //  @jve:visual-info  decl-index=0 visual-constraint="393,10"
74
    private boolean isAcepted = false;
75
    private FFrameGraphics fframegraphics = null;
76
//    private javax.swing.JButton bAceptar = null;
77
//    private javax.swing.JButton bCancelar = null;
78
    private JPRotation pRotation = null;
79
    private FFrameGraphics newFFrameGraphics;
75 80

  
81
    public FFrameGraphicsDialog(Layout layout, FFrameGraphics fframe){
82
        super(fframe.getFSymbol(), fframe.getShapeType(), null,true);
83
        m_layout = layout;
84
        fframegraphics = fframe;
85
        initialize();
86
    }
76 87

  
77
	/**
78
	 * Crea un nuevo FFrameGraphicsDialog.
79
	 *
80
	 * @param layout Referencia al Layout.
81
	 * @param fframe Referencia al fframe de gr?fico.
82
	 */
83
	public FFrameGraphicsDialog(Layout layout, FFrameGraphics fframe) {
84
		m_layout = layout;
85
		fframegraphics = fframe;
86
		setSymbol((FSymbol) fframegraphics.getFSymbol());
87
		//fillCheckBox.setSelected(false);
88
   /**
89
     * This method initializes this
90
     */
91
    private void initialize() {
92
//		this.add(getBAceptar(), null);
93
//		this.add(getBCancelar(), null);
94
        this.setSize(650, 700);
95
        getPRotation().setRotation(fframegraphics.getRotation());
96
        ((GridBagLayoutPanel)getJPanelOptions()).addComponent(getPRotation());
88 97

  
89
		initialize();
90
//		if (getSymbol().getSymbolType()==FConstant.SHAPE_TYPE_POINT){
91
//			this.getJPanelPoint().setVisible(true);
92
//		}else{
93
//		this.getJPanelPoint().setVisible(false);
94
//		}
95
	}
98
        ActionListener okAction = new ActionListener() {
99
            public void actionPerformed(ActionEvent e) {
100
                newFFrameGraphics=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout);
101
                newFFrameGraphics.setBoundBox(fframegraphics.getBoundBox());
102
                newFFrameGraphics.setFSymbol((ISymbol)getSelectedObject());
103
                newFFrameGraphics.setRotation(getPRotation().getRotation());
104
                m_layout.getLayoutContext().updateFFrames();
105
                m_layout.getLayoutControl().refresh();
106
                isAcepted = true;
107
            }
108
        };
109
        okCancelPanel.addOkButtonActionListener(okAction);
110
     }
96 111

  
97
	/**
98
	 * This method initializes this
99
	 */
100
	private void initialize() {
101
		this.add(getBAceptar(), null);
102
		this.add(getBCancelar(), null);
103
		this.setSize(582, 373);
104
		this.add(getPRotation(), null);
105
		getPRotation().setRotation(fframegraphics.getRotation());
106
	}
112
    /**
113
     * @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
114
     */
115
    public Object getViewModel() {
116
        return "FPanelLegendDefault";
117
    }
107 118

  
108
	/**
109
	 * @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
110
	 */
111
	public Object getViewModel() {
112
		return "FPanelLegendDefault";
113
	}
119
    /**
120
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
121
     */
122
    public WindowInfo getWindowInfo() {
123
        WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
124
        m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_grafico"));
114 125

  
115
	/**
116
	 * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
117
	 */
118
	public WindowInfo getWindowInfo() {
119
		WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
120
		m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_grafico"));
126
        return m_viewinfo;
127
    }
121 128

  
122
		return m_viewinfo;
123
	}
129
    /**
130
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#setRectangle(java.awt.geom.Rectangle2D)
131
     */
132
    public void setRectangle(Rectangle2D r) {
133
        rect.setRect(r);
134
    }
124 135

  
125
	/**
126
	 * @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#setRectangle(java.awt.geom.Rectangle2D)
127
	 */
128
	public void setRectangle(Rectangle2D r) {
129
		rect.setRect(r);
130
	}
136
    /**
137
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
138
     */
139
    public boolean getIsAcepted() {
140
        return isAcepted;
141
    }
131 142

  
132
	/**
133
	 * @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
134
	 */
135
	public boolean getIsAcepted() {
136
		return isAcepted;
137
	}
143
    /**
144
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
145
     */
146
    public void viewActivated() {
147
    }
138 148

  
139
	/**
140
	 * This method initializes bAceptar
141
	 *
142
	 * @return javax.swing.JButton
143
	 */
144
	private javax.swing.JButton getBAceptar() {
145
		if (bAceptar == null) {
146
			bAceptar = new javax.swing.JButton();
147
			bAceptar.setBounds(85, 326, 122, 28);
148
			bAceptar.setText(PluginServices.getText(this, "Aceptar"));
149
			bAceptar.addActionListener(new java.awt.event.ActionListener() {
149
    /**
150
     * This method initializes pRotation
151
     *
152
     * @return javax.swing.JPanel
153
     */
154
    private JPRotation getPRotation() {
155
        if (pRotation == null) {
156
            pRotation = new JPRotation();
157
            pRotation.setPreferredSize(new Dimension(120, 120));
158
        }
159
        return pRotation;
160
    }
150 161

  
151
					public void actionPerformed(java.awt.event.ActionEvent e) {
152
//						if (getSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT) {
153
//							updateControls(false); // Para que lo que haya en
154
//						}
155
						newFFrameGraphics=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout);
156
//						FFrameGraphics fframeAux=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout);
157
//						fframeAux.setBoundBox(fframegraphics.getBoundBox());
158
//						if (getFSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
159
//						fframeAux.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getLayoutControl().getAT()));
160
//						fframeAux.setFSymbol(getFSymbol());
161
//						fframeAux.setRotation(getPRotation().getRotation());
162
						//boolean exists=m_layout.getLayoutContext().getEFS().modifyFFrame(fframegraphics,fframeAux);
163
						//if (!exists) {
164
							newFFrameGraphics.setBoundBox(fframegraphics.getBoundBox());
165
							if (getSymbol().getSymbolType() == FConstant.SYMBOL_TYPE_POINT)
166
//								newFFrameGraphics.setSize(FLayoutUtilities.toSheetDistance(Integer.parseInt(getJTextField().getText()),m_layout.getLayoutControl().getAT()));
167
							newFFrameGraphics.setFSymbol(getSymbol());
168
							newFFrameGraphics.setRotation(getPRotation().getRotation());
169
						//}
170
//						boolean exists=m_layout.getLayoutContext().getEFS().modifyFFrame(fframegraphics,fframeAux);
171
						m_layout.getLayoutContext().updateFFrames();
172
						m_layout.getLayoutControl().refresh();
173
						isAcepted = true;
174
						PluginServices.getMDIManager().closeWindow(FFrameGraphicsDialog.this);
175

  
176

  
177
					}
178
				});
179
		}
180

  
181
		return bAceptar;
182
	}
183

  
184
	/**
185
	 * This method initializes bCancelar
186
	 *
187
	 * @return javax.swing.JButton
188
	 */
189
	private javax.swing.JButton getBCancelar() {
190
		if (bCancelar == null) {
191
			bCancelar = new javax.swing.JButton();
192
			bCancelar.setBounds(292, 326, 122, 28);
193
			bCancelar.setText(PluginServices.getText(this, "Cancelar"));
194
			bCancelar.addActionListener(new java.awt.event.ActionListener() {
195
					public void actionPerformed(java.awt.event.ActionEvent e) {
196
						PluginServices.getMDIManager().closeWindow(FFrameGraphicsDialog.this);
197
					}
198
				});
199
		}
200

  
201
		return bCancelar;
202
	}
203

  
204
	/**
205
	 * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
206
	 */
207
	public void viewActivated() {
208
	}
209

  
210
	/**
211
	 * This method initializes pRotation
212
	 *
213
	 * @return javax.swing.JPanel
214
	 */
215
	private JPRotation getPRotation() {
216
		if (pRotation == null) {
217
			pRotation = new JPRotation();
218
			pRotation.setBounds(415, 156, 120, 120);
219
		}
220
		return pRotation;
221
	}
222

  
223
	public IFFrame getFFrame() {
224
		return newFFrameGraphics;
225
	}
162
    public IFFrame getFFrame() {
163
        return newFFrameGraphics;
164
    }
226 165
}  //  @jve:decl-index=0:visual-constraint="10,10"

Also available in: Unified diff