Revision 3041

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/fframes/FFrameText.java
234 234
				drawEmpty(g);
235 235
			} else {
236 236
				for (int i = 0; i < m_text.size(); i++) {
237
                    if (m_text.get(i) == null)
238
                        m_text.set(i,"<NULL>");
237 239
					if (((String) m_text.get(i)).length() > longmax) {
238 240
						longmax = ((String) m_text.get(i)).length();
239 241
					}
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/dialogs/Tag.java
63 63
	private JButton jButton = null;
64 64
	private JButton jButton1 = null;
65 65
	private IFFrame fframe = null;
66
    ViewInfo m_viewinfo = new ViewInfo(ViewInfo.PALETTE);
66 67

  
67 68
	/**
68 69
	 * This is the default constructor
......
154 155
	/**
155 156
	 * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
156 157
	 */
157
	public ViewInfo getViewInfo() {
158
		ViewInfo m_viewinfo = new ViewInfo();
158
	public ViewInfo getViewInfo() {		
159 159
		m_viewinfo.setTitle(PluginServices.getText(this, "tag"));
160 160

  
161 161
		return m_viewinfo;
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TagExtension.java
40 40
*/
41 41
package com.iver.cit.gvsig;
42 42

  
43
import java.util.ArrayList;
44

  
45
import javax.swing.JOptionPane;
46

  
43 47
import org.apache.log4j.Logger;
44 48

  
45 49
import com.iver.andami.PluginServices;
46 50
import com.iver.andami.plugins.Extension;
47 51
import com.iver.andami.ui.mdiManager.View;
48
import com.iver.cit.gvsig.gui.layout.FLayoutZooms;
49 52
import com.iver.cit.gvsig.gui.layout.Layout;
53
import com.iver.cit.gvsig.gui.layout.fframes.FFrameText;
54
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
50 55

  
51 56

  
52 57
public class TagExtension implements Extension{
......
64 69
	public void execute(String s) {
65 70
		layout = (Layout) PluginServices.getMDIManager().getActiveView();
66 71

  
67
		FLayoutZooms zooms = new FLayoutZooms(layout);
72
		/* FLayoutZooms zooms = new FLayoutZooms(layout);
68 73
		logger.debug("Comand : " + s);
69 74
		if (s.compareTo("SET_TAG") == 0) {
70 75
			layout.setTool(Layout.SET_TAG);
71
		}
76
		} */
77
        
78
        // FJP: Cambio: abrimos la ventana de tag para
79
        // asignar el tag a los elementos seleccionados
80
        if (s.equals("SET_TAG"))
81
        {
82
            IFFrame[] selectedFrames = layout.getFFrameSelected();
83
            if (selectedFrames.length > 0)
84
            {
85
                String defaultStr = "";
86
                if (selectedFrames.length == 1)
87
                    defaultStr = selectedFrames[0].getTag();
88
                String theTag = JOptionPane.showInputDialog(null, "Introduzca el tag:", defaultStr);
89
                for (int i=0; i< selectedFrames.length; i++)
90
                    selectedFrames[i].setTag(theTag);
91
            }
92
        }
93
        else if (s.equals("VIEW_TAGS"))
94
        {
95
            ArrayList frames = layout.getFFrames();
96
            for (int i=0; i< frames.size(); i++)
97
            {
98
                IFFrame f = (IFFrame) frames.get(i);
99
                if (f instanceof FFrameText)
100
                {
101
                    FFrameText txt = (FFrameText) f;
102
                    txt.clearText();
103
                    txt.addText(f.getTag());
104
                }
105
            }
106
            layout.refresh();
107
        }
72 108
	}
73 109

  
74 110
	/**
75 111
	 * @see com.iver.andami.plugins.Extension#isEnabled()
76 112
	 */
77 113
	public boolean isEnabled() {
78
		return true;
114
        View f = PluginServices.getMDIManager().getActiveView();
115

  
116
        if (f == null) {
117
            return false;
118
        }
119

  
120
        if (f.getClass() == Layout.class)
121
        {
122
            layout = (Layout) f;        
123
            IFFrame[] selectedFrames = layout.getFFrameSelected();
124
            if (selectedFrames == null) return false;
125
            return (selectedFrames.length > 0);
126
        }
127
        return false;
79 128
	}
80 129

  
81 130
	/**
trunk/applications/appgvSIG/config/config.xml
192 192
		</extension>	
193 193
		<extension class-name="com.iver.cit.gvsig.TagExtension" 
194 194
			description="Extensi?n para a?adir un tag a los FFrames."
195
			active="false">
195
			active="true">
196 196
			<menu text="mapa/anadir_tag" key="t" action-command="SET_TAG" tooltip="anadir_tag" icon="images/tag.png"/>
197 197
			<tool-bar name="Mapa">
198
				<selectable-tool icon="images/tag.png" action-command="SET_TAG" tooltip="anadir_tag"/>
198
				<action-tool icon="images/gtk-add.png" action-command="SET_TAG" tooltip="anadir_tag"/>
199
				<action-tool icon="images/gtk-apply.png" action-command="VIEW_TAGS" tooltip="ver_tags"/>
199 200
			</tool-bar>
200 201
		</extension>
201 202
		<extension class-name="com.iver.cit.gvsig.GraphicControls"

Also available in: Unified diff