org-netbeans-core-windows

16:39:36.944 INFO  jd.cli.Main - Decompiling org-netbeans-core-windows.jar
package org.netbeans.core.windows;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.KeyboardFocusManager;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
import javax.swing.SwingUtilities;
import org.netbeans.core.windows.model.DockingStatus;
import org.netbeans.core.windows.model.Model;
import org.netbeans.core.windows.model.ModelElement;
import org.netbeans.core.windows.model.ModelFactory;
import org.netbeans.core.windows.options.WinSysPrefs;
import org.netbeans.core.windows.view.ControllerHandler;
import org.openide.windows.TopComponent;

final class Central
  implements ControllerHandler
{
  private final Model model = ModelFactory.createWindowSystemModel();
  private final ViewRequestor viewRequestor = new ViewRequestor(this);
  private ModeImpl modeBeingMaximized = null;
  
  public void topComponentRequestAttention(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    String str = getModeName(paramModeImpl);
    viewRequestor.scheduleRequest(new ViewRequest(str, 63, paramTopComponent, paramTopComponent));
  }
  
  public void topComponentCancelRequestAttention(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    String str = getModeName(paramModeImpl);
    viewRequestor.scheduleRequest(new ViewRequest(str, 64, paramTopComponent, paramTopComponent));
  }
  
  public void setVisible(boolean paramBoolean)
  {
    if (isVisible() == paramBoolean) {
      return;
    }
    model.setVisible(paramBoolean);
    
    viewRequestor.scheduleRequest(new ViewRequest(null, 0, null, Boolean.valueOf(paramBoolean)));
  }
  
  public void setMainWindowBoundsJoined(Rectangle paramRectangle)
  {
    if (paramRectangle == null) {
      return;
    }
    Rectangle localRectangle = getMainWindowBoundsJoined();
    if (localRectangle.equals(paramRectangle)) {
      return;
    }
    model.setMainWindowBoundsJoined(paramRectangle);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 1, localRectangle, paramRectangle));
    }
  }
  
  public void setMainWindowBoundsSeparated(Rectangle paramRectangle)
  {
    if (paramRectangle == null) {
      return;
    }
    Rectangle localRectangle = getMainWindowBoundsSeparated();
    if (localRectangle.equals(paramRectangle)) {
      return;
    }
    model.setMainWindowBoundsSeparated(paramRectangle);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 2, localRectangle, paramRectangle));
    }
  }
  
  public void setMainWindowFrameStateJoined(int paramInt)
  {
    int i = getMainWindowFrameStateJoined();
    if (i == paramInt) {
      return;
    }
    model.setMainWindowFrameStateJoined(paramInt);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 3, Integer.valueOf(i), Integer.valueOf(paramInt)));
    }
  }
  
  public void setMainWindowFrameStateSeparated(int paramInt)
  {
    int i = getMainWindowFrameStateSeparated();
    if (i == paramInt) {
      return;
    }
    model.setMainWindowFrameStateSeparated(paramInt);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 4, Integer.valueOf(i), Integer.valueOf(paramInt)));
    }
  }
  
  public void setActiveMode(ModeImpl paramModeImpl)
  {
    if (paramModeImpl != null)
    {
      localObject = paramModeImpl.getOpenedTopComponents();
      if (((List)localObject).size() == 0) {
        return;
      }
    }
    Object localObject = getActiveMode();
    if (paramModeImpl == localObject)
    {
      ModeImpl localModeImpl = model.getSlidingMode("bottom");
      int i = (localModeImpl == null) || (localModeImpl.getSelectedTopComponent() == null) ? 1 : 0;
      localModeImpl = model.getSlidingMode("left");
      int j = (localModeImpl == null) || (localModeImpl.getSelectedTopComponent() == null) ? 1 : 0;
      localModeImpl = model.getSlidingMode("right");
      int k = (localModeImpl == null) || (localModeImpl.getSelectedTopComponent() == null) ? 1 : 0;
      if ((i != 0) && (j != 0) && (k != 0)) {
        return;
      }
    }
    model.setActiveMode(paramModeImpl);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 9, localObject, paramModeImpl));
    }
    WindowManagerImpl.getInstance().doFirePropertyChange("activeMode", localObject, paramModeImpl);
    if (paramModeImpl != null) {
      WindowManagerImpl.notifyRegistryTopComponentActivated(paramModeImpl.getSelectedTopComponent());
    } else {
      WindowManagerImpl.notifyRegistryTopComponentActivated(null);
    }
  }
  
  public void setEditorAreaBounds(Rectangle paramRectangle)
  {
    if (paramRectangle == null) {
      return;
    }
    Rectangle localRectangle = getEditorAreaBounds();
    if (localRectangle.equals(paramRectangle)) {
      return;
    }
    model.setEditorAreaBounds(paramRectangle);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 7, localRectangle, paramRectangle));
    }
  }
  
  public void setEditorAreaConstraints(SplitConstraint[] paramArrayOfSplitConstraint)
  {
    SplitConstraint[] arrayOfSplitConstraint = getEditorAreaConstraints();
    if (Arrays.equals(arrayOfSplitConstraint, paramArrayOfSplitConstraint)) {
      return;
    }
    model.setEditorAreaConstraints(paramArrayOfSplitConstraint);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 8, arrayOfSplitConstraint, paramArrayOfSplitConstraint));
    }
  }
  
  public void setEditorAreaState(int paramInt)
  {
    int i = getEditorAreaState();
    if (paramInt == i) {
      return;
    }
    int j = paramInt == 0 ? 0 : 1;
    for (Object localObject1 = getModes().iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (ModeImpl)((Iterator)localObject1).next();
      Object localObject3;
      if ((((ModeImpl)localObject2).getKind() == 0) && (((ModeImpl)localObject2).getState() != j))
      {
        model.setModeState((ModeImpl)localObject2, j);
        if (paramInt == 1)
        {
          localObject3 = model.getModeBounds((ModeImpl)localObject2);
          if (((Rectangle)localObject3).isEmpty()) {
            model.setModeBounds((ModeImpl)localObject2, model.getModeBoundsSeparatedHelp((ModeImpl)localObject2));
          }
        }
      }
      if ((((ModeImpl)localObject2).getKind() == 2) && (paramInt == 1))
      {
        localObject3 = ((ModeImpl)localObject2).getTopComponents();
        for (int k = 0; k < localObject3.length; k++)
        {
          String str = WindowManagerImpl.getInstance().findTopComponentID(localObject3[k]);
          ModeImpl localModeImpl = model.getModeTopComponentPreviousMode((ModeImpl)localObject2, str);
          if ((localModeImpl == null) || (!model.getModes().contains(localModeImpl)))
          {
            SplitConstraint[] arrayOfSplitConstraint = model.getModeTopComponentPreviousConstraints((ModeImpl)localObject2, str);
            arrayOfSplitConstraint = arrayOfSplitConstraint == null ? new SplitConstraint[0] : arrayOfSplitConstraint;
            
            localModeImpl = WindowManagerImpl.getInstance().createModeImpl(ModeImpl.getUnusedModeName(), 0, false);
            
            model.setModeState(localModeImpl, j);
            model.addMode(localModeImpl, arrayOfSplitConstraint);
          }
          moveTopComponentsIntoMode(localModeImpl, new TopComponent[] { localObject3[k] });
        }
      }
    }
    Object localObject2;
    if (paramInt == 1)
    {
      localObject1 = model.getEditorAreaBounds();
      if (((Rectangle)localObject1).isEmpty()) {
        model.setEditorAreaBounds(model.getEditorAreaBoundsHelp());
      }
      localObject2 = model.getMainWindowBoundsSeparated();
      if (((Rectangle)localObject2).isEmpty()) {
        model.setMainWindowBoundsSeparated(model.getMainWindowBoundsSeparatedHelp());
      }
    }
    model.setEditorAreaState(paramInt);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 5, Integer.valueOf(i), Integer.valueOf(paramInt)));
    }
    WindowManagerImpl.getInstance().doFirePropertyChange("editorAreaState", Integer.valueOf(i), Integer.valueOf(paramInt));
  }
  
  public void setEditorAreaFrameState(int paramInt)
  {
    int i = getEditorAreaFrameState();
    if (i == paramInt) {
      return;
    }
    model.setEditorAreaFrameState(paramInt);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 6, Integer.valueOf(i), Integer.valueOf(paramInt)));
    }
  }
  
  void switchMaximizedMode(ModeImpl paramModeImpl)
  {
    ModeImpl localModeImpl1 = getCurrentMaximizedMode();
    if (paramModeImpl == localModeImpl1) {
      return;
    }
    WindowManagerImpl localWindowManagerImpl = WindowManagerImpl.getInstance();
    Object localObject1;
    Object localObject2;
    ModeImpl localModeImpl2;
    if (null == paramModeImpl)
    {
      if (isViewMaximized())
      {
        if (isEditorMaximized()) {
          restoreViews(model.getMaximizedDockingStatus());
        } else {
          restoreViews(model.getDefaultDockingStatus());
        }
        localObject1 = getViewMaximizedMode();
        if (((ModeImpl)localObject1).getTopComponents().length == 1)
        {
          localObject2 = localObject1.getTopComponents()[0];
          String str = localWindowManagerImpl.findTopComponentID((TopComponent)localObject2);
          
          localModeImpl2 = getModeTopComponentPreviousMode(str, (ModeImpl)localObject1);
          int j = model.getModeTopComponentPreviousIndex((ModeImpl)localObject1, str);
          if (null == localModeImpl2)
          {
            if ((localModeImpl2 == null) || (!model.getModes().contains(localModeImpl2)))
            {
              SplitConstraint[] arrayOfSplitConstraint = model.getModeTopComponentPreviousConstraints((ModeImpl)localObject1, str);
              if (arrayOfSplitConstraint != null)
              {
                localModeImpl2 = WindowManagerImpl.getInstance().createModeImpl(ModeImpl.getUnusedModeName(), 0, false);
                
                model.addMode(localModeImpl2, arrayOfSplitConstraint);
              }
            }
            if (localModeImpl2 == null) {
              localModeImpl2 = WindowManagerImpl.getInstance().getDefaultViewMode();
            }
          }
          localModeImpl2.addOpenedTopComponent((TopComponent)localObject2, j);
          localModeImpl2.setSelectedTopComponent((TopComponent)localObject2);
          setActiveMode(localModeImpl2);
          model.removeMode((ModeImpl)localObject1);
        }
        else
        {
          Logger.getLogger(Central.class.getName()).log(Level.WARNING, "A 'view' mode is maximized but it has wrong number of TopComponents, Mode=[" + ((ModeImpl)localObject1).getName() + "], TC count=" + ((ModeImpl)localObject1).getTopComponents().length);
        }
        setViewMaximizedMode(null);
      }
      else if (isEditorMaximized())
      {
        model.getMaximizedDockingStatus().mark();
        localObject1 = getActiveMode();
        
        restoreViews(model.getDefaultDockingStatus());
        
        setEditorMaximizedMode(null);
        
        setActiveMode((ModeImpl)localObject1);
      }
    }
    else
    {
      assert (!isViewMaximized());
      if (paramModeImpl.getKind() == 1)
      {
        model.getDefaultDockingStatus().mark();
        
        restoreViews(model.getMaximizedDockingStatus());
        
        setEditorMaximizedMode(paramModeImpl);
      }
      else if (paramModeImpl.getKind() == 0)
      {
        localObject1 = paramModeImpl.getSelectedTopComponent();
        if (null == localObject1)
        {
          if (paramModeImpl.getOpenedTopComponents().isEmpty()) {
            return;
          }
          localObject1 = (TopComponent)paramModeImpl.getOpenedTopComponents().get(0);
        }
        if (isEditorMaximized()) {
          model.getMaximizedDockingStatus().mark();
        } else {
          model.getDefaultDockingStatus().mark();
        }
        modeBeingMaximized = paramModeImpl;
        
        localObject2 = localWindowManagerImpl.findTopComponentID((TopComponent)localObject1);
        int i = paramModeImpl.getOpenedTopComponents().indexOf(localObject1);
        
        localModeImpl2 = WindowManagerImpl.getInstance().createModeImpl(ModeImpl.getUnusedModeName(), 0, true);
        model.addMode(localModeImpl2, new SplitConstraint[0]);
        
        localModeImpl2.addOpenedTopComponent((TopComponent)localObject1);
        localModeImpl2.setSelectedTopComponent((TopComponent)localObject1);
        
        setModeTopComponentPreviousMode((String)localObject2, localModeImpl2, paramModeImpl, i);
        
        setViewMaximizedMode(localModeImpl2);
        
        slideAllViews();
        
        setActiveMode(localModeImpl2);
        
        modeBeingMaximized = null;
      }
      else
      {
        throw new IllegalArgumentException("Cannot maximize a sliding view");
      }
    }
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 11, localModeImpl1, getCurrentMaximizedMode()));
    }
    WindowManagerImpl.getInstance().doFirePropertyChange("maximizedMode", localModeImpl1, getCurrentMaximizedMode());
  }
  
  void setEditorMaximizedMode(ModeImpl paramModeImpl)
  {
    model.setEditorMaximizedMode(paramModeImpl);
  }
  
  void setViewMaximizedMode(ModeImpl paramModeImpl)
  {
    model.setViewMaximizedMode(paramModeImpl);
  }
  
  public void setModeConstraints(ModeImpl paramModeImpl, SplitConstraint[] paramArrayOfSplitConstraint)
  {
    SplitConstraint[] arrayOfSplitConstraint = getModeConstraints(paramModeImpl);
    if (Arrays.equals(paramArrayOfSplitConstraint, arrayOfSplitConstraint)) {
      return;
    }
    model.setModeConstraints(paramModeImpl, paramArrayOfSplitConstraint);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 14, arrayOfSplitConstraint, paramArrayOfSplitConstraint));
    }
  }
  
  public void addMode(ModeImpl paramModeImpl, SplitConstraint[] paramArrayOfSplitConstraint)
  {
    SplitConstraint[] arrayOfSplitConstraint = getModeConstraints(paramModeImpl);
    if (paramArrayOfSplitConstraint == arrayOfSplitConstraint) {
      return;
    }
    model.addMode(paramModeImpl, paramArrayOfSplitConstraint);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 12, null, paramModeImpl));
    }
    WindowManagerImpl.getInstance().doFirePropertyChange("modes", null, null);
  }
  
  public void removeMode(ModeImpl paramModeImpl)
  {
    if (!getModes().contains(paramModeImpl)) {
      return;
    }
    model.removeMode(paramModeImpl);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 13, null, paramModeImpl));
    }
    WindowManagerImpl.getInstance().doFirePropertyChange("modes", null, null);
  }
  
  public void setToolbarConfigName(String paramString)
  {
    String str = getToolbarConfigName();
    if (str.equals(paramString)) {
      return;
    }
    model.setToolbarConfigName(paramString);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 10, str, paramString));
    }
  }
  
  public void updateUI()
  {
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(null, 61, null, null));
    }
  }
  
  private void closeMode(ModeImpl paramModeImpl)
  {
    if (paramModeImpl == null) {
      return;
    }
    TopComponent[] arrayOfTopComponent = (TopComponent[])getModeOpenedTopComponents(paramModeImpl).toArray(new TopComponent[0]);
    for (int i = 0; i < arrayOfTopComponent.length; i++) {
      if (PersistenceHandler.isTopComponentPersistentWhenClosed(arrayOfTopComponent[i])) {
        model.addModeClosedTopComponent(paramModeImpl, arrayOfTopComponent[i]);
      } else if (Boolean.TRUE.equals(arrayOfTopComponent[i].getClientProperty("KeepNonPersistentTCInModelWhenClosed"))) {
        model.addModeClosedTopComponent(paramModeImpl, arrayOfTopComponent[i]);
      } else {
        model.removeModeTopComponent(paramModeImpl, arrayOfTopComponent[i], null);
      }
    }
    ModeImpl localModeImpl1 = getActiveMode();
    ModeImpl localModeImpl2;
    if (paramModeImpl == localModeImpl1) {
      localModeImpl2 = setSomeModeActive();
    } else {
      localModeImpl2 = localModeImpl1;
    }
    int j = 0;
    if ((!paramModeImpl.isPermanent()) && (model.getModeTopComponents(paramModeImpl).isEmpty())) {
      if (doCheckSlidingModes(paramModeImpl))
      {
        model.removeMode(paramModeImpl);
        j = 1;
      }
    }
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 45, null, null));
    }
    for (int k = 0; k < arrayOfTopComponent.length; k++) {
      WindowManagerImpl.getInstance().notifyTopComponentClosed(arrayOfTopComponent[k]);
    }
    if (localModeImpl1 != localModeImpl2) {
      WindowManagerImpl.getInstance().doFirePropertyChange("activeMode", localModeImpl1, localModeImpl2);
    }
    if (j != 0) {
      WindowManagerImpl.getInstance().doFirePropertyChange("modes", null, null);
    }
    if (localModeImpl2 != null) {
      WindowManagerImpl.notifyRegistryTopComponentActivated(localModeImpl2.getSelectedTopComponent());
    } else {
      WindowManagerImpl.notifyRegistryTopComponentActivated(null);
    }
  }
  
  private ModeImpl setSomeModeActive()
  {
    for (Iterator localIterator = getModes().iterator(); localIterator.hasNext();)
    {
      ModeImpl localModeImpl = (ModeImpl)localIterator.next();
      if ((!localModeImpl.getOpenedTopComponents().isEmpty()) && (2 != localModeImpl.getKind()))
      {
        model.setActiveMode(localModeImpl);
        return localModeImpl;
      }
    }
    model.setActiveMode(null);
    return model.getActiveMode();
  }
  
  public void setModeBounds(ModeImpl paramModeImpl, Rectangle paramRectangle)
  {
    if (paramRectangle == null) {
      return;
    }
    Rectangle localRectangle = getModeBounds(paramModeImpl);
    if (localRectangle.equals(paramRectangle)) {
      return;
    }
    model.setModeBounds(paramModeImpl, paramRectangle);
    if ((isVisible()) && (getEditorAreaState() == 1)) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 20, localRectangle, paramRectangle));
    }
    paramModeImpl.doFirePropertyChange("bounds", localRectangle, paramRectangle);
  }
  
  public void setModeFrameState(ModeImpl paramModeImpl, int paramInt)
  {
    int i = getModeFrameState(paramModeImpl);
    if (paramInt == i) {
      return;
    }
    model.setModeFrameState(paramModeImpl, paramInt);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 21, Integer.valueOf(i), Integer.valueOf(paramInt)));
    }
  }
  
  public void setModeSelectedTopComponent(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    if (((paramModeImpl.getKind() != 2) || (paramTopComponent != null)) && 
      (!getModeOpenedTopComponents(paramModeImpl).contains(paramTopComponent))) {
      return;
    }
    TopComponent localTopComponent = getModeSelectedTopComponent(paramModeImpl);
    if (paramTopComponent == localTopComponent) {
      return;
    }
    model.setModeSelectedTopComponent(paramModeImpl, paramTopComponent);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 22, localTopComponent, paramTopComponent));
    }
    if (paramModeImpl == getActiveMode()) {
      WindowManagerImpl.notifyRegistryTopComponentActivated(paramTopComponent);
    }
  }
  
  public void setModePreviousSelectedTopComponentID(ModeImpl paramModeImpl, String paramString)
  {
    model.setModePreviousSelectedTopComponentID(paramModeImpl, paramString);
  }
  
  public void addModeOpenedTopComponent(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    boolean bool = paramTopComponent.isOpened();
    if (getModeOpenedTopComponents(paramModeImpl).contains(paramTopComponent)) {
      return;
    }
    removeTopComponentFromOtherModes(paramModeImpl, paramTopComponent);
    
    model.addModeOpenedTopComponent(paramModeImpl, paramTopComponent);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 23, null, paramTopComponent));
    }
    if (!bool) {
      WindowManagerImpl.getInstance().notifyTopComponentOpened(paramTopComponent);
    }
  }
  
  void addModeOpenedTopComponentNoNotify(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    if (getModeOpenedTopComponents(paramModeImpl).contains(paramTopComponent)) {
      return;
    }
    removeTopComponentFromOtherModes(paramModeImpl, paramTopComponent);
    
    model.addModeOpenedTopComponent(paramModeImpl, paramTopComponent);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 23, null, paramTopComponent));
    }
  }
  
  public void insertModeOpenedTopComponent(ModeImpl paramModeImpl, TopComponent paramTopComponent, int paramInt)
  {
    boolean bool = paramTopComponent.isOpened();
    List localList = getModeOpenedTopComponents(paramModeImpl);
    if ((paramInt >= 0) && (!localList.isEmpty()) && (localList.size() > paramInt) && (localList.get(paramInt) == paramTopComponent)) {
      return;
    }
    removeTopComponentFromOtherModes(paramModeImpl, paramTopComponent);
    
    model.insertModeOpenedTopComponent(paramModeImpl, paramTopComponent, paramInt);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 23, null, paramTopComponent));
    }
    if (!bool) {
      WindowManagerImpl.getInstance().notifyTopComponentOpened(paramTopComponent);
    }
  }
  
  public boolean addModeClosedTopComponent(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    boolean bool = getModeOpenedTopComponents(paramModeImpl).contains(paramTopComponent);
    if ((bool) && (!paramTopComponent.canClose())) {
      return false;
    }
    if ((containsModeTopComponent(paramModeImpl, paramTopComponent)) && (!bool)) {
      return false;
    }
    if ((isViewMaximized()) && (paramModeImpl.getKind() == 2)) {
      paramModeImpl = unSlide(paramTopComponent, paramModeImpl);
    }
    removeTopComponentFromOtherModes(paramModeImpl, paramTopComponent);
    
    model.addModeClosedTopComponent(paramModeImpl, paramTopComponent);
    
    ModeImpl localModeImpl1 = getActiveMode();
    ModeImpl localModeImpl2;
    if ((model.getModeOpenedTopComponents(paramModeImpl).isEmpty()) && (paramModeImpl == localModeImpl1)) {
      localModeImpl2 = setSomeModeActive();
    } else {
      localModeImpl2 = localModeImpl1;
    }
    if ((getCurrentMaximizedMode() == paramModeImpl) && (model.getModeOpenedTopComponents(paramModeImpl).isEmpty())) {
      switchMaximizedMode(null);
    }
    if ((isVisible()) && (bool)) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 24, null, paramTopComponent));
    }
    if (localModeImpl1 != localModeImpl2) {
      WindowManagerImpl.getInstance().doFirePropertyChange("activeMode", localModeImpl1, localModeImpl2);
    }
    if (localModeImpl2 != null) {
      WindowManagerImpl.notifyRegistryTopComponentActivated(localModeImpl2.getSelectedTopComponent());
    } else {
      WindowManagerImpl.notifyRegistryTopComponentActivated(null);
    }
    if (bool) {
      WindowManagerImpl.getInstance().notifyTopComponentClosed(paramTopComponent);
    }
    return true;
  }
  
  public void addModeUnloadedTopComponent(ModeImpl paramModeImpl, String paramString)
  {
    model.addModeUnloadedTopComponent(paramModeImpl, paramString);
  }
  
  public void setUnloadedSelectedTopComponent(ModeImpl paramModeImpl, String paramString)
  {
    model.setModeUnloadedSelectedTopComponent(paramModeImpl, paramString);
  }
  
  public void setUnloadedPreviousSelectedTopComponent(ModeImpl paramModeImpl, String paramString)
  {
    model.setModeUnloadedPreviousSelectedTopComponent(paramModeImpl, paramString);
  }
  
  public List<String> getModeOpenedTopComponentsIDs(ModeImpl paramModeImpl)
  {
    return model.getModeOpenedTopComponentsIDs(paramModeImpl);
  }
  
  public List getModeClosedTopComponentsIDs(ModeImpl paramModeImpl)
  {
    return model.getModeClosedTopComponentsIDs(paramModeImpl);
  }
  
  public List getModeTopComponentsIDs(ModeImpl paramModeImpl)
  {
    return model.getModeTopComponentsIDs(paramModeImpl);
  }
  
  private boolean removeTopComponentFromOtherModes(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    boolean bool = false;
    for (Iterator localIterator = model.getModes().iterator(); localIterator.hasNext();)
    {
      ModeImpl localModeImpl = (ModeImpl)localIterator.next();
      if (localModeImpl != paramModeImpl) {
        if (model.containsModeTopComponent(localModeImpl, paramTopComponent))
        {
          bool = true;
          model.removeModeTopComponent(localModeImpl, paramTopComponent, null);
          
          int i = 0;
          if ((!localModeImpl.isPermanent()) && (localModeImpl.isEmpty()) && (doCheckSlidingModes(localModeImpl)) && (paramModeImpl.getKind() != 2) && (localModeImpl != modeBeingMaximized))
          {
            model.removeMode(localModeImpl);
            i = 1;
          }
          if (i != 0) {
            WindowManagerImpl.getInstance().doFirePropertyChange("modes", null, null);
          }
        }
      }
    }
    return bool;
  }
  
  public boolean removeModeTopComponent(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    if (!containsModeTopComponent(paramModeImpl, paramTopComponent)) {
      return false;
    }
    boolean bool = getModeOpenedTopComponents(paramModeImpl).contains(paramTopComponent);
    if ((bool) && (!paramTopComponent.canClose())) {
      return false;
    }
    TopComponent localTopComponent = null;
    if (paramModeImpl.getKind() == 1) {
      localTopComponent = findTopComponentToActivateAfterClose(paramModeImpl, paramTopComponent);
    }
    model.removeModeTopComponent(paramModeImpl, paramTopComponent, localTopComponent);
    
    ModeImpl localModeImpl1 = getActiveMode();
    ModeImpl localModeImpl2;
    if ((model.getModeOpenedTopComponents(paramModeImpl).isEmpty()) && (paramModeImpl == localModeImpl1)) {
      localModeImpl2 = setSomeModeActive();
    } else {
      localModeImpl2 = localModeImpl1;
    }
    if ((getCurrentMaximizedMode() == paramModeImpl) && (model.getModeOpenedTopComponents(paramModeImpl).isEmpty())) {
      switchMaximizedMode(null);
    }
    int i = 0;
    if ((!paramModeImpl.isPermanent()) && (model.getModeTopComponents(paramModeImpl).isEmpty())) {
      if (doCheckSlidingModes(paramModeImpl))
      {
        model.removeMode(paramModeImpl);
        i = 1;
      }
    }
    if ((bool) && (isVisible())) {
      viewRequestor.scheduleRequest(new ViewRequest(paramModeImpl, 24, null, paramTopComponent));
    }
    if (bool) {
      WindowManagerImpl.getInstance().notifyTopComponentClosed(paramTopComponent);
    }
    if (localModeImpl1 != localModeImpl2) {
      WindowManagerImpl.getInstance().doFirePropertyChange("activeMode", localModeImpl1, localModeImpl2);
    }
    if (i != 0) {
      WindowManagerImpl.getInstance().doFirePropertyChange("modes", null, null);
    }
    if (localModeImpl2 != null) {
      WindowManagerImpl.notifyRegistryTopComponentActivated(localModeImpl2.getSelectedTopComponent());
    } else {
      WindowManagerImpl.notifyRegistryTopComponentActivated(null);
    }
    return true;
  }
  
  TopComponent getRecentTopComponent(ModeImpl paramModeImpl, TopComponent paramTopComponent)
  {
    WindowManagerImpl localWindowManagerImpl = WindowManagerImpl.getInstance();
    TopComponent[] arrayOfTopComponent = localWindowManagerImpl.getRecentViewList();
    for (int i = 0; i < arrayOfTopComponent.length; i++)
    {
      TopComponent localTopComponent = arrayOfTopComponent[i];
      if (localTopComponent != null)
      {
        ModeImpl localModeImpl = (ModeImpl)localWindowManagerImpl.findMode(localTopComponent);
        if ((localModeImpl != null) && (localModeImpl == paramModeImpl) && (localTopComponent != paramTopComponent)) {
          return localTopComponent;
        }
      }
    }
    return null;
  }
  
  boolean doCheckSlidingModes(ModeImpl paramModeImpl)
  {
    ModeImpl localModeImpl1 = model.getSlidingMode("bottom");
    TopComponent[] arrayOfTopComponent;
    int i;
    String str;
    ModeImpl localModeImpl2;
    if (localModeImpl1 != null)
    {
      arrayOfTopComponent = localModeImpl1.getTopComponents();
      for (i = 0; i < arrayOfTopComponent.length; i++)
      {
        str = WindowManagerImpl.getInstance().findTopComponentID(arrayOfTopComponent[i]);
        localModeImpl2 = model.getModeTopComponentPreviousMode(localModeImpl1, str);
        if (localModeImpl2 == paramModeImpl) {
          return false;
        }
      }
    }
    localModeImpl1 = model.getSlidingMode("left");
    if (localModeImpl1 != null)
    {
      arrayOfTopComponent = localModeImpl1.getTopComponents();
      for (i = 0; i < arrayOfTopComponent.length; i++)
      {
        str = WindowManagerImpl.getInstance().findTopComponentID(arrayOfTopComponent[i]);
        localModeImpl2 = model.getModeTopComponentPreviousMode(localModeImpl1, str);
        if (localModeImpl2 == paramModeImpl) {
          return false;
        }
      }
    }
    localModeImpl1 = model.getSlidingMode("right");
    if (localModeImpl1 != null)
    {
      arrayOfTopComponent = localModeImpl1.getTopComponents();
      for (i = 0; i < arrayOfTopComponent.length; i++)
      {
        str = WindowManagerImpl.getInstance().findTopComponentID(arrayOfTopComponent[i]);
        localModeImpl2 = model.getModeTopComponentPreviousMode(localModeImpl1, str);
        if (localModeImpl2 == paramModeImpl) {
          return false;
        }
      }
    }
    return true;
  }
  
  public void removeModeClosedTopComponentID(ModeImpl paramModeImpl, String paramString)
  {
    model.removeModeClosedTopComponentID(paramModeImpl, paramString);
  }
  
  public boolean isGroupOpened(TopComponentGroupImpl paramTopComponentGroupImpl)
  {
    return model.isGroupOpened(paramTopComponentGroupImpl);
  }
  
  public void openGroup(TopComponentGroupImpl paramTopComponentGroupImpl)
  {
    if (isGroupOpened(paramTopComponentGroupImpl)) {
      return;
    }
    if ((isEditorMaximized()) && (isViewMaximized())) {
      switchMaximizedMode(null);
    }
    HashSet localHashSet = new HashSet();
    Set localSet = paramTopComponentGroupImpl.getTopComponents();
    for (Object localObject1 = localSet.iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (TopComponent)((Iterator)localObject1).next();
      if (((TopComponent)localObject2).isOpened()) {
        localHashSet.add(localObject2);
      }
    }
    localSet = paramTopComponentGroupImpl.getOpeningSet();
    localObject1 = new HashSet(localSet.size());
    Object localObject2 = new ArrayList();
    for (Iterator localIterator = localSet.iterator(); localIterator.hasNext();)
    {
      localObject3 = (TopComponent)localIterator.next();
      if (!((TopComponent)localObject3).isOpened())
      {
        localObject4 = WindowManagerImpl.getInstance();
        ModeImpl localModeImpl = (ModeImpl)((WindowManagerImpl)localObject4).findMode((TopComponent)localObject3);
        if (localModeImpl == null) {
          localModeImpl = ((WindowManagerImpl)localObject4).getDefaultViewMode();
        } else if (localModeImpl.getOpenedTopComponentsIDs().isEmpty()) {
          ((HashSet)localObject1).add(localModeImpl);
        }
        model.addModeOpenedTopComponent(localModeImpl, (TopComponent)localObject3);
        if (((TopComponent)localObject3).getClientProperty(GROUP_SELECTED) != null) {
          ((TopComponent)localObject3).requestVisible();
        }
        if ((isEditorMaximized()) && (localModeImpl.getState() != 1))
        {
          String str = ((WindowManagerImpl)localObject4).findTopComponentID((TopComponent)localObject3);
          if ((!isTopComponentDockedInMaximizedMode(str)) && (localModeImpl.getKind() != 2)) {
            slide((TopComponent)localObject3, localModeImpl, getSlideSideForMode(localModeImpl));
          }
        }
        ((List)localObject2).add(localObject3);
      }
    }
    Object localObject3;
    Object localObject4;
    model.openGroup(paramTopComponentGroupImpl, new HashSet((Collection)localObject2), localHashSet);
    for (localIterator = ((HashSet)localObject1).iterator(); localIterator.hasNext();)
    {
      localObject3 = (ModeImpl)localIterator.next();
      localObject4 = ((ModeImpl)localObject3).getPreviousSelectedTopComponent();
      if (null != localObject4) {
        ((ModeImpl)localObject3).setSelectedTopComponent((TopComponent)localObject4);
      }
    }
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(paramTopComponentGroupImpl, 42, null, ((List)localObject2).toArray(new TopComponent[0])));
    }
    for (localIterator = ((List)localObject2).iterator(); localIterator.hasNext();)
    {
      localObject3 = (TopComponent)localIterator.next();
      WindowManagerImpl.getInstance().notifyTopComponentOpened((TopComponent)localObject3);
    }
  }
  
  private static final Object GROUP_SELECTED = new Object();
  
  public void closeGroup(TopComponentGroupImpl paramTopComponentGroupImpl)
  {
    if (!isGroupOpened(paramTopComponentGroupImpl)) {
      return;
    }
    Set localSet1 = paramTopComponentGroupImpl.getClosingSet();
    ArrayList localArrayList = new ArrayList();
    
    Set localSet2 = model.getGroupOpenedTopComponents(paramTopComponentGroupImpl);
    
    Set localSet3 = model.getGroupOpenedBeforeTopComponents(paramTopComponentGroupImpl);
    for (Object localObject1 = model.getGroupTopComponents(paramTopComponentGroupImpl).iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (TopComponent)((Iterator)localObject1).next();
      boolean bool1 = localSet3.contains(localObject2);
      boolean bool2 = localSet2.contains(localObject2);
      if (((TopComponent)localObject2).isOpened())
      {
        if ((!bool1) && (!bool2)) {
          model.addGroupOpeningTopComponent(paramTopComponentGroupImpl, (TopComponent)localObject2);
        }
      }
      else if ((bool1) || (bool2)) {
        model.removeGroupOpeningTopComponent(paramTopComponentGroupImpl, (TopComponent)localObject2);
      }
    }
    localObject1 = new ArrayList(localSet1.size());
    for (Object localObject2 = localSet1.iterator(); ((Iterator)localObject2).hasNext();)
    {
      localObject3 = (TopComponent)((Iterator)localObject2).next();
      if ((((TopComponent)localObject3).isOpened()) && (!localSet3.contains(localObject3)))
      {
        localObject4 = (ModeImpl)WindowManagerImpl.getInstance().findMode((TopComponent)localObject3);
        if (null != localObject4) {
          ((ArrayList)localObject1).add(localObject4);
        }
      }
    }
    Object localObject3;
    Object localObject4;
    for (localObject2 = ((ArrayList)localObject1).iterator(); ((Iterator)localObject2).hasNext();)
    {
      localObject3 = (ModeImpl)((Iterator)localObject2).next();
      localObject4 = ((ModeImpl)localObject3).getSelectedTopComponent();
      if (null != localObject4)
      {
        localObject5 = WindowManagerImpl.getInstance().findTopComponentID((TopComponent)localObject4);
        if (null != localObject5) {
          setModePreviousSelectedTopComponentID((ModeImpl)localObject3, (String)localObject5);
        }
      }
    }
    Object localObject5;
    for (localObject2 = localSet1.iterator(); ((Iterator)localObject2).hasNext();)
    {
      localObject3 = (TopComponent)((Iterator)localObject2).next();
      if (((TopComponent)localObject3).isOpened()) {
        if (!localSet3.contains(localObject3))
        {
          int i = 0;
          for (localObject5 = model.getTopComponentGroups().iterator(); ((Iterator)localObject5).hasNext();)
          {
            TopComponentGroupImpl localTopComponentGroupImpl = (TopComponentGroupImpl)((Iterator)localObject5).next();
            if (localTopComponentGroupImpl != paramTopComponentGroupImpl) {
              if ((localTopComponentGroupImpl.isOpened()) && (localTopComponentGroupImpl.getOpeningSet().contains(localObject3)))
              {
                i = 1;
                break;
              }
            }
          }
          if (i == 0)
          {
            localObject5 = (ModeImpl)WindowManagerImpl.getInstance().findMode((TopComponent)localObject3);
            if (localObject5 != null)
            {
              if (((ModeImpl)localObject5).getSelectedTopComponent() == localObject3) {
                ((TopComponent)localObject3).putClientProperty(GROUP_SELECTED, Boolean.TRUE);
              } else {
                ((TopComponent)localObject3).putClientProperty(GROUP_SELECTED, null);
              }
              if (PersistenceHandler.isTopComponentPersistentWhenClosed((TopComponent)localObject3)) {
                model.addModeClosedTopComponent((ModeImpl)localObject5, (TopComponent)localObject3);
              } else if (Boolean.TRUE.equals(((TopComponent)localObject3).getClientProperty("KeepNonPersistentTCInModelWhenClosed"))) {
                model.addModeClosedTopComponent((ModeImpl)localObject5, (TopComponent)localObject3);
              } else {
                model.removeModeTopComponent((ModeImpl)localObject5, (TopComponent)localObject3, null);
              }
              localArrayList.add(localObject3);
            }
          }
        }
      }
    }
    model.closeGroup(paramTopComponentGroupImpl);
    if (isVisible()) {
      viewRequestor.scheduleRequest(new ViewRequest(paramTopComponentGroupImpl, 43, null, localArrayList.toArray(new TopComponent[0])));
    }
    for (localObject2 = localArrayList.iterator(); ((Iterator)localObject2).hasNext();)
    {
      localObject3 = (TopComponent)((Iterator)localObject2).next();
      WindowManagerImpl.getInstance().notifyTopComponentClosed((TopComponent)localObject3);
    }
  }
  
  public void addTopComponentGroup(TopComponentGroupImpl paramTopComponentGroupImpl)
  {
    model.addTopComponentGroup(paramTopComponentGroupImpl);
  }
  
  public void removeTopComponentGroup(TopComponentGroupImpl paramTopComponentGroupImpl)
  {
    model.removeTopComponentGroup(paramTopComponentGroupImpl);
  }
  
  public boolean addGroupUnloadedTopComponent(TopComponentGroupImpl paramTopComponentGroupImpl, String paramString)
  {
    return model.addGroupUnloadedTopComponent(paramTopComponentGroupImpl, paramString);
  }
  
  public boolean removeGroupUnloadedTopComponent(TopComponentGroupImpl paramTopComponentGroupImpl, String paramString)
  {
    return model.removeGroupUnloadedTopComponent(paramTopComponentGroupImpl, paramString);
  }
  
  public boolean addGroupUnloadedOpeningTopComponent(TopComponentGroupImpl paramTopComponentGroupImpl, String paramString)
  {
    return model.addGroupUnloadedOpeningTopComponent(paramTopComponentGroupImpl, paramString);
  }
  
  public boolean removeGroupUnloadedOpeningTopComponent(TopComponentGroupImpl paramTopComponentGroupImpl, String paramString)
  {
    return model.removeGroupUnloadedOpeningTopComponent(paramTopComponentGroupImpl, paramString);
  }
  
  public boolean addGroupUnloadedClosingTopComponent(TopComponentGroupImpl paramTopComponentGroupImpl, String paramString)
  {
    return model.addGroupUnloadedClosingTopComponent(paramTopComponentGroupImpl, paramString);
  }
  
  public boolean removeGroupUnloadedClosingTopComponent(TopComponentGroupImpl paramTopComponentGroupImpl, String paramString)
  {
    return model.removeGroupUnlo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd