📄 menuitem.java
字号:
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file. */package org.butor.web.menu;import org.butor.log.Log;/** * Bean containing the details of a menu item. * * @author Nguyen The Hung */public class MenuItem extends Branch implements IMenuItem { private int f_sequence; private String[] f_functionCodes; private String f_labelKey; private String f_label; private String f_action; private String f_actionWithTitle; private String f_imageUrl; private String f_target; private boolean f_titledAction; // this provide a tag for an item to let // do special feature! private String f_tag; private String f_imageOverUrl; private String f_imageClickUrl; private boolean f_imageDependOnLanguage = false; private int f_width; private int f_height; /** * Constructor for MenuItem. * @param name java.lang.String * @param parentName java.lang.String * @param sequence int * @param functionCode java.lang.String * @param labelKey java.lang.String * @param label java.lang.String * @param action java.lang.String * @param imageUrl java.lang.String */ public MenuItem(String name, String parentName, int sequence, String[] functionCodes, String labelKey, String label, String action, String imageUrl, String target, String imageOverUrl, String imageClickUrl, boolean imageDependOnLanguage, int width, int height) { super(name, parentName); Log.logStr(Log.LOG_LEVEL_MEDIUM, this, Log.LOG_TYPE_INFO, "Constructor", "Building menu sequence=[" +sequence+"]"); f_sequence = sequence; f_functionCodes = functionCodes; if (f_functionCodes == null) { f_functionCodes = new String[0]; } f_labelKey = labelKey; f_label = label; f_action = action; f_imageUrl = imageUrl; f_target = target; f_imageOverUrl = imageOverUrl; f_imageClickUrl = imageClickUrl; f_imageDependOnLanguage = imageDependOnLanguage; f_width = width; f_height = height; } /** * Return a string containing the details of this menu item. * @return java.lang.String */ public String toString() { StringBuffer buff = new StringBuffer(); buff.append("Name: "); buff.append(f_name); buff.append(", Parent Name: "); buff.append(f_parentName); buff.append(", Sequence: "); buff.append(f_sequence); buff.append(", FunctionCodes: "); //buff.append(f_functionCode); for (int i = 0; i < f_functionCodes.length; i++) { buff.append(f_functionCodes[i]); buff.append(" "); } buff.append(", Label Key: "); buff.append(f_labelKey); buff.append(", Label: "); buff.append(f_label); buff.append(", Action: "); buff.append(f_action); buff.append(", target: "); buff.append(f_target); buff.append(", Image url: "); buff.append(f_imageUrl); buff.append(", Image over url: "); buff.append(f_imageOverUrl); buff.append(", width: "); buff.append(f_width); buff.append(", heigth: "); buff.append(f_height); buff.append(", tag: "); buff.append(f_tag); return buff.toString(); } /************************* Gettter Methods *************************/ /** * Return the current node sequence order. * @return int */ public int getSequence() { return f_sequence; } /** * Set the current node sequence order. * @param sequence int */ public void setSequence(int sequence) { f_sequence = sequence; } /** * Return the function code. * @return java.lang.String */ public String[] getFunctionCodes() { return f_functionCodes; } /** * Set the function code. * @param functionCode java.lang.String */ /*public void setFunctionCode(String functionCode) { f_functionCode = functionCode; }*/ /** * Return the label key for the current node. * @return java.lang.String */ public String getLabelKey() { return f_labelKey; } /** * Set the label key for the current node. * @param labelKey java.lang.String */ public void setLabelKey(String labelKey) { f_labelKey = labelKey; } /** * Return the label for the current node. * @return java.lang.String */ public String getLabel() { return f_label; } /** * Set the label for the current node. * @param label java.lang.String */ public void setLabel(String label) { f_label = label; } /** * Return the action for the current node. * @return java.lang.String */ public String getAction() { return f_action; } /** * Set the action for the current node. * @param action java.lang.String */ public void setAction(String action) { f_action = action; } /** * Return the tag for the current node. * @return java.lang.String */ public String getTag() { return f_tag; } /** * Set the tag for the current node. * @param action java.lang.String */ public void setTag(String tag) { f_tag = tag; } /** * Return the image url for the current node. * @return java.lang.String */ public String getImageUrl() { return f_imageUrl; } /** * Set the image url for the current node. * @param imageUrl java.lang.String */ public void setImageUrl(String imageUrl) { f_imageUrl = imageUrl; } /** * Returns the titledAction. * @return boolean */ public boolean isTitledAction() { return f_titledAction; } /** * Sets the titledAction. * @param titledAction The titledAction to set */ public void setTitledAction(boolean titledAction) { f_titledAction = titledAction; } /** * Returns the actionWithTitle. * @return String */ public String getActionWithTitle() { return f_actionWithTitle; } /** * Sets the actionWithTitle. * @param actionWithTitle The actionWithTitle to set */ public void setActionWithTitle(String actionWithTitle) { f_actionWithTitle = actionWithTitle; } /** * @see org.butor.wak.web.menu.IMenuItem#getTarget() */ public String getTarget() { return f_target; } /** * Return the image url for the current node. * @return java.lang.String */ public String getImageOverUrl() { return f_imageOverUrl; } /** * Set the image url for the current node. * @param imageUrl java.lang.String */ public void setImageOverUrl(String imageOverUrl) { f_imageOverUrl = imageOverUrl; } /** * Return the image url for the current node. * @return java.lang.String */ public String getImageClickUrl() { return f_imageClickUrl; } /** * Set the image url for the current node. * @param imageUrl java.lang.String */ public void setImageClickUrl(String imageClickUrl) { f_imageClickUrl = imageClickUrl; } /** * Returns the f_imageDependOnLanguage. * @return boolean */ public boolean isImageDependOnLanguage() { return f_imageDependOnLanguage; } /** * Sets the f_imageDependOnLanguage. * @param f_imageDependOnLanguage The f_imageDependOnLanguage to set */ public void setImageDependOnLanguage(boolean imageDependOnLanguage) { f_imageDependOnLanguage = imageDependOnLanguage; } /** * Returns the f_height. * @return int */ public int getHeight() { return f_height; } /** * Returns the f_width. * @return int */ public int getWidth() { return f_width; } /** * Sets the f_height. * @param f_height The f_height to set */ public void setHeight(int height) { f_height = height; } /** * Sets the f_width. * @param f_width The f_width to set */ public void setWidth(int width) { f_width = width; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -