cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject svn commit: r357151 - in /cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder: block/Block.java block/Blocks.java menu/BuildMenu.java menu/ConsoleMenuBar.java menu/LogConsoleListener.java properties/PropertiesManager.java
Date Fri, 16 Dec 2005 11:42:11 GMT
Author: ugo
Date: Fri Dec 16 03:41:56 2005
New Revision: 357151

URL: http://svn.apache.org/viewcvs?rev=357151&view=rev
Log:
- now lf5 factory for log works
- build full eclipse project works
- improved block description, relative to dependencies


Modified:
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/BuildMenu.java
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/ConsoleMenuBar.java
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/LogConsoleListener.java
    cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java

Modified: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java?rev=357151&r1=357150&r2=357151&view=diff
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java (original)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Block.java Fri Dec 16 03:41:56
2005
@@ -30,11 +30,39 @@
     public static final String STATUS_UNSTABLE = "unstable";
     public static final String STATUS_DEPRECATED = "deprecated";
     
+    /**
+     * The name of the block
+     */
     private String name;
+    
+    /**
+     * The description
+     */
     private String description;
+    
+    /**
+     * The status
+     */
     private String status;
+    
+    /**
+     * List of the blocks that must be selected for select this
+     */
     private List dependencies;
+    
+    /**
+     * List of the blocks that must be deselected when toggle this selection
+     */
+    private List needer; 
+    
+    /**
+     * The number of how many blocks need this, used for enable/disable the checkbox
+     */
     private int need = 0;
+    
+    /**
+     * If the block is selected
+     */
     private boolean selected;
     
     public Block() {
@@ -101,6 +129,10 @@
         this.status = status;
     }
     
+    /**
+     * Add a block in the dependecies list
+     * @param dependency The block's name
+     */
     public void addDependency(String dependency) {
         if (this.getDependencies() == null) {
             this.setDependencies(new ArrayList());            
@@ -109,6 +141,33 @@
     }
     
     /**
+     * Set the {@link List} of the needer
+     * @param needer The list
+     */
+    public void setNeeder(List needer) {
+        this.needer = needer;
+    }
+    
+    /**
+     * Get the list of the needer.
+     * @return The list
+     */
+    public List getNeeder() {
+        return this.needer;
+    }
+    
+    /**
+     * Add a block in the needer list
+     * @param needer The block's name
+     */
+    public void addNeeder(String needer) {
+        if (this.getNeeder() == null) {
+            this.setNeeder(new ArrayList());
+        }
+        this.getNeeder().add(needer);
+    }
+    
+    /**
      * @return Returns the selected.
      */
     public boolean isSelected() {
@@ -151,8 +210,21 @@
                     sb.append(", ");
                 }
             }
-            sb.append("</p> -oOo-<br>");
-        } 
+            sb.append("</p>");
+        }
+        if (this.getNeeder() != null) {
+            sb.append("<p><b>Used by:</b> ");
+            for (int i=0; i<this.getNeeder().size(); i++) {
+                sb.append("<i>" + this.getNeeder().get(i) + "</i>");
+                if (i != this.getNeeder().size()-1) {
+                    sb.append(", ");
+                }
+            }
+            sb.append("</p>");
+        }
+        if (this.getDependencies() != null || this.getNeeder() != null) {
+            sb.append(" -oOo-<br>");
+        }
         sb.append(this.description);
         return sb.toString();
     }

Modified: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java?rev=357151&r1=357150&r2=357151&view=diff
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java (original)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/block/Blocks.java Fri Dec 16
03:41:56 2005
@@ -125,6 +125,12 @@
                     }
                 }
             }
+            if (block.getDependencies() != null) {
+                for (int i=0; i<block.getDependencies().size(); i++) {
+                    Block dependency = (Block) getBlocks().get(block.getDependencies().get(i));
+                    dependency.addNeeder(block.getName());
+                }
+            }
         }
     }
     

Modified: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/BuildMenu.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/BuildMenu.java?rev=357151&r1=357150&r2=357151&view=diff
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/BuildMenu.java (original)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/BuildMenu.java Fri Dec 16
03:41:56 2005
@@ -45,7 +45,7 @@
         eclipse.add(eclipseCustom);
         JMenuItem eclipseAll = new JMenuItem("All Blocks");
         eclipseAll.setMnemonic('A');
-        eclipseAll.setActionCommand("-Dinclude.all.blocks=true eclipse-project");
+        eclipseAll.setActionCommand("full-eclipse-project");
         eclipseAll.addActionListener(listener);
         eclipse.add(eclipseAll);
         this.add(eclipse);

Modified: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/ConsoleMenuBar.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/ConsoleMenuBar.java?rev=357151&r1=357150&r2=357151&view=diff
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/ConsoleMenuBar.java (original)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/ConsoleMenuBar.java Fri
Dec 16 03:41:56 2005
@@ -23,7 +23,7 @@
 
     public ConsoleMenuBar() {
         this.add(new BuildMenu());
-        // this.add(new ToolsMenu());        
+        this.add(new ToolsMenu());        
     }
 
 }

Modified: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/LogConsoleListener.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/LogConsoleListener.java?rev=357151&r1=357150&r2=357151&view=diff
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/LogConsoleListener.java
(original)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/menu/LogConsoleListener.java
Fri Dec 16 03:41:56 2005
@@ -32,11 +32,13 @@
 public class LogConsoleListener implements ItemListener {
     
     //This path was taken from build.webapp property
-    private String logConfigurationFile = 
-        PropertiesManager.getBuildProperties().getProperty("build.webapp") 
-        + "WEB-INF/logkit.xconf";
+    private String logConfigurationFile;
     
     public LogConsoleListener() {
+        String webinfPath = PropertiesManager.getBuildProperties().getProperty("build.webapp.webinf");
+        this.logConfigurationFile =  
+            PropertiesManager.resolveValue(PropertiesManager.getBuildProperties(), webinfPath)

+                    + "/logkit.xconf";
     }
     
     public boolean isSelected() {

Modified: cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java?rev=357151&r1=357150&r2=357151&view=diff
==============================================================================
--- cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java
(original)
+++ cocoon/whiteboard/guilder/java/org/apache/cocoon/guilder/properties/PropertiesManager.java
Fri Dec 16 03:41:56 2005
@@ -30,6 +30,9 @@
  */
 public class PropertiesManager {
     
+    private static final String   VARIABLE_START_TAG = "${";
+    private static final String   VARIABLE_END_TAG   = "}";
+
     public static final String BLOCKS_PROPERTIES_PATH = "blocks.properties";
     public static final String LOCAL_BLOCKS_PROPERTIES_PATH = "local.blocks.properties";
     public static final String BUILD_PROPERTIES_PATH = "build.properties";
@@ -97,4 +100,36 @@
         return buildProperties;
     }
     
+    /**
+     * Get the value by resolving all variables contained in the value passed
+     *
+     * @param iValue
+     * @return Expanded value
+     */
+    public static String resolveValue(Properties properties, String property) {
+        if (property == null || property.length() == 0) {
+            return null;            
+        }
+        int startVar = property.indexOf(VARIABLE_START_TAG);
+        if (startVar == -1) {
+            return property;            
+        }
+        StringBuffer value = new StringBuffer();
+        int endVar;
+        //COPY ALL BEFORE START VARIABLE TAG
+        value.append(property.substring(0, startVar));
+        endVar = property.indexOf(VARIABLE_END_TAG, startVar);
+        if (endVar == -1) {
+            throw new IllegalArgumentException(
+                    "Error on resolving property: Missed '" + VARIABLE_END_TAG
+                      + "' tag in " + property.substring(startVar));
+        }
+        String varName = property.substring(startVar + VARIABLE_START_TAG.length(), endVar);
+        String varValue = properties.getProperty(varName);
+        varValue = resolveValue(properties, varValue);
+        value.append(varValue);
+        value.append(property.substring(endVar + VARIABLE_END_TAG.length()));
+        return value.toString();
+    }
+
 }



Mime
View raw message