org-netbeans-modules-autoupdate-ui

ent(paramJTable, paramObject, paramBoolean1, paramBoolean2, paramInt1, paramInt2);
      if ((paramObject instanceof UpdateUnitProvider))
      {
        localObject = (UpdateUnitProvider)paramObject;
        UpdateUnitProvider.CATEGORY localCATEGORY = ((UpdateUnitProvider)localObject).getCategory();
        if (UpdateUnitProvider.CATEGORY.BETA.equals(localCATEGORY)) {
          localJLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/icon-beta.png", false));
        } else if (UpdateUnitProvider.CATEGORY.COMMUNITY.equals(localCATEGORY)) {
          localJLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/icon-community.png", false));
        } else if (UpdateUnitProvider.CATEGORY.STANDARD.equals(localCATEGORY)) {
          localJLabel.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/icon-standard.png", false));
        }
        localJLabel.setText(((UpdateUnitProvider)localObject).getDisplayName());
        localJLabel.setHorizontalAlignment(2);
      }
      Object localObject = localJLabel;
      return (Component)localObject;
    }
  }
}

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

import java.util.List;

class SettingsTableModel$1
  implements Runnable
{
  SettingsTableModel$1(SettingsTableModel paramSettingsTableModel, List paramList) {}
  
  public void run()
  {
    try
    {
      Utilities.presentRefreshProviders(val$forRefresh, this$0.getSettingsTab().getPluginManager(), true);
      this$0.getSettingsTab().getPluginManager().updateUnitsChanged();
    }
    finally
    {
      this$0.getSettingsTab().setWaitingState(false);
    }
  }
}

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

import java.text.Collator;
import java.util.Comparator;
import org.netbeans.api.autoupdate.UpdateUnitProvider;

final class SettingsTableModel$2
  implements Comparator<UpdateUnitProvider>
{
  Collator COLL = Collator.getInstance();
  
  public int compare(UpdateUnitProvider paramUpdateUnitProvider1, UpdateUnitProvider paramUpdateUnitProvider2)
  {
    return COLL.compare(paramUpdateUnitProvider1.getDisplayName(), paramUpdateUnitProvider2.getDisplayName());
  }
}

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

import java.net.URL;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
import javax.swing.table.AbstractTableModel;
import org.netbeans.api.autoupdate.UpdateUnitProvider;
import org.netbeans.api.autoupdate.UpdateUnitProviderFactory;
import org.openide.util.NbBundle;

public class SettingsTableModel
  extends AbstractTableModel
{
  private static final String[] COLUMN_NAME_KEYS = { "SettingsTable_ActiveColumn", "SettingsTable_NameColumn" };
  private static final Class[] COLUMN_TYPES = { Boolean.class, UpdateUnitProvider.class };
  private List<UpdateUnitProvider> updateProviders;
  private Set<String> originalProviders;
  private SettingsTab settingsTab = null;
  private final Logger logger = Logger.getLogger("org.netbeans.modules.autoupdate.ui.SettingsTableModel");
  
  public SettingsTableModel()
  {
    refreshModel();
  }
  
  void setSettingsTab(SettingsTab paramSettingsTab)
  {
    settingsTab = paramSettingsTab;
  }
  
  SettingsTab getSettingsTab()
  {
    return settingsTab;
  }
  
  void refreshModel()
  {
    Set localSet = originalProviders;
    HashSet localHashSet = new HashSet();
    final ArrayList localArrayList = new ArrayList();
    List localList = UpdateUnitProviderFactory.getDefault().getUpdateUnitProviders(false);
    for (Iterator localIterator = localList.iterator(); localIterator.hasNext();)
    {
      localUpdateUnitProvider = (UpdateUnitProvider)localIterator.next();
      if ((localSet != null) && (!localSet.contains(localUpdateUnitProvider.getName()))) {
        if (localUpdateUnitProvider.isEnabled()) {
          localArrayList.add(localUpdateUnitProvider);
        }
      }
      localHashSet.add(localUpdateUnitProvider.getName());
    }
    UpdateUnitProvider localUpdateUnitProvider;
    if (!localArrayList.isEmpty())
    {
      getSettingsTab().setWaitingState(true);
      Utilities.startAsWorkerThread(new Runnable()
      {
        public void run()
        {
          try
          {
            Utilities.presentRefreshProviders(localArrayList, getSettingsTab().getPluginManager(), true);
            getSettingsTab().getPluginManager().updateUnitsChanged();
          }
          finally
          {
            getSettingsTab().setWaitingState(false);
          }
        }
      });
    }
    if ((localSet != null) && (!localSet.isEmpty()) && (!localHashSet.containsAll(localSet))) {
      getSettingsTab().setNeedRefresh();
    }
    updateProviders = new ArrayList();
    for (localIterator = localList.iterator(); localIterator.hasNext();)
    {
      localUpdateUnitProvider = (UpdateUnitProvider)localIterator.next();
      if (localUpdateUnitProvider.getDisplayName() != null) {
        updateProviders.add(localUpdateUnitProvider);
      }
    }
    originalProviders = localHashSet;
    sortAlphabetically(updateProviders);
    fireTableDataChanged();
  }
  
  public void remove(int paramInt)
  {
    UpdateUnitProvider localUpdateUnitProvider = getUpdateUnitProvider(paramInt);
    if (localUpdateUnitProvider != null) {
      UpdateUnitProviderFactory.getDefault().remove(localUpdateUnitProvider);
    }
    getSettingsTab().setNeedRefresh();
  }
  
  public void add(String paramString1, String paramString2, URL paramURL, boolean paramBoolean)
  {
    UpdateUnitProvider localUpdateUnitProvider = UpdateUnitProviderFactory.getDefault().create(paramString1, paramString2, paramURL);
    localUpdateUnitProvider.setEnable(paramBoolean);
  }
  
  public UpdateUnitProvider getUpdateUnitProvider(int paramInt)
  {
    return (paramInt >= 0) && (paramInt < updateProviders.size()) ? (UpdateUnitProvider)updateProviders.get(paramInt) : null;
  }
  
  public boolean isCellEditable(int paramInt1, int paramInt2)
  {
    return paramInt2 == 0;
  }
  
  public int getRowCount()
  {
    return updateProviders.size();
  }
  
  public int getColumnCount()
  {
    return COLUMN_NAME_KEYS.length;
  }
  
  public void setValueAt(Object paramObject, int paramInt1, int paramInt2)
  {
    UpdateUnitProvider localUpdateUnitProvider = getUpdateUnitProvider(paramInt1);
    switch (paramInt2)
    {
    case 0: 
      boolean bool1 = localUpdateUnitProvider.isEnabled();
      boolean bool2 = ((Boolean)paramObject).booleanValue();
      if (bool1 != bool2)
      {
        localUpdateUnitProvider.setEnable(bool2);
        if (bool2) {
          getSettingsTab().refreshProvider(localUpdateUnitProvider, false);
        } else {
          getSettingsTab().setNeedRefresh();
        }
      }
      break;
    }
  }
  
  public Object getValueAt(int paramInt1, int paramInt2)
  {
    Object localObject = null;
    UpdateUnitProvider localUpdateUnitProvider = (UpdateUnitProvider)updateProviders.get(paramInt1);
    switch (paramInt2)
    {
    case 0: 
      localObject = Boolean.valueOf(localUpdateUnitProvider.isEnabled()); break;
    case 1: 
      localObject = localUpdateUnitProvider;
    }
    return localObject;
  }
  
  public Class<?> getColumnClass(int paramInt)
  {
    return COLUMN_TYPES[paramInt];
  }
  
  public String getColumnName(int paramInt)
  {
    return NbBundle.getMessage(SettingsTableModel.class, COLUMN_NAME_KEYS[paramInt]);
  }
  
  private static void sortAlphabetically(List<UpdateUnitProvider> paramList)
  {
    Collections.sort(paramList, new Comparator()
    {
      Collator COLL = Collator.getInstance();
      
      public int compare(UpdateUnitProvider paramAnonymousUpdateUnitProvider1, UpdateUnitProvider paramAnonymousUpdateUnitProvider2)
      {
        return COLL.compare(paramAnonymousUpdateUnitProvider1.getDisplayName(), paramAnonymousUpdateUnitProvider2.getDisplayName());
      }
    });
  }
}

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

import java.awt.Component;
import java.util.prefs.Preferences;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.plaf.UIResource;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import org.openide.util.ImageUtilities;
import org.openide.util.NbPreferences;

public class SortColumnHeaderRenderer
  implements TableCellRenderer, UIResource
{
  private UnitCategoryTableModel model;
  private TableCellRenderer textRenderer;
  private String sortColumn;
  private ImageIcon sortDescIcon;
  private static ImageIcon sortAscIcon;
  private boolean sortAscending;
  
  public SortColumnHeaderRenderer(UnitCategoryTableModel paramUnitCategoryTableModel, TableCellRenderer paramTableCellRenderer)
  {
    model = paramUnitCategoryTableModel;
    textRenderer = paramTableCellRenderer;
    sortColumn = getPreferences().get(keyForType("SortingColumn"), getDefaultColumnSelected());
    sortAscending = getPreferences().getBoolean(keyForType("SortAscending"), true);
    model.sort(sortColumn, sortAscending);
  }
  
  public Component getTableCellRendererComponent(JTable paramJTable, Object paramObject, boolean paramBoolean1, boolean paramBoolean2, int paramInt1, int paramInt2)
  {
    Component localComponent = textRenderer.getTableCellRendererComponent(paramJTable, paramObject, paramBoolean1, paramBoolean2, paramInt1, paramInt2);
    if ((localComponent instanceof JLabel))
    {
      JLabel localJLabel = (JLabel)localComponent;
      if (paramJTable.getColumnModel().getColumn(paramInt2).getIdentifier().equals(sortColumn))
      {
        localJLabel.setIcon(sortAscending ? getSortAscIcon() : getSortDescIcon());
        localJLabel.setHorizontalTextPosition(2);
      }
      else
      {
        localJLabel.setIcon(null);
      }
    }
    return localComponent;
  }
  
  public void setDefaultSorting()
  {
    setSorting(getDefaultColumnSelected());
  }
  
  private String getDefaultColumnSelected()
  {
    String str = null;
    str = model.getColumnName(2);
    return str;
  }
  
  public void setSorting(Object paramObject)
  {
    if (!paramObject.equals(sortColumn))
    {
      sortColumn = ((String)paramObject);
      sortAscending = true;
    }
    else
    {
      sortAscending = (!sortAscending);
    }
    getPreferences().put(keyForType("SortingColumn"), sortColumn);
    getPreferences().putBoolean(keyForType("SortAscending"), sortAscending);
    model.sort(paramObject, sortAscending);
  }
  
  private ImageIcon getSortAscIcon()
  {
    if (sortAscIcon == null) {
      sortAscIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/columnsSortedDesc.gif", false);
    }
    return sortAscIcon;
  }
  
  private ImageIcon getSortDescIcon()
  {
    if (sortDescIcon == null) {
      sortDescIcon = ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/columnsSortedAsc.gif", false);
    }
    return sortDescIcon;
  }
  
  private String keyForType(String paramString)
  {
    return paramString + model.getType();
  }
  
  private static Preferences getPreferences()
  {
    return NbPreferences.forModule(SortColumnHeaderRenderer.class);
  }
}

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

import java.util.Iterator;
import org.netbeans.api.autoupdate.UpdateUnit;

class Unit$1$1
  implements Iterator<String>
{
  int step = 0;
  
  Unit$1$1(Unit.1 param1) {}
  
  public boolean hasNext()
  {
    return step <= 7;
  }
  
  public String next()
  {
    String str = null;
    switch (step++)
    {
    case 0: 
      str = this$1.this$0.getDisplayName(); break;
    case 1: 
      str = this$1.this$0.getCategoryName(); break;
    case 2: 
      str = this$1.this$0.getDescription(); break;
    case 3: 
      str = this$1.this$0.updateUnit.getCodeName(); break;
    case 4: 
      str = this$1.this$0.getDisplayVersion(); break;
    case 5: 
      str = this$1.this$0.getAuthor(); break;
    case 6: 
      str = this$1.this$0.getHomepage(); break;
    case 7: 
      str = this$1.this$0.getSource();
    }
    return str != null ? str : "";
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException("Not supported yet.");
  }
}

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

import java.util.Iterator;
import org.netbeans.api.autoupdate.UpdateUnit;

class Unit$1
  implements Iterable<String>
{
  Unit$1(Unit paramUnit) {}
  
  public Iterator<String> iterator()
  {
    new Iterator()
    {
      int step = 0;
      
      public boolean hasNext()
      {
        return step <= 7;
      }
      
      public String next()
      {
        String str = null;
        switch (step++)
        {
        case 0: 
          str = this$0.getDisplayName(); break;
        case 1: 
          str = this$0.getCategoryName(); break;
        case 2: 
          str = this$0.getDescription(); break;
        case 3: 
          str = this$0.updateUnit.getCodeName(); break;
        case 4: 
          str = this$0.getDisplayVersion(); break;
        case 5: 
          str = this$0.getAuthor(); break;
        case 6: 
          str = this$0.getHomepage(); break;
        case 7: 
          str = this$0.getSource();
        }
        return str != null ? str : "";
      }
      
      public void remove()
      {
        throw new UnsupportedOperationException("Not supported yet.");
      }
    };
  }
}

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

import java.text.Collator;
import java.util.List;
import java.util.Set;
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.modules.SpecificationVersion;

public class Unit$Available
  extends Unit
{
  private UpdateElement updateEl = null;
  private boolean isNbms;
  private int size = -1;
  
  public Unit$Available(UpdateUnit paramUpdateUnit, boolean paramBoolean, String paramString)
  {
    super(paramString);
    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();
  }
}

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

import java.util.List;
import org.netbeans.api.autoupdate.OperationContainer;
import org.netbeans.api.autoupdate.OperationSupport;
import org.netbeans.api.autoupdate.UpdateElement;
import org.netbeans.api.autoupdate.UpdateManager.TYPE;
import org.netbeans.api.autoupdate.UpdateUnit;
import org.openide.modules.SpecificationVersion;

public class Unit$Installed
  extends Unit
{
  private UpdateElement installEl = null;
  private UpdateElement backupEl = null;
  private boolean uninstallationAllowed;
  private boolean deactivationAllowed;
  private boolean activationAllowed;
  
  public static boolean isOperationAllowed(UpdateUnit paramUpdateUnit, UpdateElement paramUpdateElement, OperationContainer<OperationSupport> paramOperationContainer)
  {
    return paramOperationContainer.canBeAdded(paramUpdateUnit, paramUpdateElement);
  }
  
  public Unit$Installed(UpdateUnit paramUpdateUnit, String paramString)
  {
    super(paramString);
    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;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.autoupdate.ui.Unit.Installed
 * 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;
import org.netbeans.api.autoupdate.OperationContainer;
import org.netbeans.api.autoupdate.UpdateElement;
import org.netbeans.api.autoupdate.UpdateUnit;

public class Unit$InternalUpdate
  extends Unit.Update
{
  private List<UpdateUnit> internalUpdates;
  
  public Unit$InternalUpdate(UpdateUnit paramUpdateUnit, String paramString, boolean paramBoolean)
  {
    super(paramUpdateUnit, 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.access$000("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;
  }
}

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

import java.util.List;
import java.util.Set;
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.openide.modules.SpecificationVersion;

public class Unit$Update
  extends Unit
{
  private UpdateElement installEl = null;
  private UpdateElement updateEl = null;
  private boolean isNbms;
  protected int size = -1;
  
  public Unit$Update(UpdateUnit paramUpdateUnit, boolean paramBoolean, String paramString)
  {
    super(paramString);
    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;
  }
}

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

import java.text.Collator;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.api.autoupdate.OperationContainer;
import org.netbeans.api.autoupdate.OperationContainer.OperationInfo;
import org.netbeans.api.autoupdate.OperationSupport;
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.modules.SpecificationVersion;
import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor.Task;

public abstract class Unit
{
  UpdateUnit updateUnit = null;
  private boolean isVisible;
  private String filter;
  private String categoryName;
  private static Logger log = Logger.getLogger(Unit.class.getName());
  private String displayDate = null;
  
  protected abstract UpdateElement getRelevantElement();
  
  public abstract boolean isMarked();
  
  public abstract void setMarked(boolean paramBoolean);
  
  public abstract int getCompleteSize();
  
  Unit(String paramString)
  {
    categoryName = paramString;
  }
  
  public abstract UnitCategoryTableModel.Type getModelType();
  
  public void initState()
  {
    if ((UnitCategoryTableModel.isMarkedAsDefault(getModelType())) && 
      (!isMarked()) && (canBeMarked())) {
      setMarked(true);
    }
  }
  
  public String getCategoryName()
  {
    return categoryName;
  }
  
  public boolean canBeMarked()
  {
    RequestProcessor.Task localTask = PluginManagerUI.getRunningTask();
    return (localTask == null) || (localTask.isFinished());
  }
  
  public String getDisplayName()
  {
    return getRelevantElement().getDisplayName();
  }
  
  public final boolean isVisible(String paramString)
  {
    if ((filter != null) && (filter.equals(paramString))) {
      return isVisible;
    }
    filter = paramString;
    Iterable localIterable = details();
    for (String str : localIterable)
    {
      isVisible = ((paramString.length() == 0) || (str.toLowerCase().contains(paramString)));
      if (isVisible) {
        break;
      }
    }
    return isVisible;
  }
  
  private Iterable<String> details()
  {
    Iterable local1 = new Iterable()
    {
      public Iterator<String> iterator()
      {
        new Iterator()
        {
          int step = 0;
          
          public boolean hasNext()
          {
            return step <= 7;
          }
          
          public String next()
          {
            String str = null;
            switch (step++)
            {
            case 0: 
              str = getDisplayName(); break;
            case 1: 
              str = getCategoryName(); break;
            case 2: 
              str = getDescription(); break;
            case 3: 
              str = updateUnit.getCodeName(); break;
            case 4: 
              str = getDisplayVersion(); break;
            case 5: 
              str = getAuthor(); break;
            case 6: 
              str = getHomepage(); break;
            case 7: 
              str = getSource();
            }
            return str != null ? str : "";
          }
          
          public void remove()
          {
            throw new UnsupportedOperationException("Not supported yet.");
          }
        };
      }
    };
    return local1;
  }
  
  public String getFilter()
  {
    return filter;
  }
  
  public String getDescription()
  {
    return getRelevantElement().getDescription();
  }
  
  public String getNotification()
  {
    return getRelevantElement().getNotification();
  }
  
  public String getAuthor()
  {
    return getRelevantElement().getAuthor();
  }
  
  public String getHomepage()
  {
    return getRelevantElement().getHomepage();
  }
  
  public String getSource()
  {
    return getRelevantElement().getSource();
  }
  
  public String getDisplayVersion()
  {
    return getRelevantElement().getSpecificationVersion();
  }
  
  public String getDisplayDate()
  {
    if (displayDate == null)
    {
      String str = getRelevantElement().getDate();
      if (str != null) {
        try
        {
          Date localDate = Utilities.DATE_FORMAT.parse(str);
          displayDate = DateFormat.getDateInstance(3, Locale.getDefault()).format(localDate);
        }
        catch (ParseException localParseException)
        {
          log.log(Level.INFO, "ParseException while parsing date " + str, localParseException);
        }
      }
    }
    return displayDate;
  }
  
  public static int compareDisplayNames(Unit paramUnit1, Unit paramUnit2)
  {
    return Utilities.getCategoryComparator().compare(paramUnit1.getDisplayName(), paramUnit2.getDisplayName());
  }
  
  public static int compareCategories(Unit paramUnit1, Unit paramUnit2)
  {
    return Utilities.getCategoryComparator().compare(paramUnit1.getCategoryName(), paramUnit2.getCategoryName());
  }
  
  public static int compareSimpleFormatDates(Unit paramUnit1, Unit paramUnit2)
  {
    if (paramUnit1.getRelevantElement().getDate() == null)
    {
      if (paramUnit2.getRelevantElement().getDate() == null) {
        return 0;
      }
      return -1;
    }
    if (paramUnit2.getRelevantElement().getDate() == null) {
      return 1;
    }
    Date localDate1;
    try
    {
      localDate1 = Utilities.DATE_FORMAT.parse(paramUnit1.getRelevantElement().getDate());
    }
    catch (ParseException localParseException1)
    {
      log.log(Level.INFO, "ParseException while parsing date " + paramUnit1.getRelevantElement().getDate(), localParseException1);
      return -1;
    }
    Date localDate2;
    try
    {
      localDate2 = Utilities.DATE_FORMAT.parse(paramUnit2.getRelevantElement().getDate());
    }
    catch (ParseException localParseException2)
    {
      log.log(Level.INFO, "ParseException while parsing date " + paramUnit2.getRelevantElement().getDate(), localParseException2);
      return 1;
    }
    return localDate1.compareTo(localDate2);
  }
  
  public static int compareDisplayVersions(Unit paramUnit1, Unit paramUnit2)
  {
    if (paramUnit1.getDisplayVersion() == null)
    {
      if (paramUnit2.getDisplayVersion() == null) {
        return 0;
      }
      return -1;
    }
    if (paramUnit2.getDisplayVersion() == null) {
      return 1;
    }
    return new SpecificationVersion(paramUnit1.getDisplayVersion()).compareTo(new SpecificationVersion(paramUnit2.getDisplayVersion()));
  }
  
  public static int compareCompleteSizes(Unit paramUnit1, Unit paramUnit2)
  {
    return Integer.valueOf(paramUnit1.getCompleteSize()).compareTo(Integer.valueOf(paramUnit2.getCompleteSize()));
  }
  
  public static class Installed
    extends Unit
  {
    private UpdateElement installEl = null;
    private UpdateElement backupEl = null;
    private boolean uninstallationAllowed;
    private boolean deactivationAllowed;
    private boolean activationAllowed;
    
    public static boolean isOperationAllowed(UpdateUnit paramUpdateUnit, UpdateElement paramUpdateElement, OperationContainer<OperationSupport> paramOperationContainer)
    {
      return par
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