Revision 38636

View differences:

branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionEvent.java
53 53
	/**
54 54
	 * <p>Identifies this event as a action on a layer that has been added.</p>
55 55
	 */
56
	private final static int LAYER_ADDED = 0;
56
    public final static int LAYER_ADDED = 0;
57 57

  
58 58
	/**
59 59
	 * <p>Identifies this event as a action on a layer that has been removed.</p>
60 60
	 */
61
	private final static int LAYER_REMOVED = 2;
61
	public final static int LAYER_REMOVED = 2;
62 62

  
63 63
	/**
64 64
	 * <p>Identifies this event as a action on a layer that is being added.</p>
65 65
	 */
66
	private final static int LAYER_ADDING = 3;
66
	public final static int LAYER_ADDING = 3;
67 67

  
68 68
	/**
69 69
	 * <p>Identifies this event as a action on a layer that is being removed.</p>
70 70
	 */
71
	private final static int LAYER_REMOVING = 5;
71
	public final static int LAYER_REMOVING = 5;
72 72
	
73 73
	/**
74 74
	 * <p>Identifies this event as a action of change of the activation status of a layer.</p>
75 75
	 */
76
	private final static int LAYER_ACTIVATION_CHANGED = 6;
76
	public final static int LAYER_ACTIVATION_CHANGED = 6;
77 77
	
78 78
	/**
79 79
	 * <p>Identifies this event as a action of change of the visibility status of a layer.</p>
80 80
	 */
81
	private final static int LAYER_VISIBILITY_CHANGED = 7;
81
	public final static int LAYER_VISIBILITY_CHANGED = 7;
82 82

  
83 83
	/**
84 84
	 * <p>Reference to the collection of layers.</p>
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/gui/preferencespage/ViewPage.java
218 218
	private static final String FACTORY_DEFAULT_PROJECTION = "EPSG:23030";
219 219
	private static final String ZOOM_IN_FACTOR_KEY_NAME = "ZoomInFactor";
220 220
	private static final String ZOOM_OUT_FACTOR_KEY_NAME = "ZoomOutFactor";
221
	private static final String ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME = "NewLayersInInvisibleMode";
221
	public static final String ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME = "NewLayersInInvisibleMode";
222 222
	private static final String KEEP_SCALE_ON_RESIZING_KEY_NAME = "KeepScaleOnResizing";
223 223
	private static final String DEFAULT_SELECTION_COLOR_KEY_NAME = "DefaultSelectionColor";
224 224
	private static final String DEFAULT_VIEW_BACK_COLOR_KEY_NAME = "DefaultViewBackColor";
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/toc/gui/TOC.java
61 61

  
62 62
import org.gvsig.andami.PluginServices;
63 63
import org.gvsig.andami.messages.NotificationManager;
64
import org.gvsig.app.gui.preferencespage.ViewPage;
64 65
import org.gvsig.app.project.documents.view.IContextMenuAction;
65 66
import org.gvsig.app.project.documents.view.toc.DnDJTree;
66 67
import org.gvsig.app.project.documents.view.toc.ITocItem;
......
88 89
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
89 90
import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
90 91
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
92
import org.gvsig.utils.XMLEntity;
91 93

  
92 94
/**
93 95
 * 
......
227 229
                }
228 230
                LayerCollectionEvent[] events = e.getLayerCollectionEvents();
229 231
                for( int i=0; i<events.length ; i++ ) {
230
                   if( events[i].getEventType() == 0 ) { // LayerCollectionEvent.LAYER_ADDED ?? is private
232
                   if( events[i].getEventType() == LayerCollectionEvent.LAYER_ADDED ) { 
231 233
                       if (PluginServices.getMainFrame() != null) {
232 234
                           PluginServices.getMainFrame().enableControls();
233 235
                       }
234 236
                   }
237
                   // ===================================================
238
                   // Change visibility of layer before adding, according to app preferences
239
                   if( events[i].getEventType() == LayerCollectionEvent.LAYER_ADDING ) {
240

  
241
                       if (invisibilityIsForced()) {
242
                           events[i].getAffectedLayer().setVisible(false);
243
                       }
244
                   }
245
                   // ===================================================
235 246
                }
236 247
            }
237 248
        });
......
1104 1115
            super.mouseEntered(arg0);
1105 1116
        }
1106 1117
    }
1118
    
1119
    private boolean invisibilityIsForced() {
1120
        
1121
        PluginServices ps = PluginServices.getPluginServices(this);
1122
        XMLEntity xml = ps.getPersistentXML();
1107 1123

  
1124
        if (xml.contains(ViewPage.ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME)) {
1125
            // Get invisibility value
1126
            return xml.getBooleanProperty(ViewPage.ADD_NEW_LAYERS_IN_INVISIBLE_MODE_KEY_NAME);
1127
        } else {
1128
            // not found in preferences
1129
            return false;
1130
        }
1131
    }
1132

  
1108 1133
}

Also available in: Unified diff