diff options
Diffstat (limited to 'javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java')
-rwxr-xr-x | javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java index f7926c4fd314..76ddef130e8b 100755 --- a/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java +++ b/javainstaller2/src/JavaSetup/org/openoffice/setup/SetupData/DisplayPackageDescription.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ public class DisplayPackageDescription { private PackageDescription data; private int size = 0; - + public DisplayPackageDescription(PackageDescription data) { this.data = data; // Setting default module settings for modules, that are not hidden @@ -49,21 +49,21 @@ public class DisplayPackageDescription { public String getDescription() { return data.getDescription(); } - + public int getSize() { return size; // using local size } - + public int getState() { return data.getSelectionState(); } - + private int getSize(TreeNode peerNode) { // return peerNode.isLeaf() ? data.getAccumulatedSize() : data.getSize(); // using size from PackageDescription, which is pkgSize (and that is defined in xpd file) return data.getSize(); } - + public void setState(TreeNode node, int newState) { if ((data.getSelectionState() != PackageDescription.IGNORE) && data.isOptional()) { data.setSelectionState(newState); @@ -72,12 +72,12 @@ public class DisplayPackageDescription { if (!node.isLeaf()) { size = data.getSize(); // -> that is the value defined in xpd file - for (Enumeration e = node.children(); e.hasMoreElements();) { + for (Enumeration e = node.children(); e.hasMoreElements();) { TreeNode child = (TreeNode)e.nextElement(); DisplayPackageDescription childInfo = getInfo(child); - + childInfo.setState(child, newState); - + if (childInfo.isSelected()) { size += childInfo.getSize(child); } @@ -90,9 +90,9 @@ public class DisplayPackageDescription { public void toggleState(TreeNode node) { int state = data.getSelectionState(); - + if (state != PackageDescription.IGNORE) { - + if (state == PackageDescription.REMOVE) { setState(node, PackageDescription.DONT_REMOVE); } else if ((state == PackageDescription.DONT_REMOVE) || (state == PackageDescription.REMOVE_SOME)) { @@ -102,7 +102,7 @@ public class DisplayPackageDescription { } else { setState(node, PackageDescription.DONT_INSTALL); } - + if (!node.isLeaf()) { updateState(node); } @@ -110,16 +110,16 @@ public class DisplayPackageDescription { try { TreeNode parent = node.getParent(); DisplayPackageDescription parentInfo = getInfo(parent); - + parentInfo.updateState(parent); try { TreeNode grandpa = parent.getParent(); DisplayPackageDescription grandpaInfo = getInfo(grandpa); - + grandpaInfo.updateState(grandpa); } catch (java.lang.IllegalArgumentException e) { /* ignore */ - } + } } catch (java.lang.IllegalArgumentException e) { /* ignore */ @@ -133,10 +133,10 @@ public class DisplayPackageDescription { InstallData installdata = InstallData.getInstance(); size = data.getSize(); // -> that is the value defined in xpd file - for (Enumeration e = node.children(); e.hasMoreElements();) { + for (Enumeration e = node.children(); e.hasMoreElements();) { TreeNode child = (TreeNode) e.nextElement(); DisplayPackageDescription childInfo = getInfo(child); - + int childState = childInfo.getState(); if ((state == PackageDescription.DONT_KNOW) || (state == PackageDescription.IGNORE)) { @@ -152,7 +152,7 @@ public class DisplayPackageDescription { size += childInfo.getSize(child); } } - + data.setSelectionState(state); } @@ -160,8 +160,8 @@ public class DisplayPackageDescription { public void updateSize(TreeNode node) { size = data.getSize(); // -> that is the value defined in xpd file - - for (Enumeration e = node.children(); e.hasMoreElements();) { + + for (Enumeration e = node.children(); e.hasMoreElements();) { TreeNode child = (TreeNode) e.nextElement(); DisplayPackageDescription childInfo = getInfo(child); if (childInfo.isSelected()) { @@ -173,23 +173,23 @@ public class DisplayPackageDescription { public String toString() { return data.getName(); } - + static public boolean is(Object o) { - return (o != null) + return (o != null) && (o.getClass().getName().equals("org.openoffice.setup.SetupData.DisplayPackageDescription")); } - + public boolean isSelected() { int state = data.getSelectionState(); - return (state == PackageDescription.INSTALL) || (state == PackageDescription.INSTALL_SOME) + return (state == PackageDescription.INSTALL) || (state == PackageDescription.INSTALL_SOME) || (state == PackageDescription.REMOVE) || (state == PackageDescription.REMOVE_SOME); } - + private DisplayPackageDescription getInfo(TreeNode node) throws java.lang.IllegalArgumentException { if (node == null) { throw new java.lang.IllegalArgumentException(); } - + DisplayPackageDescription info = (DisplayPackageDescription)((DefaultMutableTreeNode)node).getUserObject(); if ((info != null) && is(info)) { return info; |