From 62c8f55d86809646ccc6fdcba0e95f7496386358 Mon Sep 17 00:00:00 2001 From: shihyun Date: Tue, 6 Aug 2013 17:17:36 +0900 Subject: [PATCH] [Title] * Add meta packages to install --- .../tizen/installmanager/core/InstallManager.java | 15 +++++- .../org/tizen/installmanager/core/Performance.java | 2 + .../org/tizen/installmanager/ui/model/Item.java | 53 ++++++++++------------ 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java b/InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java index 7b02f0e..1a91b35 100644 --- a/InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java +++ b/InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java @@ -708,10 +708,23 @@ public class InstallManager { * @return * @throws IMExitException */ - public boolean install(PackageSet installablePackages, String targetDir, + public boolean install(PackageSet installablePackages, final String targetDir, InstallProgressMonitor monitor) throws IMExitException, IMNetworkException{ Log.log("InstallManager.install() installable packages : " + installablePackages); +// for (final Package pkg : installablePackages) { +// String fileName = pkg.getFileName(); +// boolean downloadResult = downloadPackage(pkg, PathUtil.addURLPath(mConfig.getDownloadPkgPath(), fileName), monitor); +// +// if (downloadPackage(pkg, monitor)) { +// new Thread() { +// public void run() { +// install(pkg, targetDir, null); +// } +// }.run(); +// } +// } + //performance measurement Performance.sdkPackageSize = packageManager.getTotalSizeOfInstallablePackages(installablePackages, true); diff --git a/InstallManager_java/src/org/tizen/installmanager/core/Performance.java b/InstallManager_java/src/org/tizen/installmanager/core/Performance.java index deb0b1d..528b3c4 100644 --- a/InstallManager_java/src/org/tizen/installmanager/core/Performance.java +++ b/InstallManager_java/src/org/tizen/installmanager/core/Performance.java @@ -128,6 +128,8 @@ public class Performance { out.newLine(); out.write("The install-manager end time\t: " + imEndTime); out.newLine(); + out.write("Total package size\t: " + sdkPackageSize); + out.newLine(); out.newLine(); long progressSecond = getTotalTime(); diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/model/Item.java b/InstallManager_java/src/org/tizen/installmanager/ui/model/Item.java index 704e097..0de4b9b 100644 --- a/InstallManager_java/src/org/tizen/installmanager/ui/model/Item.java +++ b/InstallManager_java/src/org/tizen/installmanager/ui/model/Item.java @@ -374,15 +374,13 @@ public class Item implements Comparable { */ public void setStateByChildren() { setCheckStateByChildren(this); - setInstallStateByChildren(this); +// setInstallStateByChildren(this); } private void setCheckStateByChildren(Item parentItem) { - if (!parentItem.hasChildren()) { - return; - } else { - for (Item item : parentItem.getChildren()) { - setCheckStateByChildren(item); + if (parentItem.hasChildren()) { + for (Item childItem : parentItem.getChildren()) { + setCheckStateByChildren(childItem); } if (parentItem.isChildrenAllChecked()) { @@ -392,23 +390,11 @@ public class Item implements Comparable { } else { parentItem.setCheckState(CheckState.GRAYED); } - } - } - - private void setInstallStateByChildren(Item parentItem) { - if (!parentItem.hasChildren()) { - return; } else { - for (Item item : parentItem.getChildren()) { - setInstallStateByChildren(item); - } - - if (parentItem.isChildrenAllUpdate()) { - parentItem.setInstallState(InstallState.UPDATE); - } else if (parentItem.isChildrenAllUninstall()) { - parentItem.setInstallState(InstallState.UNINSTALL); + if (parentItem.getInstallState() != InstallState.INSTALL) { + parentItem.setCheckState(true); } else { - parentItem.setInstallState(InstallState.INSTALL); + parentItem.setCheckState(false); } } } @@ -440,7 +426,16 @@ public class Item implements Comparable { return true; } - private boolean isChildrenAllUpdate() { + private boolean isChildrenAllInstallState() { + for (Item item : getChildren()) { + if (item.getInstallState() != InstallState.INSTALL) { + return false; + } + } + return true; + } + + private boolean isChildrenAllUpdateState() { for (Item item : getChildren()) { if (item.getInstallState() != InstallState.UPDATE) { return false; @@ -449,7 +444,7 @@ public class Item implements Comparable { return true; } - private boolean isChildrenAllUninstall() { + private boolean isChildrenAllUninstallState() { for (Item item : getChildren()) { if (item.getInstallState() != InstallState.UNINSTALL) { return false; @@ -486,16 +481,14 @@ public class Item implements Comparable { * @param checked is true, checking in box on tree view. false is the opposite. */ public void getTerminalPackages(List installList, boolean checked) { - if (hasChildren()) { + if (getCheckState() == CheckState.CHECKED) { + installList.add(getPackageName()); + } else if (getCheckState() == CheckState.GRAYED) { for (Item childItem : getChildren()) { childItem.getTerminalPackages(installList, checked); } - } - - if (getChildren().size() <= 0) { - if (getCheckState() == CheckState.CHECKED) { - installList.add(getPackageName()); - } + } else { + return; } } -- 2.7.4