system/src/sc/layer/LayeredSystem.java
public void disableLayer(Layer layer) {
      LayeredSystem mainSys = getMainLayeredSystem();
      if (peerMode && mainSys == this) {
         error("*** Error - invalid main layered system");
         return;
      }
      if (peerMode) {
         if (mainSys == null) {
            System.err.println("*** Attempt to disable layer: " + layer.getLayerName() + " in peer system: " + this + " with no main system:");
            return;
         }
         mainSys.disableLayer(layer);
      }
      else {
         if (disabledLayers == null)
            disabledLayers = new ArrayList<Layer>();
         if (!disabledLayers.contains(layer)) {
            disabledLayers.add(layer);
            Layer oldLayer = disabledLayersIndex.put(layer.getLayerName(), layer);
            if (layer.layeredSystem != this && oldLayer != null && oldLayer.layeredSystem == this) {
               // If we've already disabled this layer in this system, put back our system as it's preferred that they match
               disabledLayersIndex.put(layer.getLayerName(), oldLayer);
            }

            if (inactiveLayers.remove(layer)) {
               inactiveLayerIndex.remove(layer.getLayerName());
               renumberInactiveLayers(0);
            }

            // Disabled layers are always stored on the main layered system but sometimes, we'll find a disabled
            // layer in another layered system.  Need to make sure it's not considered an inactive layer for that system.
            LayeredSystem layerSys = layer.layeredSystem;
            if (layerSys != this) {
               if (layerSys.inactiveLayers.remove(layer)) {
                  layerSys.inactiveLayerIndex.remove(layer.getLayerName());
                  layerSys.renumberInactiveLayers(0);
               }
            }
            layer.layerPosition = disabledLayers.size() - 1;
         }
         checkLayerPosition();
      }
   }
/** Moves the layer into the list of disabled layers. */
Moves the layer into the list of disabled layers.
Moves the layer into the list of disabled layers .
public void disableLayer(Layer layer) {
      LayeredSystem mainSys = getMainLayeredSystem();
      if (peerMode && mainSys == this) {
         error("*** Error - invalid main layered system");
         return;
      }
      if (peerMode) {
         if (mainSys == null) {
            System.err.println("*** Attempt to disable layer: " + layer.getLayerName() + " in peer system: " + this + " with no main system:");
            return;
         }
         mainSys.disableLayer(layer);
      }
      else {
         if (disabledLayers == null)
            disabledLayers = new ArrayList<Layer>();
         if (!disabledLayers.contains(layer)) {
            disabledLayers.add(layer);
            Layer oldLayer = disabledLayersIndex.put(layer.getLayerName(), layer);
            if (layer.layeredSystem != this && oldLayer != null && oldLayer.layeredSystem == this) {
               disabledLayersIndex.put(layer.getLayerName(), oldLayer);
            }
            if (inactiveLayers.remove(layer)) {
               inactiveLayerIndex.remove(layer.getLayerName());
               renumberInactiveLayers(0);
            }
            LayeredSystem layerSys = layer.layeredSystem;
            if (layerSys != this) {
               if (layerSys.inactiveLayers.remove(layer)) {
                  layerSys.inactiveLayerIndex.remove(layer.getLayerName());
                  layerSys.renumberInactiveLayers(0);
               }
            }
            layer.layerPosition = disabledLayers.size() - 1;
         }
         checkLayerPosition();
      }
   }
public void disableLayer ( Layer layer ) { LayeredSystem mainSys = getMainLayeredSystem ( ) ; if ( peerMode && mainSys == this ) { error ( "*** Error - invalid main layered system" ) ; return ; } if ( peerMode ) { if ( mainSys == null ) { System . err . println ( "*** Attempt to disable layer: " + layer . getLayerName ( ) + " in peer system: " + this + " with no main system:" ) ; return ; } mainSys . disableLayer ( layer ) ; } else { if ( disabledLayers == null ) disabledLayers = new ArrayList < Layer > ( ) ; if ( ! disabledLayers . contains ( layer ) ) { disabledLayers . add ( layer ) ; Layer oldLayer = disabledLayersIndex . put ( layer . getLayerName ( ) , layer ) ; if ( layer . layeredSystem != this && oldLayer != null && oldLayer . layeredSystem == this ) { disabledLayersIndex . put ( layer . getLayerName ( ) , oldLayer ) ; } if ( inactiveLayers . remove ( layer ) ) { inactiveLayerIndex . remove ( layer . getLayerName ( ) ) ; renumberInactiveLayers ( 0 ) ; } LayeredSystem layerSys = layer . layeredSystem ; if ( layerSys != this ) { if ( layerSys . inactiveLayers . remove ( layer ) ) { layerSys . inactiveLayerIndex . remove ( layer . getLayerName ( ) ) ; layerSys . renumberInactiveLayers ( 0 ) ; } } layer . layerPosition = disabledLayers . size ( ) - 1 ; } checkLayerPosition ( ) ; } }
Moves the layer into the list of disabled layers.
Moves the layer into the list of disabled layers .
// If we've already disabled this layer in this system, put back our system as it's preferred that they match // Disabled layers are always stored on the main layered system but sometimes, we'll find a disabled // layer in another layered system.  Need to make sure it's not considered an inactive layer for that system.