From adffaces-commits-return-648-apmail-incubator-adffaces-commits-archive=incubator.apache.org@incubator.apache.org Wed Aug 16 07:01:08 2006 Return-Path: Delivered-To: apmail-incubator-adffaces-commits-archive@locus.apache.org Received: (qmail 1428 invoked from network); 16 Aug 2006 07:01:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Aug 2006 07:01:08 -0000 Received: (qmail 66439 invoked by uid 500); 16 Aug 2006 07:01:01 -0000 Delivered-To: apmail-incubator-adffaces-commits-archive@incubator.apache.org Received: (qmail 66404 invoked by uid 500); 16 Aug 2006 07:00:56 -0000 Mailing-List: contact adffaces-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: adffaces-dev@incubator.apache.org Delivered-To: mailing list adffaces-commits@incubator.apache.org Received: (qmail 66377 invoked by uid 99); 16 Aug 2006 07:00:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Aug 2006 00:00:55 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Aug 2006 00:00:51 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 2F86D1A9820; Wed, 16 Aug 2006 00:00:31 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r431848 [3/6] - in /incubator/adffaces/trunk/trinidad: ./ trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ trinidad-api/src/main/java/org/apache/myfaces... Date: Wed, 16 Aug 2006 07:00:19 -0000 To: adffaces-commits@incubator.apache.org From: awiner@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060816070031.2F86D1A9820@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/ItemNode.java URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/ItemNode.java?rev=431848&r1=431847&r2=431848&view=diff ============================================================================== --- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/ItemNode.java (original) +++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/ItemNode.java Wed Aug 16 00:00:16 2006 @@ -1,424 +1,426 @@ -/* -* @(#)ItemNode.java -* -* Copyright 2006 The Apache Software Foundation. -* -* Licensed 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.myfaces.trinidadinternal.menu; - -import javax.faces.webapp.UIComponentTag; - -/** - * Code specific to a Menu Model's ItemNode. - * - * @author Gary Kind - */ - -public class ItemNode extends MenuNode -{ - /** - * Constructs an ItemNode - */ - public ItemNode() - { - super(); - } - - /** - * Sets the action of the node. This is obtained from the menu - * metadata file and is the string value of the "action" - * property. - * - * @param action - the string value of the ItemNode's "action" property. - */ - - public void setAction(String action) - { - _action = action; - } - - /** - * Gets the value of the node's action property. The action attr value - * could be one of 2 things: - * 1) An EL expression - * 2) An outcome referencing a navigation rule in the faces_config file. - * - * Since this method is called only when an ItemNode is clicked, the model - * is notified that this node is the currently selected node. - * - * @return String value of the ItemNode's "action" property. - */ - public String doAction() - { - String value = _action; - - // Could be EL expression - if ( value != null - && UIComponentTag.isValueReference(value) - ) - { - // Value of action is EL method binding, so we - // need to evaluate it - value = (String)MenuUtils.getBoundValue(value); - } - - // Post me as the selected Node for the request - postSelectedNode(this); - - return value; - } - - /** - * setActionListener - sets the value of the Menu Node's actionListener - * atribute. - * - * @param actionListener - El expression method reference to an - * action listener - */ - public void setActionListener(String actionListener) - { - _actionListener = actionListener; - } - - /** - * getActionListener - gets the value of the Menu Node's actionListener - * attribute. - * - * @return String - method reference to an - * action listener - */ - public String getActionListener() - { - String value = _actionListener; - - // Could be EL expression - if ( value != null - && UIComponentTag.isValueReference(value) - ) - { - // Value of action is EL method binding, so we - // need to evaluate it - value = (String)MenuUtils.getBoundValue(value); - setActionListener(value); - } - - return value; - } - - /** - * setLaunchListener - sets the value of the Menu Node's launchListener - * atribute. - * - * @param launchListener - El expression method reference to a - * launch listener - */ - public void setLaunchListener(String launchListener) - { - _launchListener = launchListener; - } - - /** - * getLaunchListener - gets the value of the Menu Node's launchListener - * attribute. - * - * @return String - method reference to an - * launch listener - */ - public String getLaunchListener() - { - String value = _launchListener; - - // Could be EL expression - if ( value != null - && UIComponentTag.isValueReference(value) - ) - { - // Value of action is EL method binding, so we - // need to evaluate it - value = (String)MenuUtils.getBoundValue(value); - setLaunchListener(value); - } - - return value; - } - - /** - * setReturnListener - sets the value of the Menu Node's returnListener - * atribute. - * - * @param returnListener - El expression method reference to a - * return listener - */ - public void setReturnListener(String returnListener) - { - _returnListener = returnListener; - } - - /** - * getReturnListener - gets the value of the Menu Node's returnListener - * attribute. - * - * @return String - method reference to an - * return listener - */ - public String getReturnListener() - { - String value = _returnListener; - - // Could be EL expression - if ( value != null - && UIComponentTag.isValueReference(value) - ) - { - // Value of action is EL method binding, so we - // need to evaluate it - value = (String)MenuUtils.getBoundValue(value); - setReturnListener(value); - } - - return value; - } - - /** - * Sets the immediate attribute of the menu item. - * - * @param immediate - boolean indicating whether or not data validation - - * client-side or server-side - should take place when - * events are generated by this component. - */ - public void setImmediate(boolean immediate) - { - _immediateStr = immediate ? "true" : "false"; - } - - /** - * Sets the immediate attribute of the menu item. - * - * @param immediateStr - string representing a boolean value - * or an EL expression - */ - public void setImmediate(String immediateStr) - { - _immediateStr = immediateStr; - } - - /** - * Gets the immediate attribute of the menu item. - * - * @return boolean - indicating whether or not data validation - - * client-side or server-side - should take place when events - * are generated by this component. - */ - public boolean getImmediate() - { - boolean immediate = MenuUtils.evalBoolean(_immediateStr, false); - return immediate; - } - - /** - * Sets the useWindow attribute of the menu item. - * - * @param useWindow - boolean indicating whether - * or not to use a new window when launching dialogs. - */ - public void setUseWindow(boolean useWindow) - { - _useWindowStr = useWindow ? "true" : "false"; - } - - /** - * Sets the useWindow attribute of the menu item. - * - * @param useWindowStr - string representing a boolean value or - * an EL Expression - */ - public void setUseWindow(String useWindowStr) - { - _useWindowStr = useWindowStr; - } - - /** - * Gets the useWindow attribute of the menu item. - * - * @return boolean - indicating whether - * or not to use a new window when launching dialogs. - */ - public boolean getUseWindow() - { - boolean useWindow = MenuUtils.evalBoolean(_useWindowStr, false); - return useWindow; - } - - /** - * Sets the windowHeight attribute of the menu item. - * - * @param windowHeight - int height of the window, if - * this command is used to launch a window. - */ - public void setWindowHeight(int windowHeight) - { - _windowHeightStr = Integer.toString(windowHeight); - } - - /** - * Sets the windowHeight attribute of the menu item. - * - * @param windowHeightStr - String Height of the window, if - * this command is used to launch a window. Could be an - * EL expression - */ - public void setWindowHeight(String windowHeightStr) - { - _windowHeightStr = windowHeightStr; - } - - /** - * Gets the windowHeight attribute of the menu item. - * - * @return int height of the window, if - * this command is used to launch a window. - */ - public int getWindowHeight() - { - int windowHeight = MenuUtils.evalInt(_windowHeightStr); - return windowHeight; - } - - /** - * Sets the windowWidth attribute of the menu item. - * - * @param windowWidth - int width of the window, if - * this command is used to launch a window. - */ - public void setWindowWidth(int windowWidth) - { - _windowWidthStr = Integer.toString(windowWidth); - } - - /** - * Sets the windowWidth attribute of the menu item. - * - * @param windowWidthStr - String width of the window, if - * this command is used to launch a window. Could be an - * EL expression - */ - public void setWindowWidth(String windowWidthStr) - { - _windowWidthStr = windowWidthStr; - } - - /** - * Gets the windowWidth attribute of the menu item. - * - * @return int width of the window, if - * this command is used to launch a window. - */ - public int getWindowWidth() - { - int windowWidth = MenuUtils.evalInt(_windowWidthStr); - return windowWidth; - } - - /** - * Sets the destination of the node. - * - * This is obtained from the metadata file and is the string - * value of the "destination" property. - * - * @param destination - either a URI or an EL method binding expression. - */ - public void setDestination(String destination) - { - _destination = destination; - } - - /** - * Gets the value of the node's destination property. - * The destination attr value could be one of 2 things: - * 1) a uri - * 2) An EL expression - * - * So that the model can identify this node as the currently selected - * node, the node's id is appended to the destination as a parameter - * that is picked up when the getFocusRowKey() method of the model - * is called to get the focus path. - * - * @return destination - the String value of the destinationNode's - * "destination" property. - */ - public String getDestination() - { - String value = _destination; - - // Could be EL expression - if ( value != null - && UIComponentTag.isValueReference(value) - ) - { - // Value of action is EL method binding, so we - // need to evaluate it - value = (String)MenuUtils.getBoundValue(value); - } - - // Appending nodeId to URL so that we can identify the node - // when getFocusRowKey() is called on the model. - return value != null ? value + "?nodeId=" + getId() : value; - } - - /** - * setTargetFrame - sets the value of the Destination Node's - * targetFrame attribute - * - * @param targetFrame - the target frame for the goCommandMenuItem. - */ - public void setTargetFrame(String targetFrame) - { - _targetFrame = targetFrame; - } - - /** - * getTargetFrame - gets the value of the Destination Node's - * targetFrame attribute - * - * @return the target frame for the goCommandMenuItem. - */ - public String getTargetFrame() - { - String value = _targetFrame; - - // Could be EL expression - if ( value != null - && UIComponentTag.isValueReference(value) - ) - { - // Value of destination is EL value binding, so we - // need to evaluate it - value = (String)MenuUtils.getBoundValue(value); - setTargetFrame(value); - } - - return value; - } - - private String _destination = null; - private String _targetFrame = null; - private String _action = null; - private String _actionListener = null; - private String _launchListener = null; - private String _returnListener = null; - private String _immediateStr = null; - private String _useWindowStr = null; - private String _windowHeightStr = null; - private String _windowWidthStr = null; -} +/* +* @(#)ItemNode.java +* +* Copyright 2006 The Apache Software Foundation. +* +* Licensed 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.myfaces.trinidadinternal.menu; + +import javax.faces.webapp.UIComponentTag; + +/** + * Code specific to a Menu Model's ItemNode. + * + * @author Gary Kind + */ + +public class ItemNode extends MenuNode +{ + /** + * Constructs an ItemNode + */ + public ItemNode() + { + super(); + } + + /** + * Sets the action of the node. This is obtained from the menu + * metadata file and is the string value of the "action" + * property. + * + * @param action - the string value of the ItemNode's "action" property. + */ + + public void setAction(String action) + { + _action = action; + } + + /** + * Gets the value of the node's action property. The action attr value + * could be one of 2 things: + * 1) An EL expression + * 2) An outcome referencing a navigation rule in the faces_config file. + * + * Since this method is called only when an ItemNode is clicked, the model + * is notified that this node is the currently selected node. + * + * @return String value of the ItemNode's "action" property. + */ + @Override + public String doAction() + { + String value = _action; + + // Could be EL expression + if ( value != null + && UIComponentTag.isValueReference(value) + ) + { + // Value of action is EL method binding, so we + // need to evaluate it + value = (String)MenuUtils.getBoundValue(value); + } + + // Post me as the selected Node for the request + postSelectedNode(this); + + return value; + } + + /** + * setActionListener - sets the value of the Menu Node's actionListener + * atribute. + * + * @param actionListener - El expression method reference to an + * action listener + */ + public void setActionListener(String actionListener) + { + _actionListener = actionListener; + } + + /** + * getActionListener - gets the value of the Menu Node's actionListener + * attribute. + * + * @return String - method reference to an + * action listener + */ + public String getActionListener() + { + String value = _actionListener; + + // Could be EL expression + if ( value != null + && UIComponentTag.isValueReference(value) + ) + { + // Value of action is EL method binding, so we + // need to evaluate it + value = (String)MenuUtils.getBoundValue(value); + setActionListener(value); + } + + return value; + } + + /** + * setLaunchListener - sets the value of the Menu Node's launchListener + * atribute. + * + * @param launchListener - El expression method reference to a + * launch listener + */ + public void setLaunchListener(String launchListener) + { + _launchListener = launchListener; + } + + /** + * getLaunchListener - gets the value of the Menu Node's launchListener + * attribute. + * + * @return String - method reference to an + * launch listener + */ + public String getLaunchListener() + { + String value = _launchListener; + + // Could be EL expression + if ( value != null + && UIComponentTag.isValueReference(value) + ) + { + // Value of action is EL method binding, so we + // need to evaluate it + value = (String)MenuUtils.getBoundValue(value); + setLaunchListener(value); + } + + return value; + } + + /** + * setReturnListener - sets the value of the Menu Node's returnListener + * atribute. + * + * @param returnListener - El expression method reference to a + * return listener + */ + public void setReturnListener(String returnListener) + { + _returnListener = returnListener; + } + + /** + * getReturnListener - gets the value of the Menu Node's returnListener + * attribute. + * + * @return String - method reference to an + * return listener + */ + public String getReturnListener() + { + String value = _returnListener; + + // Could be EL expression + if ( value != null + && UIComponentTag.isValueReference(value) + ) + { + // Value of action is EL method binding, so we + // need to evaluate it + value = (String)MenuUtils.getBoundValue(value); + setReturnListener(value); + } + + return value; + } + + /** + * Sets the immediate attribute of the menu item. + * + * @param immediate - boolean indicating whether or not data validation - + * client-side or server-side - should take place when + * events are generated by this component. + */ + public void setImmediate(boolean immediate) + { + _immediateStr = immediate ? "true" : "false"; + } + + /** + * Sets the immediate attribute of the menu item. + * + * @param immediateStr - string representing a boolean value + * or an EL expression + */ + public void setImmediate(String immediateStr) + { + _immediateStr = immediateStr; + } + + /** + * Gets the immediate attribute of the menu item. + * + * @return boolean - indicating whether or not data validation - + * client-side or server-side - should take place when events + * are generated by this component. + */ + public boolean getImmediate() + { + boolean immediate = MenuUtils.evalBoolean(_immediateStr, false); + return immediate; + } + + /** + * Sets the useWindow attribute of the menu item. + * + * @param useWindow - boolean indicating whether + * or not to use a new window when launching dialogs. + */ + public void setUseWindow(boolean useWindow) + { + _useWindowStr = useWindow ? "true" : "false"; + } + + /** + * Sets the useWindow attribute of the menu item. + * + * @param useWindowStr - string representing a boolean value or + * an EL Expression + */ + public void setUseWindow(String useWindowStr) + { + _useWindowStr = useWindowStr; + } + + /** + * Gets the useWindow attribute of the menu item. + * + * @return boolean - indicating whether + * or not to use a new window when launching dialogs. + */ + public boolean getUseWindow() + { + boolean useWindow = MenuUtils.evalBoolean(_useWindowStr, false); + return useWindow; + } + + /** + * Sets the windowHeight attribute of the menu item. + * + * @param windowHeight - int height of the window, if + * this command is used to launch a window. + */ + public void setWindowHeight(int windowHeight) + { + _windowHeightStr = Integer.toString(windowHeight); + } + + /** + * Sets the windowHeight attribute of the menu item. + * + * @param windowHeightStr - String Height of the window, if + * this command is used to launch a window. Could be an + * EL expression + */ + public void setWindowHeight(String windowHeightStr) + { + _windowHeightStr = windowHeightStr; + } + + /** + * Gets the windowHeight attribute of the menu item. + * + * @return int height of the window, if + * this command is used to launch a window. + */ + public int getWindowHeight() + { + int windowHeight = MenuUtils.evalInt(_windowHeightStr); + return windowHeight; + } + + /** + * Sets the windowWidth attribute of the menu item. + * + * @param windowWidth - int width of the window, if + * this command is used to launch a window. + */ + public void setWindowWidth(int windowWidth) + { + _windowWidthStr = Integer.toString(windowWidth); + } + + /** + * Sets the windowWidth attribute of the menu item. + * + * @param windowWidthStr - String width of the window, if + * this command is used to launch a window. Could be an + * EL expression + */ + public void setWindowWidth(String windowWidthStr) + { + _windowWidthStr = windowWidthStr; + } + + /** + * Gets the windowWidth attribute of the menu item. + * + * @return int width of the window, if + * this command is used to launch a window. + */ + public int getWindowWidth() + { + int windowWidth = MenuUtils.evalInt(_windowWidthStr); + return windowWidth; + } + + /** + * Sets the destination of the node. + * + * This is obtained from the metadata file and is the string + * value of the "destination" property. + * + * @param destination - either a URI or an EL method binding expression. + */ + public void setDestination(String destination) + { + _destination = destination; + } + + /** + * Gets the value of the node's destination property. + * The destination attr value could be one of 2 things: + * 1) a uri + * 2) An EL expression + * + * So that the model can identify this node as the currently selected + * node, the node's id is appended to the destination as a parameter + * that is picked up when the getFocusRowKey() method of the model + * is called to get the focus path. + * + * @return destination - the String value of the destinationNode's + * "destination" property. + */ + @Override + public String getDestination() + { + String value = _destination; + + // Could be EL expression + if ( value != null + && UIComponentTag.isValueReference(value) + ) + { + // Value of action is EL method binding, so we + // need to evaluate it + value = (String)MenuUtils.getBoundValue(value); + } + + // Appending nodeId to URL so that we can identify the node + // when getFocusRowKey() is called on the model. + return value != null ? value + "?nodeId=" + getId() : value; + } + + /** + * setTargetFrame - sets the value of the Destination Node's + * targetFrame attribute + * + * @param targetFrame - the target frame for the goCommandMenuItem. + */ + public void setTargetFrame(String targetFrame) + { + _targetFrame = targetFrame; + } + + /** + * getTargetFrame - gets the value of the Destination Node's + * targetFrame attribute + * + * @return the target frame for the goCommandMenuItem. + */ + public String getTargetFrame() + { + String value = _targetFrame; + + // Could be EL expression + if ( value != null + && UIComponentTag.isValueReference(value) + ) + { + // Value of destination is EL value binding, so we + // need to evaluate it + value = (String)MenuUtils.getBoundValue(value); + setTargetFrame(value); + } + + return value; + } + + private String _destination = null; + private String _targetFrame = null; + private String _action = null; + private String _actionListener = null; + private String _launchListener = null; + private String _returnListener = null; + private String _immediateStr = null; + private String _useWindowStr = null; + private String _windowHeightStr = null; + private String _windowWidthStr = null; +}