org-netbeans-modules-autoupdate-ui

amOperationContainer.canBeAdded(paramUpdateUnit, paramUpdateElement);
    }
    
    public Installed(UpdateUnit paramUpdateUnit, String paramString)
    {
      super();
      updateUnit = paramUpdateUnit;
      if ((paramUpdateUnit.getInstalled() == null) && (paramUpdateUnit.isPending()))
      {
        installEl = ((UpdateElement)paramUpdateUnit.getAvailableUpdates().get(0));
        if ((!$assertionsDisabled) && (installEl == null)) {
          throw new AssertionError("Pending UpdateUnit " + paramUpdateUnit + " has UpdateElement for update.");
        }
      }
      else
      {
        installEl = paramUpdateUnit.getInstalled();
        assert (installEl != null) : ("Installed UpdateUnit " + paramUpdateUnit + " has Installed UpdateElement.");
      }
      backupEl = paramUpdateUnit.getBackup();
      OperationContainer localOperationContainer = null;
      if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType()) {
        localOperationContainer = Containers.forCustomUninstall();
      } else {
        localOperationContainer = Containers.forUninstall();
      }
      uninstallationAllowed = isOperationAllowed(updateUnit, installEl, localOperationContainer);
      deactivationAllowed = isOperationAllowed(updateUnit, installEl, Containers.forDisable());
      activationAllowed = isOperationAllowed(updateUnit, installEl, Containers.forEnable());
      
      initState();
    }
    
    public boolean isUninstallAllowed()
    {
      return uninstallationAllowed;
    }
    
    public boolean isDeactivationAllowed()
    {
      return deactivationAllowed;
    }
    
    public boolean isActivationAllowed()
    {
      return activationAllowed;
    }
    
    public boolean isMarked()
    {
      OperationContainer localOperationContainer = null;
      if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType()) {
        localOperationContainer = Containers.forCustomUninstall();
      } else {
        localOperationContainer = Containers.forUninstall();
      }
      boolean bool1 = localOperationContainer.contains(installEl);
      boolean bool2 = Containers.forDisable().contains(installEl);
      boolean bool3 = Containers.forEnable().contains(installEl);
      return (bool2) || (bool1) || (bool3);
    }
    
    public void setMarked(boolean paramBoolean)
    {
      assert (paramBoolean != isMarked());
      OperationContainer localOperationContainer;
      if (isUninstallAllowed())
      {
        localOperationContainer = null;
        if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType()) {
          localOperationContainer = Containers.forCustomUninstall();
        } else {
          localOperationContainer = Containers.forUninstall();
        }
        if (paramBoolean) {
          localOperationContainer.add(updateUnit, installEl);
        } else {
          localOperationContainer.remove(installEl);
        }
      }
      if (isDeactivationAllowed())
      {
        localOperationContainer = Containers.forDisable();
        if (paramBoolean) {
          localOperationContainer.add(updateUnit, installEl);
        } else {
          localOperationContainer.remove(installEl);
        }
      }
      else if (isActivationAllowed())
      {
        localOperationContainer = Containers.forEnable();
        if (paramBoolean) {
          localOperationContainer.add(updateUnit, installEl);
        } else {
          localOperationContainer.remove(installEl);
        }
      }
    }
    
    public static int compareEnabledState(Unit paramUnit1, Unit paramUnit2)
    {
      if (((paramUnit1 instanceof Installed)) && ((paramUnit2 instanceof Installed)))
      {
        Installed localInstalled1 = (Installed)paramUnit1;
        Installed localInstalled2 = (Installed)paramUnit2;
        int i = Boolean.valueOf(localInstalled1.getRelevantElement().isEnabled()).compareTo(Boolean.valueOf(localInstalled2.getRelevantElement().isEnabled()));
        return i == 0 ? Boolean.valueOf(updateUnit.isPending()).compareTo(Boolean.valueOf(updateUnit.isPending())) : i;
      }
      return Unit.compareDisplayVersions(paramUnit1, paramUnit2);
    }
    
    public static int compareInstalledVersions(Unit paramUnit1, Unit paramUnit2)
    {
      if (((paramUnit1 instanceof Installed)) && ((paramUnit2 instanceof Installed)))
      {
        Installed localInstalled1 = (Installed)paramUnit1;
        Installed localInstalled2 = (Installed)paramUnit2;
        if (localInstalled1.getInstalledVersion() == null)
        {
          if (localInstalled2.getInstalledVersion() == null) {
            return 0;
          }
          return -1;
        }
        if (localInstalled2.getInstalledVersion() == null) {
          return 1;
        }
        return new SpecificationVersion(localInstalled1.getInstalledVersion()).compareTo(new SpecificationVersion(localInstalled2.getInstalledVersion()));
      }
      return Unit.compareDisplayVersions(paramUnit1, paramUnit2);
    }
    
    public boolean canBeMarked()
    {
      return (super.canBeMarked()) && ((isDeactivationAllowed()) || (isUninstallAllowed()) || (isActivationAllowed()));
    }
    
    public String getInstalledVersion()
    {
      return installEl.getSpecificationVersion();
    }
    
    public String getBackupVersion()
    {
      return backupEl == null ? "-" : backupEl.getSpecificationVersion();
    }
    
    public Integer getMyRating()
    {
      return null;
    }
    
    public UpdateElement getRelevantElement()
    {
      return installEl;
    }
    
    public int getCompleteSize()
    {
      return -1;
    }
    
    public UnitCategoryTableModel.Type getModelType()
    {
      return UnitCategoryTableModel.Type.INSTALLED;
    }
  }
  
  public static class InternalUpdate
    extends Unit.Update
  {
    private List<UpdateUnit> internalUpdates;
    
    public InternalUpdate(UpdateUnit paramUpdateUnit, String paramString, boolean paramBoolean)
    {
      super(false, paramString);
    }
    
    public List<UpdateUnit> getUpdateUnits()
    {
      if (internalUpdates == null) {
        internalUpdates = new ArrayList();
      }
      return internalUpdates;
    }
    
    public UpdateUnit getVisibleUnit()
    {
      return updateUnit;
    }
    
    public UpdateElement getRelevantElement()
    {
      return updateUnit.getInstalled();
    }
    
    public boolean isMarked()
    {
      OperationContainer localOperationContainer = Containers.forUpdate();
      for (UpdateUnit localUpdateUnit : getUpdateUnits()) {
        if (!localOperationContainer.contains((UpdateElement)localUpdateUnit.getAvailableUpdates().get(0))) {
          return false;
        }
      }
      return true;
    }
    
    public String getAvailableVersion()
    {
      return getInstalledVersion() + " " + Unit.getBundle("Unit_InternalUpdates_Version");
    }
    
    public void setMarked(boolean paramBoolean)
    {
      assert (paramBoolean != isMarked());
      OperationContainer localOperationContainer = Containers.forUpdate();
      for (UpdateUnit localUpdateUnit : getUpdateUnits()) {
        if (paramBoolean)
        {
          if (localOperationContainer.canBeAdded(localUpdateUnit, (UpdateElement)localUpdateUnit.getAvailableUpdates().get(0))) {
            localOperationContainer.add(localUpdateUnit, (UpdateElement)localUpdateUnit.getAvailableUpdates().get(0));
          }
        }
        else {
          localOperationContainer.remove((UpdateElement)localUpdateUnit.getAvailableUpdates().get(0));
        }
      }
    }
    
    public int getCompleteSize()
    {
      if (size == -1)
      {
        size = 0;
        for (UpdateUnit localUpdateUnit : getUpdateUnits()) {
          size += ((UpdateElement)localUpdateUnit.getAvailableUpdates().get(0)).getDownloadSize();
        }
      }
      return size;
    }
    
    public String getSize()
    {
      return Utilities.getDownloadSizeAsString(getCompleteSize());
    }
    
    public UnitCategoryTableModel.Type getModelType()
    {
      return UnitCategoryTableModel.Type.UPDATE;
    }
  }
  
  public static class Update
    extends Unit
  {
    private UpdateElement installEl = null;
    private UpdateElement updateEl = null;
    private boolean isNbms;
    protected int size = -1;
    
    public Update(UpdateUnit paramUpdateUnit, boolean paramBoolean, String paramString)
    {
      super();
      isNbms = paramBoolean;
      updateUnit = paramUpdateUnit;
      installEl = paramUpdateUnit.getInstalled();
      assert (installEl != null) : ("Updateable UpdateUnit " + paramUpdateUnit + " has Installed UpdateElement.");
      if (paramUpdateUnit.getAvailableUpdates().size() > 0)
      {
        updateEl = ((UpdateElement)paramUpdateUnit.getAvailableUpdates().get(0));
        assert (updateEl != null) : ("Updateable UpdateUnit " + paramUpdateUnit + " has UpdateElement for update.");
      }
      initState();
    }
    
    public boolean isMarked()
    {
      OperationContainer localOperationContainer = null;
      if (isNbms) {
        localOperationContainer = Containers.forUpdateNbms();
      } else if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType()) {
        localOperationContainer = Containers.forCustomInstall();
      } else {
        localOperationContainer = Containers.forUpdate();
      }
      return localOperationContainer.contains(updateEl);
    }
    
    public void setMarked(boolean paramBoolean)
    {
      assert (paramBoolean != isMarked());
      OperationContainer localOperationContainer = null;
      if (isNbms) {
        localOperationContainer = Containers.forUpdateNbms();
      } else if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType()) {
        localOperationContainer = Containers.forCustomInstall();
      } else {
        localOperationContainer = Containers.forUpdate();
      }
      if (paramBoolean) {
        localOperationContainer.add(updateUnit, updateEl);
      } else {
        localOperationContainer.remove(updateEl);
      }
    }
    
    public static int compareInstalledVersions(Unit paramUnit1, Unit paramUnit2)
    {
      if (((paramUnit1 instanceof Update)) && ((paramUnit2 instanceof Update)))
      {
        Update localUpdate1 = (Update)paramUnit1;
        Update localUpdate2 = (Update)paramUnit2;
        return new SpecificationVersion(localUpdate1.getInstalledVersion()).compareTo(new SpecificationVersion(localUpdate2.getInstalledVersion()));
      }
      return Unit.compareDisplayVersions(paramUnit1, paramUnit2);
    }
    
    public static int compareAvailableVersions(Unit paramUnit1, Unit paramUnit2)
    {
      if (((paramUnit1 instanceof Update)) && ((paramUnit2 instanceof Update)))
      {
        Update localUpdate1 = (Update)paramUnit1;
        Update localUpdate2 = (Update)paramUnit2;
        return new SpecificationVersion(localUpdate1.getAvailableVersion()).compareTo(new SpecificationVersion(localUpdate2.getAvailableVersion()));
      }
      return Unit.compareDisplayVersions(paramUnit1, paramUnit2);
    }
    
    public String getInstalledVersion()
    {
      return installEl.getSpecificationVersion();
    }
    
    public String getAvailableVersion()
    {
      return updateEl.getSpecificationVersion();
    }
    
    public String getSize()
    {
      return Utilities.getDownloadSizeAsString(updateEl.getDownloadSize());
    }
    
    public UpdateElement getRelevantElement()
    {
      return updateEl;
    }
    
    public int getCompleteSize()
    {
      if (size == -1)
      {
        size = 0;
        OperationContainer localOperationContainer = OperationContainer.createForDirectUpdate();
        OperationContainer.OperationInfo localOperationInfo = localOperationContainer.add(getRelevantElement());
        Set localSet = localOperationInfo.getRequiredElements();
        for (UpdateElement localUpdateElement : localSet) {
          size += localUpdateElement.getDownloadSize();
        }
        size += getRelevantElement().getDownloadSize();
        localOperationContainer.removeAll();
      }
      return size;
    }
    
    public UnitCategoryTableModel.Type getModelType()
    {
      return isNbms ? UnitCategoryTableModel.Type.LOCAL : UnitCategoryTableModel.Type.UPDATE;
    }
  }
  
  public static class Available
    extends Unit
  {
    private UpdateElement updateEl = null;
    private boolean isNbms;
    private int size = -1;
    
    public Available(UpdateUnit paramUpdateUnit, boolean paramBoolean, String paramString)
    {
      super();
      isNbms = paramBoolean;
      updateUnit = paramUpdateUnit;
      updateEl = ((UpdateElement)paramUpdateUnit.getAvailableUpdates().get(0));
      assert (updateEl != null) : ("Updateable UpdateUnit " + paramUpdateUnit + " has UpdateElement for update.");
      initState();
    }
    
    public boolean isMarked()
    {
      OperationContainer localOperationContainer = null;
      if (isNbms) {
        localOperationContainer = Containers.forAvailableNbms();
      } else if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType()) {
        localOperationContainer = Containers.forCustomInstall();
      } else {
        localOperationContainer = Containers.forAvailable();
      }
      return localOperationContainer.contains(updateEl);
    }
    
    public void setMarked(boolean paramBoolean)
    {
      assert (paramBoolean != isMarked());
      OperationContainer localOperationContainer = null;
      if (isNbms) {
        localOperationContainer = Containers.forAvailableNbms();
      } else if (UpdateManager.TYPE.CUSTOM_HANDLED_COMPONENT == updateUnit.getType()) {
        localOperationContainer = Containers.forCustomInstall();
      } else {
        localOperationContainer = Containers.forAvailable();
      }
      if (paramBoolean) {
        localOperationContainer.add(updateUnit, updateEl);
      } else {
        localOperationContainer.remove(updateEl);
      }
    }
    
    public static int compareAvailableVersion(Unit paramUnit1, Unit paramUnit2)
    {
      if (((paramUnit1 instanceof Available)) && ((paramUnit2 instanceof Available)))
      {
        Available localAvailable1 = (Available)paramUnit1;
        Available localAvailable2 = (Available)paramUnit2;
        return new SpecificationVersion(localAvailable1.getAvailableVersion()).compareTo(new SpecificationVersion(localAvailable2.getAvailableVersion()));
      }
      return Unit.compareDisplayVersions(paramUnit1, paramUnit2);
    }
    
    public static int compareSourceCategories(Unit paramUnit1, Unit paramUnit2)
    {
      if (((paramUnit1 instanceof Available)) && ((paramUnit2 instanceof Available)))
      {
        Available localAvailable1 = (Available)paramUnit1;
        Available localAvailable2 = (Available)paramUnit2;
        return Collator.getInstance().compare(localAvailable1.getSourceCategory().name(), localAvailable2.getSourceCategory().name());
      }
      throw new IllegalStateException();
    }
    
    public String getAvailableVersion()
    {
      return updateEl.getSpecificationVersion();
    }
    
    public Integer getMyRating()
    {
      return null;
    }
    
    public String getSize()
    {
      return Utilities.getDownloadSizeAsString(updateEl.getDownloadSize());
    }
    
    public UpdateElement getRelevantElement()
    {
      return updateEl;
    }
    
    public int getCompleteSize()
    {
      if (size == -1)
      {
        size = 0;
        OperationContainer localOperationContainer = OperationContainer.createForDirectInstall();
        OperationContainer.OperationInfo localOperationInfo = localOperationContainer.add(getRelevantElement());
        Set localSet = localOperationInfo.getRequiredElements();
        for (UpdateElement localUpdateElement : localSet) {
          size += localUpdateElement.getDownloadSize();
        }
        size += getRelevantElement().getDownloadSize();
        localOperationContainer.removeAll();
      }
      return size;
    }
    
    public UnitCategoryTableModel.Type getModelType()
    {
      return isNbms ? UnitCategoryTableModel.Type.LOCAL : UnitCategoryTableModel.Type.AVAILABLE;
    }
    
    public UpdateUnitProvider.CATEGORY getSourceCategory()
    {
      return updateEl.getSourceCategory();
    }
  }
  
  private static String getBundle(String paramString)
  {
    return NbBundle.getMessage(Unit.class, paramString);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.Unit
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.util.ArrayList;
import java.util.List;

public class UnitCategory
{
  final String name;
  boolean isExpanded = true;
  List<Unit> units = new ArrayList();
  private boolean isVisible;
  private String filter;
  
  public UnitCategory(String paramString)
  {
    name = (paramString != null ? paramString : "");
  }
  
  public UnitCategory(String paramString, List<Unit> paramList, boolean paramBoolean)
  {
    name = paramString;
    units.addAll(paramList);
    isExpanded = paramBoolean;
  }
  
  public final boolean isVisible(String paramString)
  {
    assert (paramString != null);
    assert (getCategoryName() != null);
    if ((filter != null) && (filter.equals(paramString))) {
      return isVisible;
    }
    filter = paramString;
    isVisible = ((paramString.length() == 0) || (getCategoryName().toLowerCase().contains(paramString)));
    if (!isVisible)
    {
      List localList = getUnits();
      for (Unit localUnit : localList) {
        if (localUnit.isVisible(paramString))
        {
          isVisible = true;
          break;
        }
      }
    }
    return isVisible;
  }
  
  public List<Unit> getVisibleUnits(String paramString, boolean paramBoolean)
  {
    int i = (paramString.length() == 0) || (getCategoryName().toLowerCase().contains(paramString)) ? 1 : 0;
    List localList = getUnits();
    ArrayList localArrayList = i != 0 ? new ArrayList(localList) : new ArrayList();
    if (i == 0) {
      for (Unit localUnit : localList) {
        if ((localUnit.isVisible(paramString)) || ((paramBoolean) && (localUnit.isMarked()))) {
          localArrayList.add(localUnit);
        }
      }
    }
    return localArrayList;
  }
  
  public List<Unit> getMarkedUnits()
  {
    ArrayList localArrayList = new ArrayList();
    List localList = getUnits();
    for (Unit localUnit : localList) {
      if (localUnit.isMarked()) {
        localArrayList.add(localUnit);
      }
    }
    return localArrayList;
  }
  
  public String getCategoryName()
  {
    return name;
  }
  
  public boolean isExpanded()
  {
    return isExpanded;
  }
  
  public void setExpanded(boolean paramBoolean)
  {
    isExpanded = paramBoolean;
  }
  
  public boolean addUnit(Unit paramUnit)
  {
    return units.add(paramUnit);
  }
  
  public void addUnits(List<Unit> paramList)
  {
    for (Unit localUnit : paramList) {
      addUnit(localUnit);
    }
  }
  
  public boolean removeUnit(Unit paramUnit)
  {
    return units.remove(paramUnit);
  }
  
  public List<Unit> getUnits()
  {
    return units;
  }
  
  void toggleExpanded()
  {
    isExpanded = (!isExpanded);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitCategory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.util.Comparator;

class UnitCategoryTableModel$1
  implements Comparator<Unit>
{
  UnitCategoryTableModel$1(UnitCategoryTableModel paramUnitCategoryTableModel) {}
  
  public int compare(Unit paramUnit1, Unit paramUnit2)
  {
    return Unit.compareCategories(paramUnit1, paramUnit2);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitCategoryTableModel.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

class UnitCategoryTableModel$2
  implements Runnable
{
  UnitCategoryTableModel$2(UnitCategoryTableModel paramUnitCategoryTableModel, String paramString, Runnable paramRunnable) {}
  
  public void run()
  {
    synchronized (UnitCategoryTableModel.class)
    {
      UnitCategoryTableModel.access$002(this$0, val$filter.toLowerCase());
    }
    UnitCategoryTableModel.access$100(this$0);
    this$0.fireFilterChange();
    if (val$runAfterwards != null) {
      val$runAfterwards.run();
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitCategoryTableModel.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

class UnitCategoryTableModel$3 {}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitCategoryTableModel.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

public enum UnitCategoryTableModel$Type
{
  INSTALLED,  UPDATE,  AVAILABLE,  LOCAL;
  
  private UnitCategoryTableModel$Type() {}
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitCategoryTableModel.Type
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.prefs.Preferences;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.JTableHeader;
import org.netbeans.api.autoupdate.UpdateManager.TYPE;
import org.netbeans.api.autoupdate.UpdateUnit;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
import org.openide.util.RequestProcessor.Task;

public abstract class UnitCategoryTableModel
  extends AbstractTableModel
{
  private static final String EXPAND_STATE = "ExpandState";
  private List<Unit> unitData = Collections.emptyList();
  private List<Unit> featuretData = Collections.emptyList();
  private List<Unit> standAloneModules = Collections.emptyList();
  private List<UpdateUnitListener> listeners = new ArrayList();
  private String filter = "";
  private Comparator<Unit> unitCmp;
  private Boolean isExpanded = null;
  
  public static enum Type
  {
    INSTALLED,  UPDATE,  AVAILABLE,  LOCAL;
    
    private Type() {}
  }
  
  List<Unit> getUnits()
  {
    return unitData;
  }
  
  boolean supportsTwoViews()
  {
    return false;
  }
  
  static Map<String, Boolean> captureState(List<Unit> paramList)
  {
    HashMap localHashMap = new HashMap();
    for (Unit localUnit : paramList) {
      localHashMap.put(updateUnit.getCodeName(), Boolean.valueOf(localUnit.isMarked()));
    }
    return localHashMap;
  }
  
  static void restoreState(List<Unit> paramList, Map<String, Boolean> paramMap, boolean paramBoolean)
  {
    for (Unit localUnit : paramList)
    {
      Boolean localBoolean = (Boolean)paramMap.get(updateUnit.getCodeName());
      if (localBoolean != null)
      {
        if ((localBoolean.booleanValue()) && (!localUnit.isMarked()) && (localUnit.canBeMarked())) {
          localUnit.setMarked(true);
        } else if ((!localBoolean.booleanValue()) && (localUnit.isMarked()) && (localUnit.canBeMarked())) {
          localUnit.setMarked(false);
        }
      }
      else if ((paramBoolean) && (!localUnit.isMarked()) && (localUnit.canBeMarked())) {
        localUnit.setMarked(true);
      }
    }
  }
  
  public static boolean isMarkedAsDefault(Type paramType)
  {
    return (paramType.equals(Type.LOCAL)) || (paramType.equals(Type.UPDATE));
  }
  
  protected final boolean isMarkedAsDefault()
  {
    return isMarkedAsDefault(getType());
  }
  
  public abstract Object getValueAt(int paramInt1, int paramInt2);
  
  public abstract Class getColumnClass(int paramInt);
  
  public abstract Type getType();
  
  public abstract boolean isSortAllowed(Object paramObject);
  
  public abstract int getDownloadSize();
  
  public abstract boolean needsRestart();
  
  protected abstract Comparator<Unit> getComparator(Object paramObject, boolean paramBoolean);
  
  public abstract void setUnits(List<UpdateUnit> paramList);
  
  public String getTabTooltipText()
  {
    return null;
  }
  
  public abstract String getTabTitle();
  
  public final String getDecoratedTabTitle()
  {
    int i = getItemCount();
    int j = getRawItemCount();
    String str1 = i == j ? String.valueOf(j) : NbBundle.getMessage(PluginManagerUI.class, "PluginManagerUI_Tabs_CountFormat", Integer.valueOf(i), Integer.valueOf(j));
    
    String str2 = NbBundle.getMessage(PluginManagerUI.class, "PluginManagerUI_Tabs_NameFormat", getTabTitle(), str1);
    return j == 0 ? getTabTitle() : str2;
  }
  
  public boolean canBePrimaryTab()
  {
    return true;
  }
  
  public abstract int getTabIndex();
  
  public boolean isTabEnabled()
  {
    return true;
  }
  
  public String getToolTipText(int paramInt1, int paramInt2)
  {
    String str = null;
    if (paramInt2 == 0) {
      str = getTooltipForCheckBox(paramInt1);
    } else if (paramInt2 == 1) {
      str = (String)getValueAt(paramInt1, 1);
    }
    return str;
  }
  
  public int getMinWidth(JTableHeader paramJTableHeader, int paramInt)
  {
    return getHeaderRectwidth;
  }
  
  public abstract int getPreferredWidth(JTableHeader paramJTableHeader, int paramInt);
  
  protected Comparator<Unit> getDefaultComparator()
  {
    new Comparator()
    {
      public int compare(Unit paramAnonymousUnit1, Unit paramAnonymousUnit2)
      {
        return Unit.compareCategories(paramAnonymousUnit1, paramAnonymousUnit2);
      }
    };
  }
  
  public final void sort(Object paramObject, boolean paramBoolean)
  {
    if (paramObject == null) {
      setUnitComparator(getDefaultComparator());
    } else {
      setUnitComparator(getComparator(paramObject, paramBoolean));
    }
    fireTableDataChanged();
  }
  
  private String getTooltipForCheckBox(int paramInt)
  {
    String str = null;
    switch (getType())
    {
    case INSTALLED: 
      str = "UnitTab_TooltipCheckBox_INSTALLED";
      break;
    case UPDATE: 
      str = "UnitTab_TooltipCheckBox_UPDATE";
      break;
    case AVAILABLE: 
      str = "UnitTab_TooltipCheckBox_AVAILABLE";
      break;
    case LOCAL: 
      str = "UnitTab_TooltipCheckBox_LOCAL";
    }
    return str != null ? NbBundle.getMessage(UnitCategoryTableModel.class, str, (String)getValueAt(paramInt, 1)) : null;
  }
  
  private final void setData(List<UnitCategory> paramList, Comparator<Unit> paramComparator)
  {
    unitCmp = (paramComparator != null ? paramComparator : getDefaultComparator());
    featuretData = null;
    if (paramList != null)
    {
      unitData = Collections.emptyList();
      unitData = new ArrayList();
      for (Iterator localIterator = paramList.iterator(); localIterator.hasNext();)
      {
        localObject = (UnitCategory)localIterator.next();
        unitData.addAll(((UnitCategory)localObject).getUnits());
      }
      Object localObject;
      standAloneModules = new ArrayList();
      for (localIterator = unitData.iterator(); localIterator.hasNext();)
      {
        localObject = (Unit)localIterator.next();
        if (UpdateManager.TYPE.STANDALONE_MODULE.equals(updateUnit.getType())) {
          standAloneModules.add(localObject);
        }
      }
      computeExtensionState();
    }
    else
    {
      assert (unitData != null);
    }
    if (paramComparator != null) {
      Collections.sort(unitData, paramComparator);
    }
    fireTableDataChanged();
  }
  
  private void computeExtensionState()
  {
    int i = (isExpandableType(getType())) && (!Utilities.modulesOnly()) && (!getVisibleUnits(getFeatureList(), getFilter(), false).isEmpty()) && (!getVisibleUnits(standAloneModules, getFilter(), false).isEmpty()) ? 1 : 0;
    if (i != 0) {
      isExpanded = Boolean.valueOf(NbPreferences.forModule(UnitCategoryTableModel.class).getBoolean("ExpandState", false));
    } else {
      isExpanded = null;
    }
  }
  
  public void setUnitComparator(Comparator<Unit> paramComparator)
  {
    setData(null, paramComparator);
  }
  
  public final void setData(List<UnitCategory> paramList)
  {
    setData(paramList, unitCmp);
  }
  
  public void setFilter(final String paramString, final Runnable paramRunnable)
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        synchronized (UnitCategoryTableModel.class)
        {
          filter = paramString.toLowerCase();
        }
        UnitCategoryTableModel.this.computeExtensionState();
        fireFilterChange();
        if (paramRunnable != null) {
          paramRunnable.run();
        }
      }
    });
  }
  
  public String getFilter()
  {
    synchronized (UnitCategoryTableModel.class)
    {
      return filter == null ? "" : filter;
    }
  }
  
  public void addUpdateUnitListener(UpdateUnitListener paramUpdateUnitListener)
  {
    listeners.add(paramUpdateUnitListener);
  }
  
  public void removeUpdateUnitListener(UpdateUnitListener paramUpdateUnitListener)
  {
    listeners.remove(paramUpdateUnitListener);
  }
  
  void fireUpdataUnitChange()
  {
    assert (listeners != null) : "UpdateUnitListener found.";
    for (UpdateUnitListener localUpdateUnitListener : listeners) {
      localUpdateUnitListener.updateUnitsChanged();
    }
  }
  
  void fireButtonsChange()
  {
    assert (listeners != null) : "UpdateUnitListener found.";
    for (UpdateUnitListener localUpdateUnitListener : listeners) {
      localUpdateUnitListener.buttonsChanged();
    }
  }
  
  void fireFilterChange()
  {
    assert (listeners != null) : "UpdateUnitListener found.";
    for (UpdateUnitListener localUpdateUnitListener : listeners) {
      localUpdateUnitListener.filterChanged();
    }
  }
  
  List<Unit> getVisibleUnits()
  {
    return getVisibleUnits(getUnits(), getFilter(), true);
  }
  
  private List<Unit> getVisibleUnits(List<Unit> paramList, String paramString, boolean paramBoolean)
  {
    ArrayList localArrayList = new ArrayList();
    for (Unit localUnit : paramList) {
      if (paramBoolean)
      {
        if ((localUnit.isVisible(paramString)) && ((!isExpandable()) || (isExpanded()) || (UpdateManager.TYPE.FEATURE.equals(updateUnit.getType())))) {
          localArrayList.add(localUnit);
        }
      }
      else if (localUnit.isVisible(paramString)) {
        localArrayList.add(localUnit);
      }
    }
    return localArrayList;
  }
  
  public int getRowCount()
  {
    int i = getVisibleUnits().size();
    return isExpansionControlPresent() ? i + 1 : i;
  }
  
  public int getRawItemCount()
  {
    return unitData.size();
  }
  
  public int getItemCount()
  {
    return getVisibleUnits().size();
  }
  
  public Collection<Unit> getMarkedUnits()
  {
    ArrayList localArrayList = new ArrayList();
    List localList = getUnits();
    for (Unit localUnit : localList) {
      if (localUnit.isMarked()) {
        localArrayList.add(localUnit);
      }
    }
    return localArrayList;
  }
  
  public Unit getUnitAtRow(int paramInt)
  {
    if (paramInt < 0) {
      return null;
    }
    List localList = getVisibleUnits();
    return localList.size() <= paramInt ? null : (Unit)localList.get(paramInt);
  }
  
  public boolean isExpansionControlAtRow(int paramInt)
  {
    return (paramInt + 1 == getRowCount()) && (isExpansionControlPresent());
  }
  
  public String getExpansionControlText()
  {
    assert (isExpansionControlPresent());
    String str = isExpanded() ? "Less_Command_Text" : "More_Command_Text";
    return NbBundle.getMessage(UnitCategoryTableModel.class, str, Integer.valueOf(getVisibleUnits(getStandAloneModules(), getFilter(), false).size()));
  }
  
  public boolean isExpandable()
  {
    return isExpanded != null;
  }
  
  public boolean isExpansionControlPresent()
  {
    return (isExpandable()) && (!getFeatureList().isEmpty()) && (!getVisibleUnits(getStandAloneModules(), getFilter(), false).isEmpty());
  }
  
  public void setExpanded(Boolean paramBoolean)
  {
    isExpanded = paramBoolean;
    featuretData = null;
    if (paramBoolean != null) {
      NbPreferences.forModule(UnitCategoryTableModel.class).putBoolean("ExpandState", paramBoolean.booleanValue());
    }
  }
  
  public boolean isExpanded()
  {
    boolean bool = isExpandable();
    if (bool) {
      bool = (isExpanded != null) && (isExpanded.booleanValue());
    }
    return bool;
  }
  
  public boolean isCollapsed()
  {
    boolean bool = isExpandable();
    if (bool) {
      bool = (isExpanded != null) && (!isExpanded.booleanValue());
    }
    return bool;
  }
  
  private List<Unit> getFeatureList()
  {
    if (featuretData == null)
    {
      featuretData = new ArrayList(unitData);
      featuretData.removeAll(getStandAloneModules());
      if (unitCmp != null) {
        Collections.sort(featuretData, unitCmp);
      }
    }
    return featuretData;
  }
  
  List<Unit> getStandAloneModules()
  {
    List localList = standAloneModules;
    if (localList == null) {
      localList = Collections.emptyList();
    }
    return localList;
  }
  
  public static boolean isExpandableType(Type paramType)
  {
    return (paramType.equals(Type.AVAILABLE)) || (paramType.equals(Type.UPDATE));
  }
  
  public boolean isCellEditable(int paramInt1, int paramInt2)
  {
    if (isExpansionControlAtRow(paramInt1)) {
      return false;
    }
    RequestProcessor.Task localTask = PluginManagerUI.getRunningTask();
    return ((localTask == null) || (localTask.isFinished())) && (paramInt2 == 0) && (Boolean.class.equals(getColumnClass(paramInt2)));
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitCategoryTableModel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

class UnitDetails$1$1
  implements Runnable
{
  UnitDetails$1$1(UnitDetails.1 param1, StringBuilder paramStringBuilder) {}
  
  public void run()
  {
    UnitDetails.access$100(this$1.this$0, this$1.val$u, val$text);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitDetails.1.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import javax.swing.SwingUtilities;

class UnitDetails$1
  implements Runnable
{
  UnitDetails$1(UnitDetails paramUnitDetails, Unit paramUnit) {}
  
  public void run()
  {
    final StringBuilder localStringBuilder = UnitDetails.access$000(this$0, val$u, true);
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        UnitDetails.access$100(this$0, val$u, localStringBuilder);
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitDetails.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.util.Comparator;
import org.netbeans.api.autoupdate.UpdateElement;

class UnitDetails$2
  implements Comparator<UpdateElement>
{
  UnitDetails$2(UnitDetails paramUnitDetails) {}
  
  public int compare(UpdateElement paramUpdateElement1, UpdateElement paramUpdateElement2)
  {
    return paramUpdateElement1.getDisplayName().compareTo(paramUpdateElement2.getDisplayName());
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.UnitDetails.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.autoupdate.ui;

import java.awt.Color;
import java.io.CharConversionException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.accessibility.AccessibleContext;
import javax.swing.Action;
import javax.swing.JEditorPane;
import javax.swing.SwingUtilities;
import org.netbeans.api.autoupdate.OperationContainer;
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
import org.netbeans.api.autoupdate.UpdateElement;
import org.netbeans.api.autoupdate.UpdateManager.TYPE;
import org.netbeans.api.autoupdate.UpdateUnit;
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY;
import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor;
import org.openide.util.RequestProcessor.Task;
import org.openide.xml.XMLUtil;

public class UnitDetails
  extends DetailsPanel
{
  private final Logger err = Logger.getLogger("org.netbeans.modules.autoupdate.ui.UnitDetails");
  private RequestProcessor.Task unitDetailsTask = null;
  private static final RequestProcessor UNIT_DETAILS_PROCESSOR = new RequestProcessor("unit-details-processor", 1, true);
  
  public UnitDetails()
  {
    getAccessibleContext().setAccessibleName(NbBundle.getMessage(UnitTable.class, "ACN_UnitDetails"));
  }
  
  public void setUnit(Unit paramUnit)
  {
    setUnit(paramUnit, null);
  }
  
  public void setUnit(final Unit paramUnit, Action paramAction)
  {
    if ((unitDetailsTask != null) && (!unitDetailsTask.isFinished())) {
      unitDetailsTask.cancel();
    }
    if (paramUnit == null)
    {
      getDetails().setText("<i>" + getBundle("UnitDetails_Category_NoDescription") + "</i>");
      setTitle(null);
    }
    else
    {
      try
      {
        setTitle(XMLUtil.toElementContent(paramUnit.getDisplayName()));
      }
      catch (CharConversionException localCharConversionException)
      {
        err.log(Level.INFO, null, localCharConversionException);
        return;
      }
      setActionListener(paramAction);
      setUnitText(paramUnit, getUnitText(paramUnit, false));
      if ((paramUnit instanceof Unit.Update)) {
        unitDetailsTask = UNIT_DETAILS_PROCESSOR.post(new Runnable()
        {
          public void run()
          {
            final StringBuilder localStringBuilder = UnitDetails.this.getUnitText(paramUnit, true);
            SwingUtilities.invokeLater(new Runnable()
            {
              public void run()
              {
                UnitDetails.this.setUnitText(val$u, localStringBuilder);
              }
            });
          }
        });
      }
    }
  }
  
  private void setUnitText(Unit paramUnit, StringBuilder paramStringBuilder)
  {
    getDetails().setText(paramStringBuilder.toString());
    setUnitHighlighing(paramUnit);
  }
  
  private StringBuilder getUnitText(Unit paramUnit, boolean paramBoolean)
  {
    StringBuilder localStringBuilder = new StringBuilder();
    Object localObject2;
    if ((paramUnit instanceof Unit.Available))
    {
      localObject1 = (Unit.Available)paramUnit;
      localObject2 = ((Unit.Available)localObject1).getSourceCategory();
      String str = Utilities.getCategoryName((UpdateUnitProvider.CATEGORY)localObject2);
      URL localURL = Utilities.getCategoryIcon((UpdateUnitProvider.CATEGORY)localObject2);
      localStringBuilder.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>");
      localStringBuilder.append("<td><img src=\"" + localURL.toExternalForm() + "\"></img></td>");
      localStringBuilder.append("<td>&nbsp;&nbsp;</td>");
      localStringBuilder.append("<td><b>" + str + "</b></td>");
      localStringBuilder.append("</tr></table><br>");
    }
    if ((Utilities.modulesOnly()) || (Utilities.showExtendedDescription()))
    {
      localStringBuilder.append("<b>" + getBundle("UnitDetails_Plugin_CodeName") + "</b>" + updateUnit.getCodeName());
      localStringBuilder.append("<br>");
    }
    Object localObject1 = null;
    if ((paramUnit instanceof Unit.Update))
    {
      localObject2 = (Unit.Update)paramUnit;
      localStringBuilder.append("<b>" + getBundle("UnitDetails_Plugin_InstalledVersion") + "</b>" + ((Unit.Update)localObject2).getInstalledVersion() + "<br>");
      localStringBuilder.append("<b>" + getBundle("UnitDetails_Plugin_
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

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