Selaa lähdekoodia

ZOOKEEPER-756. some cleanup and improvements for zooinspector (Colin Goodheart-Smithe & Thomas Koch via phunt)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1214571 13f79535-47bb-0310-9956-ffa450edef68
Patrick D. Hunt 13 vuotta sitten
vanhempi
commit
854c41926c
88 muutettua tiedostoa jossa 869 lisäystä ja 594 poistoa
  1. 3 0
      CHANGES.txt
  2. 9 3
      src/contrib/zooinspector/NOTICE.txt
  3. 19 0
      src/contrib/zooinspector/TODO
  4. 4 16
      src/contrib/zooinspector/build.xml
  5. 0 16
      src/contrib/zooinspector/config/defaultConnectionSettings.cfg
  6. 0 17
      src/contrib/zooinspector/config/defaultNodeVeiwers.cfg
  7. 3 0
      src/contrib/zooinspector/config/defaultNodeViewers.cfg
  8. BIN
      src/contrib/zooinspector/icons/edtsrclkup_co.gif
  9. BIN
      src/contrib/zooinspector/icons/file_obj.gif
  10. BIN
      src/contrib/zooinspector/icons/fldr_obj.gif
  11. BIN
      src/contrib/zooinspector/icons/info_obj.gif
  12. BIN
      src/contrib/zooinspector/icons/jspdecl.gif
  13. BIN
      src/contrib/zooinspector/icons/launch_run.gif
  14. BIN
      src/contrib/zooinspector/icons/launch_stop.gif
  15. BIN
      src/contrib/zooinspector/icons/new_con.gif
  16. BIN
      src/contrib/zooinspector/icons/refresh.gif
  17. BIN
      src/contrib/zooinspector/icons/save_edit.gif
  18. BIN
      src/contrib/zooinspector/icons/search_next.gif
  19. BIN
      src/contrib/zooinspector/icons/search_prev.gif
  20. BIN
      src/contrib/zooinspector/icons/trash.gif
  21. BIN
      src/contrib/zooinspector/lib/jtoaster-1.0.4.jar
  22. 1 1
      src/contrib/zooinspector/lib/log4j.properties
  23. 0 261
      src/contrib/zooinspector/licences/epl-v10.html
  24. 533 0
      src/contrib/zooinspector/src/java/com/nitido/utils/toaster/Toaster.java
  25. 2 1
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/ZooInspector.java
  26. 88 0
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/IconResource.java
  27. 74 0
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/Toolbar.java
  28. 2 3
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorAboutDialog.java
  29. 0 118
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorIconResources.java
  30. 78 52
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorNodeViewersDialog.java
  31. 20 63
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorPanel.java
  32. 10 16
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorTreeViewer.java
  33. 3 7
      src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerData.java
  34. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/add.png
  35. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/document-new.png
  36. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/document-save.png
  37. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/down.png
  38. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/media-playback-start.png
  39. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/media-playback-stop.png
  40. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/remove.png
  41. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/up.png
  42. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/view-refresh.png
  43. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/mimetypes/text-x-generic.png
  44. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/places/folder.png
  45. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/places/user-trash.png
  46. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/status/info.png
  47. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/add.png
  48. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/document-new.png
  49. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/document-save.png
  50. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/down.png
  51. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/media-playback-start.png
  52. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/media-playback-stop.png
  53. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/remove.png
  54. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/up.png
  55. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/view-refresh.png
  56. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/mimetypes/text-x-generic.png
  57. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/places/folder.png
  58. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/places/user-trash.png
  59. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/status/info.png
  60. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/add.png
  61. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/document-new.png
  62. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/document-save.png
  63. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/down.png
  64. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/media-playback-start.png
  65. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/media-playback-stop.png
  66. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/remove.png
  67. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/up.png
  68. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/view-refresh.png
  69. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/mimetypes/text-x-generic.png
  70. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/places/folder.png
  71. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/places/user-trash.png
  72. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/status/info.png
  73. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/add.png
  74. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/document-new.png
  75. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/document-save.png
  76. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/down.png
  77. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/media-playback-start.png
  78. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/media-playback-stop.png
  79. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/remove.png
  80. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/up.png
  81. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/view-refresh.png
  82. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/mimetypes/text-x-generic.png
  83. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/places/folder.png
  84. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/places/user-trash.png
  85. BIN
      src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/status/info.png
  86. 18 18
      src/contrib/zooinspector/zooInspector-dev.sh
  87. 1 1
      src/contrib/zooinspector/zooInspector.cmd
  88. 1 1
      src/contrib/zooinspector/zooInspector.sh

+ 3 - 0
CHANGES.txt

@@ -144,6 +144,9 @@ IMPROVEMENTS:
   ZOOKEEPER-1253. return value of DataTree.createNode is never used
   (Thomas Koch via phunt)
 
+  ZOOKEEPER-756. some cleanup and improvements for zooinspector
+  (Colin Goodheart-Smithe & Thomas Koch via phunt)
+
 Release 3.4.0 - 
 
 Non-backward compatible changes:

+ 9 - 3
src/contrib/zooinspector/NOTICE.txt

@@ -1,3 +1,9 @@
-This contrib module includes icons available under the Eclipse Public Licence Version 1.0
-. from the Eclipse Java Devlopment Platform. 
-The lib sub-directory includes a binary only jar library developed at http://sourceforge.net/projects/jtoaster/
+src/java/com/nitido/utils/toaster/Toaster.java:
+This java file is copyright by Daniele Piras ("danielepiras80", no email known) released under the Apache Software License 2.0
+It has been downloaded in december 2009 from the CVS web interface of the sourceforge project http://sourceforge.net/projects/jtoaster/ . The web interface to CVS is not available anymore on sourceforge.
+
+The icons in src/main/resources/icons are taken from the Tango project
+downloaded from http://tango.freedesktop.org/releases on 2011-09-06.
+The Tango project is public domain.
+
+Distribution packagers should not include the icons in the package but rather depend on tango-icon-theme (Debian package name). ZooInspector will then try to get the icons from /usr/share/icons/Tango rather then from its jar file.

+ 19 - 0
src/contrib/zooinspector/TODO

@@ -0,0 +1,19 @@
+- replace JToaster with standard notifications, see:
+  http://www.galago-project.org/specs/notification/
+  http://stackoverflow.com/questions/857154/freedesktop-org-notifications-in-java
+  DBus and Java:
+  http://bolta-gecko.blogspot.com/2009/06/using-d-bus-in-java.html
+  http://dbus.freedesktop.org/doc/dbus-java/ (packaged in Debian)
+
+- properly respect
+  http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
+  http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+  http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
+
+- Rename classes to avoid redundand "ZooInspector" prefix.
+
+- Ant build file has hard coded log4j dependency. (ZK will move to maven anyways...)
+
+- make directory for config files configurable via commandline parameter
+
+- Clean up the code! :-)

+ 4 - 16
src/contrib/zooinspector/build.xml

@@ -30,18 +30,17 @@
 		</copy>
 		<mkdir dir="${build.dir}/icons" />
 		<copy todir="${build.dir}/icons">
-			<fileset dir="${basedir}/icons" />
+			<fileset dir="${basedir}/src/main/resources/icons" />
 		</copy>
 		<mkdir dir="${build.dir}/config" />
 		<copy todir="${build.dir}/config">
 			<fileset dir="${basedir}/config" />
 		</copy>
 		<copy todir="${build.dir}/lib">
-			<fileset file="${basedir}/lib/jtoaster-1.0.4.jar" />
 			<fileset file="${basedir}/lib/log4j.properties" />
 		</copy>
 		<copy todir="${build.dir}/lib">
-			<fileset file="../../../build/zookeeper-3.3.0.jar" />
+			<fileset file="../../../build/zookeeper-${version}.jar" />
 		</copy>
 		<copy todir="${build.dir}">
 			<fileset dir="${basedir}" includes="*.*" excludes="build.xml,ivy.xml" />
@@ -55,7 +54,7 @@
 		<jar jarfile="${jarname}">
 			<manifest>
 				<attribute name="Main-Class" value="org.apache.zookeeper.inspector.ZooInspector" />
-				<attribute name="Class-Path" value="lib/log4j-1.2.15.jar lib/TableLayout-20050920.jar lib/zookeeper-3.3.0.jar lib/jToaster-1.0.4.jar lib" />
+				<attribute name="Class-Path" value="lib/log4j-1.2.15.jar lib/zookeeper-${version}.jar lib" />
 				<attribute name="Built-By" value="${user.name}" />
 				<attribute name="Built-At" value="${build.time}" />
 				<attribute name="Built-On" value="${host.name}" />
@@ -65,6 +64,7 @@
 			</manifest>
 			<fileset file="${zk.root}/LICENSE.txt" />
 			<fileset dir="${build.classes}" />
+			<fileset dir="${basedir}/src/main/resources" />
 			<fileset dir="${basedir}/src/java" excludes="**/*.jar, **/*.java"/>
 		</jar>
 	</target>
@@ -132,21 +132,9 @@
 		<copy todir="${dist.dir}/contrib/${name}/licences">
 			<fileset dir="${basedir}/licences" />
 		</copy>
-		<mkdir dir="${dist.dir}/contrib/${name}/icons" />
-		<copy todir="${dist.dir}/contrib/${name}/icons">
-			<fileset dir="${basedir}/icons" />
-		</copy>
 		<mkdir dir="${dist.dir}/contrib/${name}/config" />
 		<copy todir="${dist.dir}/contrib/${name}/config">
 			<fileset dir="${basedir}/config" />
 		</copy>
-		<copy todir="${dist.dir}/contrib/${name}/lib">
-			<fileset file="${basedir}/lib/jtoaster-1.0.4.jar" />
-		</copy>
-		<copy todir="${dist.dir}/contrib/${name}/lib">
-			<fileset file="../../../build/zookeeper-3.3.0.jar" />
-		</copy>
 	</target>
-
 </project>
-

+ 0 - 16
src/contrib/zooinspector/config/defaultConnectionSettings.cfg

@@ -1,20 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
 #Default connection for ZooInspector
-#Sun Feb 28 14:46:55 GMT 2010
 hosts=localhost\:2181
 encryptionManager=org.apache.zookeeper.inspector.encryption.BasicDataEncryptionManager
 timeout=5000

+ 0 - 17
src/contrib/zooinspector/config/defaultNodeVeiwers.cfg

@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-org.apache.zookeeper.inspector.gui.nodeviewer.NodeViewerData
-org.apache.zookeeper.inspector.gui.nodeviewer.NodeViewerMetaData
-org.apache.zookeeper.inspector.gui.nodeviewer.NodeViewerACL

+ 3 - 0
src/contrib/zooinspector/config/defaultNodeViewers.cfg

@@ -0,0 +1,3 @@
+org.apache.zookeeper.inspector.gui.nodeviewer.NodeViewerData
+org.apache.zookeeper.inspector.gui.nodeviewer.NodeViewerMetaData
+org.apache.zookeeper.inspector.gui.nodeviewer.NodeViewerACL

BIN
src/contrib/zooinspector/icons/edtsrclkup_co.gif


BIN
src/contrib/zooinspector/icons/file_obj.gif


BIN
src/contrib/zooinspector/icons/fldr_obj.gif


BIN
src/contrib/zooinspector/icons/info_obj.gif


BIN
src/contrib/zooinspector/icons/jspdecl.gif


BIN
src/contrib/zooinspector/icons/launch_run.gif


BIN
src/contrib/zooinspector/icons/launch_stop.gif


BIN
src/contrib/zooinspector/icons/new_con.gif


BIN
src/contrib/zooinspector/icons/refresh.gif


BIN
src/contrib/zooinspector/icons/save_edit.gif


BIN
src/contrib/zooinspector/icons/search_next.gif


BIN
src/contrib/zooinspector/icons/search_prev.gif


BIN
src/contrib/zooinspector/icons/trash.gif


BIN
src/contrib/zooinspector/lib/jtoaster-1.0.4.jar


+ 1 - 1
src/contrib/zooinspector/lib/log4j.properties

@@ -1,5 +1,5 @@
 # ***** Set root logger level to INFO and it appender to stdout.
-log4j.rootLogger=info, stdout
+log4j.rootLogger=INFO,stdout
 
 # ***** stdout is set to be a ConsoleAppender.
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender

+ 0 - 261
src/contrib/zooinspector/licences/epl-v10.html

@@ -1,261 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-<title>Eclipse Public License - Version 1.0</title>
-<style type="text/css">
-  body {
-    size: 8.5in 11.0in;
-    margin: 0.25in 0.5in 0.25in 0.5in;
-    tab-interval: 0.5in;
-    }
-  p {  	
-    margin-left: auto;
-    margin-top:  0.5em;
-    margin-bottom: 0.5em;
-    }
-  p.list {
-  	margin-left: 0.5in;
-    margin-top:  0.05em;
-    margin-bottom: 0.05em;
-    }
-  </style>
-
-</head>
-
-<body lang="EN-US">
-
-<h2>Eclipse Public License - v 1.0</h2>
-
-<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
-PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE, REPRODUCTION OR
-DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
-AGREEMENT.</p>
-
-<p><b>1. DEFINITIONS</b></p>
-
-<p>&quot;Contribution&quot; means:</p>
-
-<p class="list">a) in the case of the initial Contributor, the initial
-code and documentation distributed under this Agreement, and</p>
-<p class="list">b) in the case of each subsequent Contributor:</p>
-<p class="list">i) changes to the Program, and</p>
-<p class="list">ii) additions to the Program;</p>
-<p class="list">where such changes and/or additions to the Program
-originate from and are distributed by that particular Contributor. A
-Contribution 'originates' from a Contributor if it was added to the
-Program by such Contributor itself or anyone acting on such
-Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in
-conjunction with the Program under their own license agreement, and (ii)
-are not derivative works of the Program.</p>
-
-<p>&quot;Contributor&quot; means any person or entity that distributes
-the Program.</p>
-
-<p>&quot;Licensed Patents&quot; mean patent claims licensable by a
-Contributor which are necessarily infringed by the use or sale of its
-Contribution alone or when combined with the Program.</p>
-
-<p>&quot;Program&quot; means the Contributions distributed in accordance
-with this Agreement.</p>
-
-<p>&quot;Recipient&quot; means anyone who receives the Program under
-this Agreement, including all Contributors.</p>
-
-<p><b>2. GRANT OF RIGHTS</b></p>
-
-<p class="list">a) Subject to the terms of this Agreement, each
-Contributor hereby grants Recipient a non-exclusive, worldwide,
-royalty-free copyright license to reproduce, prepare derivative works
-of, publicly display, publicly perform, distribute and sublicense the
-Contribution of such Contributor, if any, and such derivative works, in
-source code and object code form.</p>
-
-<p class="list">b) Subject to the terms of this Agreement, each
-Contributor hereby grants Recipient a non-exclusive, worldwide,
-royalty-free patent license under Licensed Patents to make, use, sell,
-offer to sell, import and otherwise transfer the Contribution of such
-Contributor, if any, in source code and object code form. This patent
-license shall apply to the combination of the Contribution and the
-Program if, at the time the Contribution is added by the Contributor,
-such addition of the Contribution causes such combination to be covered
-by the Licensed Patents. The patent license shall not apply to any other
-combinations which include the Contribution. No hardware per se is
-licensed hereunder.</p>
-
-<p class="list">c) Recipient understands that although each Contributor
-grants the licenses to its Contributions set forth herein, no assurances
-are provided by any Contributor that the Program does not infringe the
-patent or other intellectual property rights of any other entity. Each
-Contributor disclaims any liability to Recipient for claims brought by
-any other entity based on infringement of intellectual property rights
-or otherwise. As a condition to exercising the rights and licenses
-granted hereunder, each Recipient hereby assumes sole responsibility to
-secure any other intellectual property rights needed, if any. For
-example, if a third party patent license is required to allow Recipient
-to distribute the Program, it is Recipient's responsibility to acquire
-that license before distributing the Program.</p>
-
-<p class="list">d) Each Contributor represents that to its knowledge it
-has sufficient copyright rights in its Contribution, if any, to grant
-the copyright license set forth in this Agreement.</p>
-
-<p><b>3. REQUIREMENTS</b></p>
-
-<p>A Contributor may choose to distribute the Program in object code
-form under its own license agreement, provided that:</p>
-
-<p class="list">a) it complies with the terms and conditions of this
-Agreement; and</p>
-
-<p class="list">b) its license agreement:</p>
-
-<p class="list">i) effectively disclaims on behalf of all Contributors
-all warranties and conditions, express and implied, including warranties
-or conditions of title and non-infringement, and implied warranties or
-conditions of merchantability and fitness for a particular purpose;</p>
-
-<p class="list">ii) effectively excludes on behalf of all Contributors
-all liability for damages, including direct, indirect, special,
-incidental and consequential damages, such as lost profits;</p>
-
-<p class="list">iii) states that any provisions which differ from this
-Agreement are offered by that Contributor alone and not by any other
-party; and</p>
-
-<p class="list">iv) states that source code for the Program is available
-from such Contributor, and informs licensees how to obtain it in a
-reasonable manner on or through a medium customarily used for software
-exchange.</p>
-
-<p>When the Program is made available in source code form:</p>
-
-<p class="list">a) it must be made available under this Agreement; and</p>
-
-<p class="list">b) a copy of this Agreement must be included with each
-copy of the Program.</p>
-
-<p>Contributors may not remove or alter any copyright notices contained
-within the Program.</p>
-
-<p>Each Contributor must identify itself as the originator of its
-Contribution, if any, in a manner that reasonably allows subsequent
-Recipients to identify the originator of the Contribution.</p>
-
-<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
-
-<p>Commercial distributors of software may accept certain
-responsibilities with respect to end users, business partners and the
-like. While this license is intended to facilitate the commercial use of
-the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create
-potential liability for other Contributors. Therefore, if a Contributor
-includes the Program in a commercial product offering, such Contributor
-(&quot;Commercial Contributor&quot;) hereby agrees to defend and
-indemnify every other Contributor (&quot;Indemnified Contributor&quot;)
-against any losses, damages and costs (collectively &quot;Losses&quot;)
-arising from claims, lawsuits and other legal actions brought by a third
-party against the Indemnified Contributor to the extent caused by the
-acts or omissions of such Commercial Contributor in connection with its
-distribution of the Program in a commercial product offering. The
-obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In
-order to qualify, an Indemnified Contributor must: a) promptly notify
-the Commercial Contributor in writing of such claim, and b) allow the
-Commercial Contributor to control, and cooperate with the Commercial
-Contributor in, the defense and any related settlement negotiations. The
-Indemnified Contributor may participate in any such claim at its own
-expense.</p>
-
-<p>For example, a Contributor might include the Program in a commercial
-product offering, Product X. That Contributor is then a Commercial
-Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance
-claims and warranties are such Commercial Contributor's responsibility
-alone. Under this section, the Commercial Contributor would have to
-defend claims against the other Contributors related to those
-performance claims and warranties, and if a court requires any other
-Contributor to pay any damages as a result, the Commercial Contributor
-must pay those damages.</p>
-
-<p><b>5. NO WARRANTY</b></p>
-
-<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
-PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS
-OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
-ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
-OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and
-distributing the Program and assumes all risks associated with its
-exercise of rights under this Agreement , including but not limited to
-the risks and costs of program errors, compliance with applicable laws,
-damage to or loss of data, programs or equipment, and unavailability or
-interruption of operations.</p>
-
-<p><b>6. DISCLAIMER OF LIABILITY</b></p>
-
-<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
-NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
-WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
-DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
-HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
-
-<p><b>7. GENERAL</b></p>
-
-<p>If any provision of this Agreement is invalid or unenforceable under
-applicable law, it shall not affect the validity or enforceability of
-the remainder of the terms of this Agreement, and without further action
-by the parties hereto, such provision shall be reformed to the minimum
-extent necessary to make such provision valid and enforceable.</p>
-
-<p>If Recipient institutes patent litigation against any entity
-(including a cross-claim or counterclaim in a lawsuit) alleging that the
-Program itself (excluding combinations of the Program with other
-software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the
-date such litigation is filed.</p>
-
-<p>All Recipient's rights under this Agreement shall terminate if it
-fails to comply with any of the material terms or conditions of this
-Agreement and does not cure such failure in a reasonable period of time
-after becoming aware of such noncompliance. If all Recipient's rights
-under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive.</p>
-
-<p>Everyone is permitted to copy and distribute copies of this
-Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The
-Agreement Steward reserves the right to publish new versions (including
-revisions) of this Agreement from time to time. No one other than the
-Agreement Steward has the right to modify this Agreement. The Eclipse
-Foundation is the initial Agreement Steward. The Eclipse Foundation may
-assign the responsibility to serve as the Agreement Steward to a
-suitable separate entity. Each new version of the Agreement will be
-given a distinguishing version number. The Program (including
-Contributions) may always be distributed subject to the version of the
-Agreement under which it was received. In addition, after a new version
-of the Agreement is published, Contributor may elect to distribute the
-Program (including its Contributions) under the new version. Except as
-expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
-rights or licenses to the intellectual property of any Contributor under
-this Agreement, whether expressly, by implication, estoppel or
-otherwise. All rights in the Program not expressly granted under this
-Agreement are reserved.</p>
-
-<p>This Agreement is governed by the laws of the State of New York and
-the intellectual property laws of the United States of America. No party
-to this Agreement will bring a legal action under this Agreement more
-than one year after the cause of action arose. Each party waives its
-rights to a jury trial in any resulting litigation.</p>
-
-</body>
-
-</html>

+ 533 - 0
src/contrib/zooinspector/src/java/com/nitido/utils/toaster/Toaster.java

@@ -0,0 +1,533 @@
+/**
+ * This java file is copyright by Daniele Piras ("danielepiras80", no email known) released under the
+ * Apache Software License 2.0. It has been downloaded in december 2009 from the CVS web interface
+ * of the sourceforge project http://sourceforge.net/projects/jtoaster/ . The web interface to CVS
+ * is not available anymore on sourceforge.
+ *
+ */
+
+/**
+ * Java Toaster is a java utility class for your swing applications
+ * that show an animate box coming from the bottom of your screen
+ * with a notification message and/or an associated image
+ * (like msn online/offline notifications).
+ *
+ * Toaster panel in windows system follow the taskbar; So if
+ * the taskbar is into the bottom the panel coming from the bottom
+ * and if the taskbar is on the top then the panel coming from the top.
+ *
+ * This is a simple example of utilization:
+ *
+ * import com.nitido.utils.toaster.*;
+ * import javax.swing.*;
+ *
+ * public class ToasterTest
+ * {
+ *
+ *  public static void main(String[] args)
+ *  {
+ *   // Initialize toaster manager...
+ *   Toaster toasterManager = new Toaster();
+ *
+ *   // Show a simple toaster
+ *   toasterManager.showToaster( new ImageIcon( "mylogo.gif" ), "A simple toaster with an image" );
+ *  }
+ * }
+ */
+package com.nitido.utils.toaster;
+
+import java.awt.*;
+
+import javax.swing.*;
+import javax.swing.border.*;
+
+/**
+ * Class to show tosters in multiplatform
+ *
+ * @author daniele piras
+ *
+ */
+public class Toaster
+{
+	// Width of the toster
+	private int toasterWidth = 300;
+
+	// Height of the toster
+	private int toasterHeight = 80;
+
+	// Step for the toaster
+	private int step = 20;
+
+	// Step time
+	private int stepTime = 20;
+
+	// Show time
+	private int displayTime = 3000;
+
+	// Current number of toaster...
+	private int currentNumberOfToaster = 0;
+
+	// Last opened toaster
+	private int maxToaster = 0;
+
+	// Max number of toasters for the sceen
+	private int maxToasterInSceen;
+
+	// Font used to display message
+	private Font font;
+
+  // Color for border
+	private Color borderColor;
+
+  // Color for toaster
+	private Color toasterColor;
+
+  // Set message color
+	private Color messageColor;
+
+	// Set the margin
+	int margin;
+
+	// Flag that indicate if use alwaysOnTop or not.
+	// method always on top start only SINCE JDK 5 !
+	boolean useAlwaysOnTop = true;
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Constructor to initialized toaster component...
+	 *
+	 * @author daniele piras
+	 *
+	 */
+	public Toaster()
+	{
+		// Set default font...
+		font = new Font("Arial", Font.BOLD, 12);
+		// Border color
+		borderColor = new Color(245, 153, 15);
+		toasterColor = Color.WHITE;
+		messageColor = Color.BLACK;
+		useAlwaysOnTop = true;
+		// Verify AlwaysOnTop Flag...
+		try
+		{
+		  JWindow.class.getMethod( "setAlwaysOnTop", new Class[] { Boolean.class } );
+		}
+		catch( Exception e )
+		{
+			useAlwaysOnTop = false;
+		}
+
+	}
+
+	/**
+	 * Class that rappresent a single toaster
+	 *
+	 * @author daniele piras
+	 *
+	 */
+	class SingleToaster extends javax.swing.JWindow
+	{
+		private static final long serialVersionUID = 1L;
+
+		// Label to store Icon
+		private JLabel iconLabel = new JLabel();
+
+		// Text area for the message
+		private JTextArea message = new JTextArea();
+
+
+
+
+		/***
+		 * Simple costructor that initialized components...
+		 */
+		public SingleToaster()
+		{
+			initComponents();
+		}
+
+		/***
+		 * Function to initialized components
+		 */
+		private void initComponents()
+		{
+
+			setSize(toasterWidth, toasterHeight);
+			message.setFont( getToasterMessageFont() );
+			JPanel externalPanel = new JPanel(new BorderLayout(1, 1));
+			externalPanel.setBackground( getBorderColor() );
+			JPanel innerPanel = new JPanel(new BorderLayout( getMargin(), getMargin() ));
+			innerPanel.setBackground( getToasterColor() );
+			message.setBackground( getToasterColor() );
+			message.setMargin( new Insets( 2,2,2,2 ) );
+			message.setLineWrap( true );
+			message.setWrapStyleWord( true );
+
+			EtchedBorder etchedBorder = (EtchedBorder) BorderFactory
+					.createEtchedBorder();
+			externalPanel.setBorder(etchedBorder);
+
+			externalPanel.add(innerPanel);
+      message.setForeground( getMessageColor() );
+			innerPanel.add(iconLabel, BorderLayout.WEST);
+			innerPanel.add(message, BorderLayout.CENTER);
+			getContentPane().add(externalPanel);
+		}
+
+
+		/***
+		 * Start toaster animation...
+		 */
+		public void animate()
+		{
+			( new Animation( this ) ).start();
+		}
+
+	}
+
+	/***
+	 * Class that manage the animation
+	 */
+	class Animation extends Thread
+	{
+		SingleToaster toaster;
+
+		public Animation( SingleToaster toaster )
+		{
+			this.toaster = toaster;
+		}
+
+
+		/**
+		 * Animate vertically the toaster. The toaster could be moved from bottom
+		 * to upper or to upper to bottom
+		 * @param posx
+		 * @param fromy
+		 * @param toy
+		 * @throws InterruptedException
+		 */
+		protected void animateVertically( int posx, int fromY, int toY ) throws InterruptedException
+		{
+
+			toaster.setLocation( posx, fromY );
+			if ( toY < fromY )
+			{
+				for (int i = fromY; i > toY; i -= step)
+				{
+					toaster.setLocation(posx, i);
+					Thread.sleep(stepTime);
+				}
+			}
+			else
+			{
+				for (int i = fromY; i < toY; i += step)
+				{
+					toaster.setLocation(posx, i);
+					Thread.sleep(stepTime);
+				}
+			}
+			toaster.setLocation( posx, toY );
+		}
+
+		public void run()
+		{
+			try
+			{
+				boolean animateFromBottom = true;
+				GraphicsEnvironment ge = GraphicsEnvironment
+						.getLocalGraphicsEnvironment();
+				Rectangle screenRect = ge.getMaximumWindowBounds();
+
+				int screenHeight = (int) screenRect.height;
+
+				int startYPosition;
+				int stopYPosition;
+
+				if ( screenRect.y > 0 )
+				{
+				  animateFromBottom = false; // Animate from top!
+				}
+
+				maxToasterInSceen = screenHeight / toasterHeight;
+
+
+				int posx = (int) screenRect.width - toasterWidth - 1;
+
+				toaster.setLocation(posx, screenHeight);
+				toaster.setVisible(true);
+				if ( useAlwaysOnTop )
+				{
+				  toaster.setAlwaysOnTop(true);
+				}
+
+				if ( animateFromBottom )
+				{
+					startYPosition = screenHeight;
+					stopYPosition = startYPosition - toasterHeight - 1;
+					if ( currentNumberOfToaster > 0 )
+					{
+						stopYPosition = stopYPosition - ( maxToaster % maxToasterInSceen * toasterHeight );
+					}
+					else
+					{
+						maxToaster = 0;
+					}
+				}
+				else
+				{
+					startYPosition = screenRect.y - toasterHeight;
+					stopYPosition = screenRect.y;
+
+					if ( currentNumberOfToaster > 0 )
+					{
+						stopYPosition = stopYPosition + ( maxToaster % maxToasterInSceen * toasterHeight );
+					}
+					else
+					{
+						maxToaster = 0;
+					}
+				}
+
+				currentNumberOfToaster++;
+				maxToaster++;
+
+
+				animateVertically( posx, startYPosition, stopYPosition );
+				Thread.sleep(displayTime);
+				animateVertically( posx, stopYPosition, startYPosition );
+
+				currentNumberOfToaster--;
+				toaster.setVisible(false);
+				toaster.dispose();
+			} catch (Exception e)
+			{
+				e.printStackTrace();
+			}
+		}
+	}
+
+
+
+	/**
+	 * Show a toaster with the specified message and the associated icon.
+	 */
+	public void showToaster(Icon icon, String msg)
+	{
+    SingleToaster singleToaster = new SingleToaster();
+    if ( icon != null )
+    {
+      singleToaster.iconLabel.setIcon( icon );
+    }
+    singleToaster.message.setText( msg );
+		singleToaster.animate();
+	}
+
+	/**
+	 * Show a toaster with the specified message.
+	 */
+	public void showToaster( String msg )
+	{
+		showToaster( null, msg );
+	}
+
+	/**
+	 * @return Returns the font
+	 */
+	public Font getToasterMessageFont()
+	{
+		// TODO Auto-generated method stub
+		return font;
+	}
+
+	/**
+	 * Set the font for the message
+	 */
+	public void setToasterMessageFont( Font f)
+	{
+    font = f;
+	}
+
+
+	/**
+	 * @return Returns the borderColor.
+	 */
+	public Color getBorderColor()
+	{
+		return borderColor;
+	}
+
+
+
+	/**
+	 * @param borderColor The borderColor to set.
+	 */
+	public void setBorderColor(Color borderColor)
+	{
+		this.borderColor = borderColor;
+	}
+
+
+
+	/**
+	 * @return Returns the displayTime.
+	 */
+	public int getDisplayTime()
+	{
+		return displayTime;
+	}
+
+
+
+	/**
+	 * @param displayTime The displayTime to set.
+	 */
+	public void setDisplayTime(int displayTime)
+	{
+		this.displayTime = displayTime;
+	}
+
+
+
+	/**
+	 * @return Returns the margin.
+	 */
+	public int getMargin()
+	{
+		return margin;
+	}
+
+
+
+	/**
+	 * @param margin The margin to set.
+	 */
+	public void setMargin(int margin)
+	{
+		this.margin = margin;
+	}
+
+
+
+	/**
+	 * @return Returns the messageColor.
+	 */
+	public Color getMessageColor()
+	{
+		return messageColor;
+	}
+
+
+
+	/**
+	 * @param messageColor The messageColor to set.
+	 */
+	public void setMessageColor(Color messageColor)
+	{
+		this.messageColor = messageColor;
+	}
+
+
+
+	/**
+	 * @return Returns the step.
+	 */
+	public int getStep()
+	{
+		return step;
+	}
+
+
+
+	/**
+	 * @param step The step to set.
+	 */
+	public void setStep(int step)
+	{
+		this.step = step;
+	}
+
+
+
+	/**
+	 * @return Returns the stepTime.
+	 */
+	public int getStepTime()
+	{
+		return stepTime;
+	}
+
+
+
+	/**
+	 * @param stepTime The stepTime to set.
+	 */
+	public void setStepTime(int stepTime)
+	{
+		this.stepTime = stepTime;
+	}
+
+
+
+	/**
+	 * @return Returns the toasterColor.
+	 */
+	public Color getToasterColor()
+	{
+		return toasterColor;
+	}
+
+
+
+	/**
+	 * @param toasterColor The toasterColor to set.
+	 */
+	public void setToasterColor(Color toasterColor)
+	{
+		this.toasterColor = toasterColor;
+	}
+
+
+
+	/**
+	 * @return Returns the toasterHeight.
+	 */
+	public int getToasterHeight()
+	{
+		return toasterHeight;
+	}
+
+
+
+	/**
+	 * @param toasterHeight The toasterHeight to set.
+	 */
+	public void setToasterHeight(int toasterHeight)
+	{
+		this.toasterHeight = toasterHeight;
+	}
+
+
+
+	/**
+	 * @return Returns the toasterWidth.
+	 */
+	public int getToasterWidth()
+	{
+		return toasterWidth;
+	}
+
+
+
+	/**
+	 * @param toasterWidth The toasterWidth to set.
+	 */
+	public void setToasterWidth(int toasterWidth)
+	{
+		this.toasterWidth = toasterWidth;
+	}
+
+
+
+}

+ 2 - 1
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/ZooInspector.java

@@ -24,6 +24,7 @@ import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.UIManager;
 
+import org.apache.zookeeper.inspector.gui.IconResource;
 import org.apache.zookeeper.inspector.gui.ZooInspectorPanel;
 import org.apache.zookeeper.inspector.logger.LoggerFactory;
 import org.apache.zookeeper.inspector.manager.ZooInspectorManagerImpl;
@@ -43,7 +44,7 @@ public class ZooInspector {
             JFrame frame = new JFrame("ZooInspector");
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             final ZooInspectorPanel zooInspectorPanel = new ZooInspectorPanel(
-                    new ZooInspectorManagerImpl());
+                    new ZooInspectorManagerImpl(), new IconResource());
             frame.addWindowListener(new WindowAdapter() {
                 @Override
                 public void windowClosed(WindowEvent e) {

+ 88 - 0
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/IconResource.java

@@ -0,0 +1,88 @@
+package org.apache.zookeeper.inspector.gui;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.swing.ImageIcon;
+
+import org.apache.zookeeper.inspector.logger.LoggerFactory;
+
+/**
+ * @see http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
+ * I tried to take icons that are available in the Tango icon set
+ */
+public class IconResource {
+
+    public static final String ICON_ChangeNodeViewers = "";
+    public static final String ICON_TREE_LEAF = "mimetypes/text-x-generic";
+    public static final String ICON_TREE_OPEN = "places/folder";
+    public static final String ICON_TREE_CLOSE = "places/folder";
+    public static final String ICON_INFORMATION = "status/info";
+    public static final String ICON_SAVE = "actions/document-save";
+    public static final String ICON_UP = "actions/up";
+    public static final String ICON_DOWN = "actions/down";
+    public static final String ICON_ADD = "actions/add";
+    public static final String ICON_REMOVE = "actions/remove";
+    public static final String ICON_START = "actions/media-playback-start";
+    public static final String ICON_STOP = "actions/media-playback-stop";
+    public static final String ICON_DOCUMENT_ADD = "actions/document-new";
+    public static final String ICON_REFRESH = "actions/view-refresh";
+    public static final String ICON_TRASH = "places/user-trash";
+    // better: actions/help-about, but not in tango
+    public static final String ICON_HELP_ABOUT = "status/info";
+
+    private static final String DEFAULT_THEME = "Tango";
+    private static final String DEFAULT_SIZE = "16x16";
+    private static final String FALLBACK_ICON = "face-surprise";
+
+    // compare http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+    private static final String[] DEFAULT_XDG_DATA_DIRS = new String[]{
+        "/usr/local/share",
+        "/usr/share"
+    };
+
+    private String theme = DEFAULT_THEME;
+    private String size = DEFAULT_SIZE;
+
+    public URL find(String name) {
+        String iconPath = buildIconPath(name);
+        URL iconUrl = findInPaths(iconPath);
+        if(null != iconUrl) return iconUrl;
+
+        iconUrl = getClass().getResource(iconPath);
+        if(null != iconUrl) return iconUrl;
+
+        if(!name.equals(FALLBACK_ICON)) return find(FALLBACK_ICON);
+        return null;
+    }
+
+    public ImageIcon get(String name, String description) {
+        URL iconUrl = find(name);
+        if(null==iconUrl) {
+            ImageIcon icon = new ImageIcon();
+            icon.setDescription(description);
+            return icon;
+        } else {
+            return new ImageIcon(iconUrl, description);
+        }
+    }
+
+    private URL findInPaths(String iconPath) {
+        for(String dataDir : DEFAULT_XDG_DATA_DIRS) {
+            File file = new File(dataDir + iconPath);
+            if(file.exists()) {
+                try {
+                    return file.toURI().toURL();
+                } catch (MalformedURLException e) {
+                    LoggerFactory.getLogger().warn(e.toString());
+                }
+            }
+        }
+        return null;
+    }
+
+    private String buildIconPath(String name) {
+        return "/icons/" + theme + "/" + size + "/" + name + ".png";
+    }
+}

+ 74 - 0
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/Toolbar.java

@@ -0,0 +1,74 @@
+package org.apache.zookeeper.inspector.gui;
+
+import java.awt.event.ActionListener;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.swing.JButton;
+import javax.swing.JToolBar;
+
+public class Toolbar {
+
+    private final IconResource iconResource;
+    private final JToolBar toolbar = new JToolBar();
+    private final Map<Button, JButton> buttons = new HashMap<Button, JButton>();
+
+    private static final Button[] buttonsToToggle = new Button[] {
+        Button.connect, Button.disconnect, Button.refresh, Button.addNode, Button.deleteNode
+    };
+
+    public Toolbar(IconResource iconResource) {
+        this.iconResource = iconResource;
+        init();
+    }
+
+    public void addActionListener(Button button, ActionListener actionListener) {
+        buttons.get(button).addActionListener(actionListener);
+    }
+
+    public JToolBar getJToolBar() {
+        return toolbar;
+    }
+
+    public void toggleButtons(boolean connected) {
+        for(Button button : buttonsToToggle) {
+            buttons.get(button).setEnabled(connected != button.enabled);
+        }
+    }
+
+    private void init() {
+        toolbar.setFloatable(false);
+        for(Button button : Button.values()) {
+            JButton jbutton = button.createJButton(iconResource);
+            buttons.put(button, jbutton);
+            toolbar.add(jbutton);
+        }
+    }
+
+    public static enum Button {
+        connect("Connect",IconResource.ICON_START,true),
+        disconnect("Disconnect",IconResource.ICON_STOP,false),
+        refresh("Refresh",IconResource.ICON_REFRESH,false),
+        addNode("Add Node",IconResource.ICON_DOCUMENT_ADD,false),
+        deleteNode("Delete Node",IconResource.ICON_TRASH,false),
+        nodeViewers("Change Node Viewers",IconResource.ICON_ChangeNodeViewers,true),
+        about("About ZooInspector",IconResource.ICON_HELP_ABOUT,true);
+
+        private String toolTip;
+        private String icon;
+        private boolean enabled;
+
+        Button(String toolTip, String icon, boolean enabled) {
+            this.toolTip = toolTip;
+            this.icon = icon;
+            this.enabled = enabled;
+        }
+
+        public JButton createJButton(IconResource iconResource) {
+            JButton jbutton = new JButton(iconResource.get(icon, toolTip));
+            jbutton.setEnabled(enabled);
+            jbutton.setToolTipText(toolTip);
+            return jbutton;
+        }
+    }
+}

+ 2 - 3
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorAboutDialog.java

@@ -40,11 +40,10 @@ public class ZooInspectorAboutDialog extends JDialog {
      * @param frame
      *            - the Frame from which the dialog is displayed
      */
-    public ZooInspectorAboutDialog(Frame frame) {
+    public ZooInspectorAboutDialog(Frame frame, IconResource iconResource) {
         super(frame);
         this.setLayout(new BorderLayout());
-        this.setIconImage(ZooInspectorIconResources.getInformationIcon()
-                .getImage());
+        this.setIconImage(iconResource.get(IconResource.ICON_INFORMATION, "About ZooInspector").getImage());
         this.setTitle("About ZooInspector");
         this.setModal(true);
         this.setAlwaysOnTop(true);

+ 0 - 118
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorIconResources.java

@@ -1,118 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.inspector.gui;
-
-import javax.swing.ImageIcon;
-
-/**
- * A class containing static methods for retrieving {@link ImageIcon}s used in
- * the application
- */
-public class ZooInspectorIconResources {
-
-    /**
-     * @return file icon
-     */
-    public static ImageIcon getTreeLeafIcon() {
-        return new ImageIcon("icons/file_obj.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return folder open icon
-     */
-    public static ImageIcon getTreeOpenIcon() {
-        return new ImageIcon("icons/fldr_obj.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return folder closed icon
-     */
-    public static ImageIcon getTreeClosedIcon() {
-        return new ImageIcon("icons/fldr_obj.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return connect icon
-     */
-    public static ImageIcon getConnectIcon() {
-        return new ImageIcon("icons/launch_run.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return disconnect icon
-     */
-    public static ImageIcon getDisconnectIcon() {
-        return new ImageIcon("icons/launch_stop.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return save icon
-     */
-    public static ImageIcon getSaveIcon() {
-        return new ImageIcon("icons/save_edit.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return add icon
-     */
-    public static ImageIcon getAddNodeIcon() {
-        return new ImageIcon("icons/new_con.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return delete icon
-     */
-    public static ImageIcon getDeleteNodeIcon() {
-        return new ImageIcon("icons/trash.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return refresh icon
-     */
-    public static ImageIcon getRefreshIcon() {
-        return new ImageIcon("icons/refresh.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return information icon
-     */
-    public static ImageIcon getInformationIcon() {
-        return new ImageIcon("icons/info_obj.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return node viewers icon
-     */
-    public static ImageIcon getChangeNodeViewersIcon() {
-        return new ImageIcon("icons/edtsrclkup_co.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return up icon
-     */
-    public static ImageIcon getUpIcon() {
-        return new ImageIcon("icons/search_prev.gif"); //$NON-NLS-1$
-    }
-
-    /**
-     * @return down icon
-     */
-    public static ImageIcon getDownIcon() {
-        return new ImageIcon("icons/search_next.gif"); //$NON-NLS-1$
-    }
-}

+ 78 - 52
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorNodeViewersDialog.java

@@ -31,11 +31,14 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.swing.DefaultListCellRenderer;
 import javax.swing.DefaultListModel;
 import javax.swing.DropMode;
+import javax.swing.ImageIcon;
 import javax.swing.JButton;
 import javax.swing.JComponent;
 import javax.swing.JDialog;
@@ -51,6 +54,7 @@ import javax.swing.TransferHandler;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
 
+import org.apache.zookeeper.inspector.gui.Toolbar.Button;
 import org.apache.zookeeper.inspector.gui.nodeviewer.ZooInspectorNodeViewer;
 import org.apache.zookeeper.inspector.logger.LoggerFactory;
 import org.apache.zookeeper.inspector.manager.ZooInspectorManager;
@@ -62,16 +66,9 @@ import org.apache.zookeeper.inspector.manager.ZooInspectorManager;
 public class ZooInspectorNodeViewersDialog extends JDialog implements
         ListSelectionListener {
 
-    private final JButton upButton;
-    private final JButton downButton;
-    private final JButton removeButton;
-    private final JButton addButton;
     private final JList viewersList;
-    private final JButton saveFileButton;
-    private final JButton loadFileButton;
-    private final JButton setDefaultsButton;
     private final JFileChooser fileChooser = new JFileChooser(new File("."));
-
+    private final Map<Button, JButton> buttons = new HashMap<Button, JButton>();
     /**
      * @param frame
      *            - the Frame from which the dialog is displayed
@@ -87,12 +84,13 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
     public ZooInspectorNodeViewersDialog(Frame frame,
             final List<ZooInspectorNodeViewer> currentViewers,
             final Collection<NodeViewersChangeListener> listeners,
-            final ZooInspectorManager manager) {
+            final ZooInspectorManager manager,
+            final IconResource iconResource) {
         super(frame);
         final List<ZooInspectorNodeViewer> newViewers = new ArrayList<ZooInspectorNodeViewer>(
                 currentViewers);
         this.setLayout(new BorderLayout());
-        this.setIconImage(ZooInspectorIconResources.getChangeNodeViewersIcon()
+        this.setIconImage(iconResource.get(IconResource.ICON_ChangeNodeViewers,"")
                 .getImage());
         this.setTitle("About ZooInspector");
         this.setModal(true);
@@ -205,20 +203,13 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
         c1.ipadx = 0;
         c1.ipady = 0;
         panel.add(scroller, c1);
-        upButton = new JButton(ZooInspectorIconResources.getUpIcon());
-        downButton = new JButton(ZooInspectorIconResources.getDownIcon());
-        removeButton = new JButton(ZooInspectorIconResources
-                .getDeleteNodeIcon());
-        addButton = new JButton(ZooInspectorIconResources.getAddNodeIcon());
-        upButton.setEnabled(false);
-        downButton.setEnabled(false);
-        removeButton.setEnabled(false);
-        addButton.setEnabled(true);
-        upButton.setToolTipText("Move currently selected node viewer up");
-        downButton.setToolTipText("Move currently selected node viewer down");
-        removeButton.setToolTipText("Remove currently selected node viewer");
-        addButton.setToolTipText("Add node viewer");
+
         final JTextField newViewerTextField = new JTextField();
+
+        for(Button button : Button.values()) {
+            JButton jbutton = button.createJButton(iconResource);
+            buttons.put(button, jbutton);
+        }
         GridBagConstraints c2 = new GridBagConstraints();
         c2.gridx = 3;
         c2.gridy = 0;
@@ -231,7 +222,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
         c2.insets = new Insets(5, 5, 5, 5);
         c2.ipadx = 0;
         c2.ipady = 0;
-        panel.add(upButton, c2);
+        panel.add(buttons.get(Button.up), c2);
         GridBagConstraints c3 = new GridBagConstraints();
         c3.gridx = 3;
         c3.gridy = 2;
@@ -244,7 +235,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
         c3.insets = new Insets(5, 5, 5, 5);
         c3.ipadx = 0;
         c3.ipady = 0;
-        panel.add(downButton, c3);
+        panel.add(buttons.get(Button.down), c3);
         GridBagConstraints c4 = new GridBagConstraints();
         c4.gridx = 3;
         c4.gridy = 1;
@@ -257,7 +248,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
         c4.insets = new Insets(5, 5, 5, 5);
         c4.ipadx = 0;
         c4.ipady = 0;
-        panel.add(removeButton, c4);
+        panel.add(buttons.get(Button.remove), c4);
         GridBagConstraints c5 = new GridBagConstraints();
         c5.gridx = 0;
         c5.gridy = 3;
@@ -283,8 +274,8 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
         c6.insets = new Insets(5, 5, 5, 5);
         c6.ipadx = 0;
         c6.ipady = 0;
-        panel.add(addButton, c6);
-        upButton.addActionListener(new ActionListener() {
+        panel.add(buttons.get(Button.add), c6);
+        buttons.get(Button.up).addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {
                 DefaultListModel listModel = (DefaultListModel) viewersList
@@ -299,7 +290,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
                 }
             }
         });
-        downButton.addActionListener(new ActionListener() {
+        buttons.get(Button.down).addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {
                 DefaultListModel listModel = (DefaultListModel) viewersList
@@ -314,7 +305,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
                 }
             }
         });
-        removeButton.addActionListener(new ActionListener() {
+        buttons.get(Button.remove).addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {
                 DefaultListModel listModel = (DefaultListModel) viewersList
@@ -330,7 +321,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
                 }
             }
         });
-        addButton.addActionListener(new ActionListener() {
+        buttons.get(Button.add).addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {
                 String className = newViewerTextField.getText();
@@ -371,15 +362,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
                 }
             }
         });
-        saveFileButton = new JButton("Save");
-        loadFileButton = new JButton("Load");
-        setDefaultsButton = new JButton("Set As Defaults");
-        saveFileButton
-                .setToolTipText("Save current node viewer configuration to file");
-        loadFileButton
-                .setToolTipText("Load node viewer configuration frm file");
-        setDefaultsButton
-                .setToolTipText("Set current configuration asd defaults");
+
         GridBagConstraints c7 = new GridBagConstraints();
         c7.gridx = 0;
         c7.gridy = 4;
@@ -392,7 +375,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
         c7.insets = new Insets(5, 5, 5, 5);
         c7.ipadx = 0;
         c7.ipady = 0;
-        panel.add(saveFileButton, c7);
+        panel.add(buttons.get(Button.save), c7);
         GridBagConstraints c8 = new GridBagConstraints();
         c8.gridx = 1;
         c8.gridy = 4;
@@ -405,7 +388,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
         c8.insets = new Insets(5, 5, 5, 5);
         c8.ipadx = 0;
         c8.ipady = 0;
-        panel.add(loadFileButton, c8);
+        panel.add(buttons.get(Button.load), c8);
         GridBagConstraints c9 = new GridBagConstraints();
         c9.gridx = 2;
         c9.gridy = 4;
@@ -418,8 +401,8 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
         c9.insets = new Insets(5, 5, 5, 5);
         c9.ipadx = 0;
         c9.ipady = 0;
-        panel.add(setDefaultsButton, c9);
-        saveFileButton.addActionListener(new ActionListener() {
+        panel.add(buttons.get(Button.setDefaults), c9);
+        buttons.get(Button.save).addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {
                 int result = fileChooser
@@ -453,11 +436,11 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
                             LoggerFactory
                                     .getLogger()
                                     .error(
-                                            "Error saving node veiwer configuration from file.",
+                                            "Error saving node viewer configuration from file.",
                                             ex);
                             JOptionPane.showMessageDialog(
                                     ZooInspectorNodeViewersDialog.this,
-                                    "Error saving node veiwer configuration from file: "
+                                    "Error saving node viewer configuration from file: "
                                             + ex.getMessage(), "Error",
                                     JOptionPane.ERROR_MESSAGE);
                         }
@@ -465,7 +448,7 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
                 }
             }
         });
-        loadFileButton.addActionListener(new ActionListener() {
+        buttons.get(Button.load).addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {
                 int result = fileChooser
@@ -493,18 +476,18 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
                         LoggerFactory
                                 .getLogger()
                                 .error(
-                                        "Error loading node veiwer configuration from file.",
+                                        "Error loading node viewer configuration from file.",
                                         ex);
                         JOptionPane.showMessageDialog(
                                 ZooInspectorNodeViewersDialog.this,
-                                "Error loading node veiwer configuration from file: "
+                                "Error loading node viewer configuration from file: "
                                         + ex.getMessage(), "Error",
                                 JOptionPane.ERROR_MESSAGE);
                     }
                 }
             }
         });
-        setDefaultsButton.addActionListener(new ActionListener() {
+        buttons.get(Button.setDefaults).addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {
                 int answer = JOptionPane
@@ -530,11 +513,11 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
                         LoggerFactory
                                 .getLogger()
                                 .error(
-                                        "Error setting default node veiwer configuration.",
+                                        "Error setting default node viewer configuration.",
                                         ex);
                         JOptionPane.showMessageDialog(
                                 ZooInspectorNodeViewersDialog.this,
-                                "Error setting default node veiwer configuration: "
+                                "Error setting default node viewer configuration: "
                                         + ex.getMessage(), "Error",
                                 JOptionPane.ERROR_MESSAGE);
                     }
@@ -583,7 +566,11 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
      * .ListSelectionEvent)
      */
     public void valueChanged(ListSelectionEvent e) {
+        JButton removeButton = buttons.get(Button.remove);
+        JButton upButton = buttons.get(Button.up);
+        JButton downButton = buttons.get(Button.down);
         int index = viewersList.getSelectedIndex();
+
         if (index == -1) {
             removeButton.setEnabled(false);
             upButton.setEnabled(false);
@@ -602,4 +589,43 @@ public class ZooInspectorNodeViewersDialog extends JDialog implements
             }
         }
     }
+
+    public static enum Button {
+        up("Move currently selected node viewer up",IconResource.ICON_UP,false),
+        down("Move currently selected node viewer down",IconResource.ICON_DOWN,false),
+        add("Add node viewer",IconResource.ICON_ADD,true),
+        remove("Remove currently selected node viewer",IconResource.ICON_REMOVE,false),
+        save("Save current node viewer configuration to file","Save"),
+        load("Load node viewer configuration from file","Load"),
+        setDefaults("Set current configuration asd defaults","Set as defaults");
+
+        private String toolTip;
+        private String icon;
+        private boolean enabled;
+
+        Button(String toolTip, String icon, boolean enabled) {
+            this.toolTip = toolTip;
+            this.icon = icon;
+            this.enabled = enabled;
+        }
+
+        Button(String toolTip, String icon) {
+            this(toolTip, icon, true);
+        }
+
+        public JButton createJButton(IconResource iconResource) {
+            ImageIcon imageIcon = iconResource.get(icon, toolTip);
+            JButton jbutton;
+
+            if(imageIcon == null) {
+                jbutton = new JButton(icon);
+            } else {
+                jbutton = new JButton(imageIcon);
+            }
+
+            jbutton.setEnabled(enabled);
+            jbutton.setToolTipText(toolTip);
+            return jbutton;
+        }
+    }
 }

+ 20 - 63
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorPanel.java

@@ -43,16 +43,12 @@ import org.apache.zookeeper.inspector.manager.ZooInspectorManager;
  */
 public class ZooInspectorPanel extends JPanel implements
         NodeViewersChangeListener {
-    private final JButton refreshButton;
-    private final JButton disconnectButton;
-    private final JButton connectButton;
+    private final IconResource iconResource;
+    private final Toolbar toolbar;
     private final ZooInspectorNodeViewersPanel nodeViewersPanel;
     private final ZooInspectorTreeViewer treeViewer;
     private final ZooInspectorManager zooInspectorManager;
-    private final JButton addNodeButton;
-    private final JButton deleteNodeButton;
-    private final JButton nodeViewersButton;
-    private final JButton aboutButton;
+
     private final List<NodeViewersChangeListener> listeners = new ArrayList<NodeViewersChangeListener>();
     {
         listeners.add(this);
@@ -62,8 +58,10 @@ public class ZooInspectorPanel extends JPanel implements
      * @param zooInspectorManager
      *            - the {@link ZooInspectorManager} for the application
      */
-    public ZooInspectorPanel(final ZooInspectorManager zooInspectorManager) {
+    public ZooInspectorPanel(final ZooInspectorManager zooInspectorManager, final IconResource iconResource) {
         this.zooInspectorManager = zooInspectorManager;
+        this.iconResource = iconResource;
+        toolbar = new Toolbar(iconResource);
         final ArrayList<ZooInspectorNodeViewer> nodeViewers = new ArrayList<ZooInspectorNodeViewer>();
         try {
             List<String> defaultNodeViewersClassNames = this.zooInspectorManager
@@ -82,43 +80,10 @@ public class ZooInspectorPanel extends JPanel implements
         nodeViewersPanel = new ZooInspectorNodeViewersPanel(
                 zooInspectorManager, nodeViewers);
         treeViewer = new ZooInspectorTreeViewer(zooInspectorManager,
-                nodeViewersPanel);
+                nodeViewersPanel, iconResource);
         this.setLayout(new BorderLayout());
-        JToolBar toolbar = new JToolBar();
-        toolbar.setFloatable(false);
-        connectButton = new JButton(ZooInspectorIconResources.getConnectIcon());
-        disconnectButton = new JButton(ZooInspectorIconResources
-                .getDisconnectIcon());
-        refreshButton = new JButton(ZooInspectorIconResources.getRefreshIcon());
-        addNodeButton = new JButton(ZooInspectorIconResources.getAddNodeIcon());
-        deleteNodeButton = new JButton(ZooInspectorIconResources
-                .getDeleteNodeIcon());
-        nodeViewersButton = new JButton(ZooInspectorIconResources
-                .getChangeNodeViewersIcon());
-        aboutButton = new JButton(ZooInspectorIconResources
-                .getInformationIcon());
-        toolbar.add(connectButton);
-        toolbar.add(disconnectButton);
-        toolbar.add(refreshButton);
-        toolbar.add(addNodeButton);
-        toolbar.add(deleteNodeButton);
-        toolbar.add(nodeViewersButton);
-        toolbar.add(aboutButton);
-        aboutButton.setEnabled(true);
-        connectButton.setEnabled(true);
-        disconnectButton.setEnabled(false);
-        refreshButton.setEnabled(false);
-        addNodeButton.setEnabled(false);
-        deleteNodeButton.setEnabled(false);
-        nodeViewersButton.setEnabled(true);
-        nodeViewersButton.setToolTipText("Change Node Viewers");
-        aboutButton.setToolTipText("About ZooInspector");
-        connectButton.setToolTipText("Connect");
-        disconnectButton.setToolTipText("Disconnect");
-        refreshButton.setToolTipText("Refresh");
-        addNodeButton.setToolTipText("Add Node");
-        deleteNodeButton.setToolTipText("Delete Node");
-        connectButton.addActionListener(new ActionListener() {
+        
+        toolbar.addActionListener(Toolbar.Button.connect, new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 ZooInspectorConnectionPropertiesDialog zicpd = new ZooInspectorConnectionPropertiesDialog(
                         zooInspectorManager.getLastConnectionProps(),
@@ -127,17 +92,17 @@ public class ZooInspectorPanel extends JPanel implements
                 zicpd.setVisible(true);
             }
         });
-        disconnectButton.addActionListener(new ActionListener() {
+        toolbar.addActionListener(Toolbar.Button.disconnect, new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 disconnect();
             }
         });
-        refreshButton.addActionListener(new ActionListener() {
+        toolbar.addActionListener(Toolbar.Button.refresh, new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 treeViewer.refreshView();
             }
         });
-        addNodeButton.addActionListener(new ActionListener() {
+        toolbar.addActionListener(Toolbar.Button.addNode, new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 final List<String> selectedNodes = treeViewer
                         .getSelectedNodes();
@@ -169,7 +134,7 @@ public class ZooInspectorPanel extends JPanel implements
                 }
             }
         });
-        deleteNodeButton.addActionListener(new ActionListener() {
+        toolbar.addActionListener(Toolbar.Button.deleteNode, new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 final List<String> selectedNodes = treeViewer
                         .getSelectedNodes();
@@ -205,19 +170,19 @@ public class ZooInspectorPanel extends JPanel implements
                 }
             }
         });
-        nodeViewersButton.addActionListener(new ActionListener() {
+        toolbar.addActionListener(Toolbar.Button.nodeViewers, new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {
                 ZooInspectorNodeViewersDialog nvd = new ZooInspectorNodeViewersDialog(
                         JOptionPane.getRootFrame(), nodeViewers, listeners,
-                        zooInspectorManager);
+                        zooInspectorManager, iconResource);
                 nvd.setVisible(true);
             }
         });
-        aboutButton.addActionListener(new ActionListener() {
+        toolbar.addActionListener(Toolbar.Button.about, new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 ZooInspectorAboutDialog zicpd = new ZooInspectorAboutDialog(
-                        JOptionPane.getRootFrame());
+                        JOptionPane.getRootFrame(), iconResource);
                 zicpd.setVisible(true);
             }
         });
@@ -226,7 +191,7 @@ public class ZooInspectorPanel extends JPanel implements
                 treeScroller, nodeViewersPanel);
         splitPane.setResizeWeight(0.25);
         this.add(splitPane, BorderLayout.CENTER);
-        this.add(toolbar, BorderLayout.NORTH);
+        this.add(toolbar.getJToolBar(), BorderLayout.NORTH);
     }
 
     /**
@@ -248,11 +213,7 @@ public class ZooInspectorPanel extends JPanel implements
                 try {
                     if (get()) {
                         treeViewer.refreshView();
-                        connectButton.setEnabled(false);
-                        disconnectButton.setEnabled(true);
-                        refreshButton.setEnabled(true);
-                        addNodeButton.setEnabled(true);
-                        deleteNodeButton.setEnabled(true);
+                        toolbar.toggleButtons(true);
                     } else {
                         JOptionPane.showMessageDialog(ZooInspectorPanel.this,
                                 "Unable to connect to zookeeper", "Error",
@@ -302,11 +263,7 @@ public class ZooInspectorPanel extends JPanel implements
                 try {
                     if (get()) {
                         treeViewer.clearView();
-                        connectButton.setEnabled(true);
-                        disconnectButton.setEnabled(false);
-                        refreshButton.setEnabled(false);
-                        addNodeButton.setEnabled(false);
-                        deleteNodeButton.setEnabled(false);
+                        toolbar.toggleButtons(false);
                     }
                 } catch (InterruptedException e) {
                     LoggerFactory

+ 10 - 16
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/ZooInspectorTreeViewer.java

@@ -31,6 +31,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.swing.ImageIcon;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
@@ -56,6 +57,7 @@ public class ZooInspectorTreeViewer extends JPanel implements NodeListener {
     private final ZooInspectorManager zooInspectorManager;
     private final JTree tree;
     private final Toaster toasterManager;
+    private final ImageIcon toasterIcon;
 
     /**
      * @param zooInspectorManager
@@ -66,7 +68,7 @@ public class ZooInspectorTreeViewer extends JPanel implements NodeListener {
      */
     public ZooInspectorTreeViewer(
             final ZooInspectorManager zooInspectorManager,
-            TreeSelectionListener listener) {
+            TreeSelectionListener listener, IconResource iconResource) {
         this.zooInspectorManager = zooInspectorManager;
         this.setLayout(new BorderLayout());
         final JPopupMenu popupMenu = new JPopupMenu();
@@ -75,6 +77,7 @@ public class ZooInspectorTreeViewer extends JPanel implements NodeListener {
         this.toasterManager.setBorderColor(Color.BLACK);
         this.toasterManager.setMessageColor(Color.BLACK);
         this.toasterManager.setToasterColor(Color.WHITE);
+        toasterIcon = iconResource.get(IconResource.ICON_INFORMATION,"");
         addNotify.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 List<String> selectedNodes = getSelectedNodes();
@@ -91,7 +94,7 @@ public class ZooInspectorTreeViewer extends JPanel implements NodeListener {
             }
         });
         tree = new JTree(new DefaultMutableTreeNode());
-        tree.setCellRenderer(new ZooInspectorTreeCellRenderer());
+        tree.setCellRenderer(new ZooInspectorTreeCellRenderer(iconResource));
         tree.setEditable(false);
         tree.getSelectionModel().addTreeSelectionListener(listener);
         tree.addMouseListener(new MouseAdapter() {
@@ -152,23 +155,15 @@ public class ZooInspectorTreeViewer extends JPanel implements NodeListener {
         tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode()));
     }
 
-    /**
-     * @author Colin
-     * 
-     */
     private static class ZooInspectorTreeCellRenderer extends
             DefaultTreeCellRenderer {
-        public ZooInspectorTreeCellRenderer() {
-            setLeafIcon(ZooInspectorIconResources.getTreeLeafIcon());
-            setOpenIcon(ZooInspectorIconResources.getTreeOpenIcon());
-            setClosedIcon(ZooInspectorIconResources.getTreeClosedIcon());
+        public ZooInspectorTreeCellRenderer(IconResource iconResource) {
+            setLeafIcon(iconResource.get(IconResource.ICON_TREE_LEAF,""));
+            setOpenIcon(iconResource.get(IconResource.ICON_TREE_OPEN,""));
+            setClosedIcon(iconResource.get(IconResource.ICON_TREE_CLOSE,""));
         }
     }
 
-    /**
-     * @author Colin
-     * 
-     */
     private class ZooInspectorTreeNode implements TreeNode {
         private final String nodePath;
         private final String nodeName;
@@ -356,7 +351,6 @@ public class ZooInspectorTreeViewer extends JPanel implements NodeListener {
                 sb.append(entry.getValue());
             }
         }
-        this.toasterManager.showToaster(ZooInspectorIconResources
-                .getInformationIcon(), sb.toString());
+        this.toasterManager.showToaster(toasterIcon, sb.toString());
     }
 }

+ 3 - 7
src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/gui/nodeviewer/NodeViewerData.java

@@ -30,7 +30,7 @@ import javax.swing.JTextPane;
 import javax.swing.JToolBar;
 import javax.swing.SwingWorker;
 
-import org.apache.zookeeper.inspector.gui.ZooInspectorIconResources;
+import org.apache.zookeeper.inspector.gui.IconResource;
 import org.apache.zookeeper.inspector.logger.LoggerFactory;
 import org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager;
 
@@ -43,10 +43,7 @@ public class NodeViewerData extends ZooInspectorNodeViewer {
     private final JToolBar toolbar;
     private String selectedNode;
 
-    /**
-	 * 
-	 */
-    public NodeViewerData() {
+    public NodeViewerData(IconResource iconResource) {
         this.setLayout(new BorderLayout());
         this.dataArea = new JTextPane();
         this.toolbar = new JToolBar();
@@ -56,8 +53,7 @@ public class NodeViewerData extends ZooInspectorNodeViewer {
                 .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
         this.add(scroller, BorderLayout.CENTER);
         this.add(this.toolbar, BorderLayout.NORTH);
-        JButton saveButton = new JButton(ZooInspectorIconResources
-                .getSaveIcon());
+        JButton saveButton = new JButton(iconResource.get(IconResource.ICON_SAVE,""));
         saveButton.addActionListener(new ActionListener() {
 
             public void actionPerformed(ActionEvent e) {

BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/add.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/document-new.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/document-save.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/down.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/media-playback-start.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/media-playback-stop.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/remove.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/up.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/actions/view-refresh.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/mimetypes/text-x-generic.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/places/folder.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/places/user-trash.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/16x16/status/info.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/add.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/document-new.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/document-save.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/down.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/media-playback-start.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/media-playback-stop.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/remove.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/up.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/actions/view-refresh.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/mimetypes/text-x-generic.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/places/folder.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/places/user-trash.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/22x22/status/info.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/add.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/document-new.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/document-save.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/down.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/media-playback-start.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/media-playback-stop.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/remove.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/up.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/actions/view-refresh.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/mimetypes/text-x-generic.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/places/folder.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/places/user-trash.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/24x24/status/info.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/add.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/document-new.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/document-save.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/down.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/media-playback-start.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/media-playback-stop.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/remove.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/up.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/actions/view-refresh.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/mimetypes/text-x-generic.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/places/folder.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/places/user-trash.png


BIN
src/contrib/zooinspector/src/main/resources/icons/Tango/32x32/status/info.png


+ 18 - 18
src/contrib/zooinspector/zooInspector-dev.sh

@@ -1,18 +1,18 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-         
-java -cp ../../../build/contrib/ZooInspector/zookeeper-dev-ZooInspector.jar:../../../build/lib/log4j-1.2.15.jar:lib/zookeeper-3.3.0.jar:lib/jtoaster-1.0.4.jar:lib org.apache.zookeeper.inspector.ZooInspector
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+         
+java -cp ../../../build/contrib/ZooInspector/*:../../../build/*:../../../build/lib/*:lib org.apache.zookeeper.inspector.ZooInspector

+ 1 - 1
src/contrib/zooinspector/zooInspector.cmd

@@ -15,4 +15,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-java -cp zookeeper-dev-ZooInspector.jar;lib/log4j-1.2.15.jar;lib/zookeeper-3.3.0.jar;lib/jToaster-1.0.4.jar;lib org.apache.zookeeper.inspector.ZooInspector
+java -cp zookeeper-dev-ZooInspector.jar;lib/log4j-1.2.15.jar;lib/zookeeper-3.5.0.jar;lib org.apache.zookeeper.inspector.ZooInspector

+ 1 - 1
src/contrib/zooinspector/zooInspector.sh

@@ -15,4 +15,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-java -cp lib/New.jar:zookeeper-dev-ZooInspector.jar:lib/log4j-1.2.15.jar:;lib/zookeeper-3.3.0.jar:lib/jToaster-1.0.4.jar:lib org.apache.zookeeper.inspector.ZooInspector
+java -cp zookeeper-dev-ZooInspector.jar:lib/log4j-1.2.15.jar:lib/zookeeper-3.5.0.jar:lib org.apache.zookeeper.inspector.ZooInspector