Author: dbiatenia
Date: 2007-06-13 12:07:14 -0400 (Wed, 13 Jun 2007)
New Revision: 1162
Added:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenu.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuItem.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRendererBase.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/PanelMenuGroupGradient.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/PanelMenuItemGradient.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java
Removed:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevron.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronDown.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronUp.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconGrid.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangle.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleDown.java
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleUp.java
Log:
packages structure fixing
Copied: trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenu.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenu.java)
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenu.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenu.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,109 @@
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+public abstract class UIPanelMenu extends UIComponentBase{
+
+ public static final String COMPONENT_TYPE = "org.richfaces.panelMenu";
+
+ public abstract String getEvent();
+ public abstract void setEvent(String event);
+ public abstract String getMode();
+ public abstract void setMode(String mode);
+ public abstract String getWidth();
+ public abstract void setWidth(String width);
+ public abstract String getExpandMode();
+ public abstract void setExpandMode(String expandMode);
+ public abstract boolean isExpandSingle();
+ public abstract void setExpandSingle(boolean expandSingle);
+ public abstract String getIconItem();
+ public abstract void setIconItem(String iconItem);
+ public abstract String getIconDisabledItem();
+ public abstract void setIconDisabledItem(String iconDisabledItem);
+ public abstract String getIconTopItem();
+ public abstract void setIconTopItem(String iconTopItem);
+ public abstract String getIconTopDisabledItem();
+ public abstract void setIconTopDisabledItem(String iconTopDisabledItem);
+ public abstract String getIconExpandedGroup();
+ public abstract void setIconExpandedGroup(String iconExpandedGroup);
+ public abstract String getIconCollapsedGroup();
+ public abstract void setIconCollapsedGroup(String iconCollapsedGroup);
+ public abstract String getIconDisabledGroup();
+ public abstract void setIconDisabledGroup(String iconDisabledGroup);
+ public abstract String getIconExpandedTopGroup();
+ public abstract void setIconExpandedTopGroup(String iconExpandedTopGroup);
+ public abstract String getIconCollapsedTopGroup();
+ public abstract void setIconCollapsedTopGroup(String iconCollapsedTopGroup);
+ public abstract String getIconTopDisableGroup();
+ public abstract void setIconTopDisableGroup(String iconTopDisableGroup);
+ public abstract String getIconItemPosition();
+ public abstract void setIconItemPosition(String iconItemPosition);
+ public abstract String getIconItemTopPosition();
+ public abstract void setIconItemTopPosition(String iconItemTopPosition);
+ public abstract String getIconGroupPosition();
+ public abstract void setIconGroupPosition(String iconGroupPosition);
+ public abstract String getIconGroupTopPosition();
+ public abstract void setIconGroupTopPosition(String iconGroupTopPosition);
+ public abstract String getStyle();
+ public abstract void setStyle(String style);
+ public abstract String getStyleClass();
+ public abstract void setStyleClass(String styleClass);
+ public abstract String getGroupStyle();
+ public abstract void setGroupStyle(String groupStyle);
+ public abstract String getGroupClass();
+ public abstract void setGroupClass(String groupClass);
+ public abstract String getTopGroupStyle();
+ public abstract void setTopGroupStyle(String topGroupStyle);
+ public abstract String getTopGroupClass();
+ public abstract void setTopGroupClass(String topGroupClass);
+ public abstract String getItemStyle();
+ public abstract void setItemStyle(String itemStyle);
+ public abstract String getItemClass();
+ public abstract void setItemClass(String itemClass);
+ public abstract String getTopItemStyle();
+ public abstract void setTopItemStyle(String topItemStyle);
+ public abstract String getTopItemClass();
+ public abstract void setTopItemClass(String topItemClass);
+ public abstract String getDisabledItemClass();
+ public abstract void setDisabledItemClass(String disabledItemClass);
+ public abstract String getDisabledItemStyle();
+ public abstract void setDisabledItemStyle(String disabledItemStyle);
+ public abstract String getDisabledGroupClass();
+ public abstract void setDisabledGroupClass(String disabledGroupClass);
+ public abstract String getDisabledGroupStyle();
+ public abstract void setDisabledGroupStyle(String disabledGroupStyle);
+ public abstract String getHoveredItemClass();
+ public abstract void setHoveredItemClass(String hoveredItemClass);
+ public abstract String getHoveredItemStyle();
+ public abstract void setHoveredItemStyle(String hoveredItemStyle);
+ public abstract String getHoveredGroupStyle();
+ public abstract void setHoveredGroupStyle(String hoveredItemStyle);
+ public abstract String getHoveredGroupClass();
+ public abstract void setHoveredGroupClass(String hoveredGroupClass);
+ public abstract String getOnitemhover();
+ public abstract void setOnitemhover(String onitemhover);
+ public abstract String getOngroupcollapse();
+ public abstract void setOngroupcollapse(String ongroupcollapse);
+ public abstract String getOngroupexpand();
+ public abstract void setOngroupexpand(String ongroupexpand);
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+
+ public abstract void setOnclick(String string);
+ public abstract String getOnclick();
+
+ public abstract void setOndblclick(String string);
+ public abstract String getOndblclick();
+
+ public abstract void setOnmouseout(String string);
+ public abstract String getOnmouseout();
+
+ public abstract void setOnmousemove(String string);
+ public abstract String getOnmousemove();
+
+ public abstract void setOnmouseover(String string);
+ public abstract String getOnmouseover();
+
+
+
+}
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java (from
rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuGroup.java)
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,165 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.richfaces.conveter.UIPanelMenuGroupValueConverter;
+
+public abstract class UIPanelMenuGroup extends UIInput implements ActionSource{
+
+ public static final String COMPONENT_TYPE = "org.richfaces.panelMenuGroup";
+
+ private MethodBinding actionListener = null;
+ private MethodBinding action = null;
+
+ public abstract String getStyleClass();
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract String getMode();
+ public abstract void setMode(String mode);
+ public abstract String getIconExpanded();
+ public abstract void setIconExpanded(String expanded);
+
+ public abstract String getIconCollapsed();
+ public abstract void setIconCollapsed(String iconCollapsed);
+ public abstract String getIconDisabled();
+ public abstract void setIconDisabled(String iconDisabled);
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+ public abstract String getTarget();
+ public abstract void setTarget(String target);
+ public abstract String getHoverClass();
+ public abstract void setHoverClass(String hoverClass);
+ public abstract String getHoverStyle();
+ public abstract void setHoverStyle(String hoverStyle);
+ public abstract String getDisabledClass();
+ public abstract void setDisabledClass(String disabledClass);
+ public abstract String getDisabledStyle();
+ public abstract void setDisabledStyle(String disabledStyle);
+ public abstract String getStyle();
+ public abstract void setStyle(String style);
+ public abstract String getIconClass();
+ public abstract void setIconClass(String iconClass);
+ public abstract String getIconStyle();
+ public abstract void setIconStyle(String iconStyle);
+ public abstract String getOncollapse();
+ public abstract void setOncollapse(String ongroupcollapse);
+ public abstract String getOnexpand();
+ public abstract void setOnexpand(String ongroupexpand);
+ public abstract String getLabel();
+ public abstract void setLabel(String label);
+
+ public abstract boolean isExpanded();
+ public abstract void setExpanded(boolean expanded);
+
+
+ public UIPanelMenuGroup(){
+ setConverter(new UIPanelMenuGroupValueConverter());
+ }
+
+ public void addActionListener(ActionListener listener) {
+ addFacesListener(listener);
+ }
+
+ public MethodBinding getAction() {
+ return action;
+ }
+
+ public MethodBinding getActionListener() {
+ return (this.actionListener);
+ }
+
+ public ActionListener[] getActionListeners() {
+ ActionListener al[] = (ActionListener [])
+ getFacesListeners(ActionListener.class);
+ return (al);
+
+ }
+
+ public void removeActionListener(ActionListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public void setAction(MethodBinding action) {
+ this.action = action;
+ }
+
+ public void setActionListener(MethodBinding actionListener) {
+ this.actionListener = actionListener;
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ Object values[] = (Object[]) state;
+ super.restoreState(context, values[0]);
+ action = (MethodBinding) restoreAttachedState(context, values[1]);
+ actionListener = (MethodBinding) restoreAttachedState(context,
+ values[2]);
+ }
+
+ public Object saveState(FacesContext context) {
+ Object values[] = new Object[3];
+ values[0] = super.saveState(context);
+ values[1] = saveAttachedState(context, action);
+ values[2] = saveAttachedState(context, actionListener);
+ return values;
+ }
+
+ public void queueEvent(FacesEvent event) {
+ if(event instanceof ActionEvent){
+ if (isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ }
+ }
+ super.queueEvent(event);
+ }
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ super.broadcast(event);
+ if(event instanceof ActionEvent){
+ FacesContext context = getFacesContext();
+ // Notify the specified action listener method (if any)
+ MethodBinding mb = getActionListener();
+ if (mb != null) {
+ mb.invoke(context, new Object[] { event });
+ }
+
+ // Invoke the default ActionListener
+ ActionListener listener =
+ context.getApplication().getActionListener();
+ if (listener != null) {
+ listener.processAction((ActionEvent) event);
+ }
+ }
+ }
+}
Copied: trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuItem.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/panelmenu/UIPanelMenuItem.java)
===================================================================
--- trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuItem.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,60 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+
+public abstract class UIPanelMenuItem extends UICommand {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.panelMenuItem";
+
+ public abstract String getMode();
+ public abstract void setMode(String mode);
+ public abstract String getIcon();
+ public abstract void setIcon(String icon);
+ public abstract String getIconDisabled();
+ public abstract void setIconDisabled(String iconDisabled);
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+ public abstract Object getValue();
+ public abstract void setValue(Object value);
+ public abstract String getHoverClass();
+ public abstract void setHoverClass(String hoverClass);
+ public abstract String getHoverStyle();
+ public abstract void setHoverStyle(String hoverStyle);
+ public abstract String getDisabledClass();
+ public abstract void setDisabledClass(String disabledClass);
+ public abstract String getDisabledStyle();
+ public abstract void setDisabledStyle(String disabledStyle);
+ public abstract String getStyleClass();
+ public abstract void setStyleClass(String styleClass);
+ public abstract String getStyle();
+ public abstract void setStyle(String style);
+ public abstract String getIconClass();
+ public abstract void setIconClass(String iconClass);
+ public abstract String getIconStyle();
+ public abstract void setIconStyle(String iconStyle);
+ public abstract String getTarget();
+ public abstract void setTarget(String target);
+
+}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuGroupRenderer.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,262 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.Map;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.convert.ConverterException;
-import javax.faces.event.ActionEvent;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-import org.richfaces.component.UISwitchablePanel;
-import org.richfaces.component.panelmenu.UIPanelMenu;
-import org.richfaces.component.panelmenu.UIPanelMenuGroup;
-
-public class PanelMenuGroupRenderer extends PanelMenuRendererBase {
-
- protected Class getComponentClass() {
- return UIPanelMenuGroup.class;
- }
-
- protected void doDecode(FacesContext context, UIComponent component) {
- String clientId = component.getClientId(context);
- Map requestMap =context.getExternalContext().getRequestParameterMap();
- UIPanelMenuGroup group = ((UIPanelMenuGroup)component);
-
- if(requestMap.containsKey("panelMenuState"+clientId)){
- Object property = requestMap.get("panelMenuState"+clientId);
- if (property.equals("opened")) {
- group.setSubmittedValue("true");
- } else if (property.equals("closed")) {
- group.setSubmittedValue("false");
- }
-
- }
- if(isSubmitted(context, component)){
- new ActionEvent(component).queue();
- if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(component))) {
- new AjaxEvent(component).queue();
- }
- }
- }
-
- public void insertImage(FacesContext context, UIComponent component, Object data)
- throws IOException {
-
- String from = (String)data;
- String align = "";
-
- UIPanelMenu panelMenu = findMenu(component);
- boolean isTopLevel = isTopLevel(component);
-
- if (isTopLevel){
- align = panelMenu.getIconGroupTopPosition();
- } else {
- align = panelMenu.getIconGroupPosition();
- }
-
- if (align.equalsIgnoreCase(from)){
- image(context,component);
- } else {
- String iconType = PANEL_MENU_SPACER_ICON_NAME;
- String imageSrc = getIconByType(iconType, isTopLevel, context, component);
- drawIcon(context.getResponseWriter(), iconType, imageSrc, component);
- }
- }
-
- private void image(FacesContext context, UIComponent component )throws IOException {
- ResponseWriter writer = context.getResponseWriter();
-
- UIPanelMenu panelMenu = findMenu(component);
- if(panelMenu == null){
- return;
- }
- UIPanelMenuGroup panelMenuGroup = (UIPanelMenuGroup)component;
- boolean isTopLevel = isTopLevel(panelMenuGroup);
-
- boolean isOpened = isOpened(context,component);
-
-
- String defaultIconNodeClosed = null;
-
- if(isTopLevel){
- if(panelMenuGroup.isDisabled()){
- defaultIconNodeClosed = panelMenu.getIconTopDisableGroup();
- if(defaultIconNodeClosed == null || defaultIconNodeClosed.equals("")){
- defaultIconNodeClosed = panelMenu.getIconDisabledGroup();
- }
- } else {
- defaultIconNodeClosed = panelMenu.getIconCollapsedTopGroup();
- if(defaultIconNodeClosed == null || defaultIconNodeClosed.equals("")){
- defaultIconNodeClosed = panelMenu.getIconCollapsedGroup();
- }
- }
- } else {
- if(panelMenuGroup.isDisabled()){
- defaultIconNodeClosed = panelMenu.getIconDisabledGroup();
- } else {
- defaultIconNodeClosed = panelMenu.getIconCollapsedGroup();
- }
- }
-
- String defaultIconNodeOpened = null;
-
- if(isTopLevel){
- defaultIconNodeOpened = panelMenu.getIconExpandedTopGroup();
- if(defaultIconNodeOpened == null || defaultIconNodeOpened.equals("")){
- defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
- }
- } else {
- defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
- }
-
- String iconExpanded = "";
- String iconCollapsed = "";
-
- iconExpanded = panelMenuGroup.isDisabled() ? panelMenuGroup.getIconDisabled() :
panelMenuGroup.getIconExpanded();
- iconCollapsed = panelMenuGroup.isDisabled() ? panelMenuGroup.getIconDisabled() :
panelMenuGroup.getIconCollapsed();
-
- String icon = null;
- if(isOpened){
- if(iconExpanded != null && !iconExpanded.equals("")){
- if(iconExpanded.equals("none")){
- return;
- } else {
- icon = iconExpanded;
- }
- } else {
- icon = defaultIconNodeOpened;
- }
- } else {
- if(iconCollapsed!= null && !iconCollapsed.equals("")){
- if(iconCollapsed.equals("none")){
- return;
- } else {
- icon = iconCollapsed;
- }
- } else {
- icon = defaultIconNodeClosed;
- }
- }
- String source = getIconByType(icon, isTopLevel, context, component);
- drawIcon(writer, icon, source, component);
- }
-
- public String getFullStyleClass(FacesContext context, UIComponent component) {
- StringBuffer classBuffer = new StringBuffer("");
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- UIPanelMenu parentMenu = findMenu(group);
- if (!parentMenu.isDisabled() && !group.isDisabled()) {
- if (calculateLevel(group) == 0)
- classBuffer.append(parentMenu.getTopGroupClass() + " ");
- else
- classBuffer.append(parentMenu.getGroupClass() + " ");
- classBuffer.append(group.getStyleClass());
- } else
- classBuffer.append(parentMenu.getDisabledGroupClass() + " ")
- .append(group.getDisabledClass());
- return classBuffer.toString();
- }
-
- public String getFullStyle(FacesContext context, UIComponent component) {
- StringBuffer styleBuffer = new StringBuffer("");
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- UIPanelMenu parentMenu = findMenu(group);
- if (!group.isDisabled()) {
- if (calculateLevel(group) == 0)
- styleBuffer.append(parentMenu.getTopGroupStyle() + "; ");
- else
- styleBuffer.append(parentMenu.getGroupStyle() + "; ");
- styleBuffer.append(group.getStyle());
- } else
- styleBuffer.append(parentMenu.getDisabledGroupStyle() + "; ")
- .append(group.getDisabledStyle());
- return styleBuffer.toString();
- }
-
- public void insertLabel(FacesContext context, UIComponent component) throws IOException
{
- Object label = component.getAttributes().get("label");
- if (label!=null){
- context.getResponseWriter().write(label.toString());
- }
- }
-
- public Object getConvertedValue(FacesContext context,
- UIComponent component, Object submittedValue)
- throws ConverterException {
-
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- if(group.getConverter() != null){
- return group.getConverter().getAsObject(context, component, (String)submittedValue);
- } else {
- return submittedValue;
- }
-
- }
-
- public boolean isOpened(FacesContext context, UIComponent component)throws IOException
{
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
-
- Boolean value = (Boolean)group.getValue();
- if (value != null) {
- return value.booleanValue();
- } else {
- boolean isParentDisabled = isParentDisabled(component);
- if(component instanceof UIPanelMenuGroup){
- if( ((UIPanelMenuGroup)component).isExpanded() &&
!((UIPanelMenuGroup)component).isDisabled() && !isParentDisabled ){
- return true;
- } else {
- //check expanded attributes in children groups, if exists
- boolean isChildrenExpanded = isChildrenExpanded(component);
- return isChildrenExpanded && !isParentDisabled &&
!((UIPanelMenuGroup)component).isDisabled();// ? "opened" : "closed";
- }
- }
- }
- return false;
- }
-
- public String getLabelClass(FacesContext context, UIComponent component) {
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- UIPanelMenu parentMenu = findMenu(group);
- if(!group.isDisabled() && !parentMenu.isDisabled()){
- if(isTopLevel(component)){
- return "rich-pmenu-group-self-label rich-pmenu-top-group-self-label";
- } else return "rich-pmenu-group-self-label";
- }
- return "";
- }
-
- public String getIconClass(FacesContext context, UIComponent component) {
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
- UIPanelMenu parentMenu = findMenu(group);
- if(!group.isDisabled() && !parentMenu.isDisabled()){
- if(isTopLevel(component)){
- return "rich-pmenu-group-self-icon rich-pmenu-top-group-self-icon";
- } else return "rich-pmenu-group-self-icon";
- }
- return "";
- }
-
-
-}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuItemRenderer.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,190 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.event.ActionEvent;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-import org.richfaces.component.UISwitchablePanel;
-import org.richfaces.component.panelmenu.UIPanelMenu;
-import org.richfaces.component.panelmenu.UIPanelMenuItem;
-
-public class PanelMenuItemRenderer extends PanelMenuRendererBase {
- protected Class getComponentClass() {
- return UIPanelMenuItem.class;
- }
-
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context,UIComponent
component) throws IOException {
-
- }
- protected void doDecode(FacesContext context, UIComponent component) {
- if(isSubmitted(context, component)) {
- new ActionEvent(component).queue();
- if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(component))) {
- new AjaxEvent(component).queue();
- } else {
-
- }
- }
- }
-
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
-
- }
-
- /*
- public String getOnClick(FacesContext context, UIComponent component) {
- String clientId = component.getClientId(context);
- return ";PanelMenuStorage['" + clientId +
"'].trigger(event);";
- }
- */
- public void insertImage(FacesContext context, UIComponent component, Object data) throws
IOException {
- String from = (String)data;
- UIPanelMenu panelMenu = findMenu(component);
- if(panelMenu == null){
- return;
- }
- String align = "";
- UIPanelMenuItem panelMenuItem = (UIPanelMenuItem)component;
- boolean isTopLevel = isTopLevel(panelMenuItem);
-
- if (isTopLevel){
- align = panelMenu.getIconItemTopPosition();
- } else {
- align = panelMenu.getIconItemPosition();
- }
-
- if (align.equalsIgnoreCase(from)){
- image(context,component);
- } else {
- String iconType = PANEL_MENU_SPACER_ICON_NAME;
- String imageSrc = getIconByType(iconType, isTopLevel, context, component);
- drawIcon(context.getResponseWriter(), iconType, imageSrc, component);
- }
- }
-
- private void image(FacesContext context, UIComponent component)
- throws IOException{
-
- UIPanelMenu panelMenu = findMenu(component);
- ResponseWriter writer = context.getResponseWriter();
- boolean isTopLevel = isTopLevel(component);
- String source = null;
- String iconType = null;
- UIPanelMenuItem item = (UIPanelMenuItem)component;
-
- String defaultItemIcon = null;
- String customItemIcon = null;
-
- if(isTopLevel){
- if(item.isDisabled()){
- defaultItemIcon = panelMenu.getIconTopDisabledItem();
- } else {
- defaultItemIcon = panelMenu.getIconTopItem();
- }
- if(defaultItemIcon == null || defaultItemIcon.equals("")){
- if(item.isDisabled()){
- defaultItemIcon = panelMenu.getIconDisabledItem();
- } else {
- defaultItemIcon = panelMenu.getIconItem();
- }
- }
- } else {
- //isTopLevel == false
- if(defaultItemIcon == null || defaultItemIcon.equals("")){
- if(item.isDisabled()){
- defaultItemIcon = panelMenu.getIconDisabledItem();
- } else {
- defaultItemIcon = panelMenu.getIconItem();
- }
- }
- }
-
- customItemIcon = item.isDisabled() ? item.getIconDisabled() : item.getIcon();
-
- if(customItemIcon == null || customItemIcon.equals("")){
- iconType = defaultItemIcon;
- } else iconType = customItemIcon;
-
- source = getIconByType(iconType, isTopLevel, context, component);
- drawIcon(writer, iconType, source, component);
- }
-
-
- public String getFullStyleClass(FacesContext context, UIComponent component) {
- StringBuffer classBuffer = new StringBuffer("");
- UIPanelMenuItem item = (UIPanelMenuItem)component;
- UIPanelMenu parentMenu = findMenu(item);
- if (!parentMenu.isDisabled() && !item.isDisabled()) {
- if (calculateLevel(item) == 0) {
- classBuffer.append(parentMenu.getTopItemClass()).append(" ");
- classBuffer.append("rich-pmenu-top-item ");
- } else
- classBuffer.append(parentMenu.getItemClass() + " ");
- classBuffer.append(item.getStyleClass());
- } else
- classBuffer.append(parentMenu.getDisabledItemClass() + " ")
- .append(item.getDisabledClass());
- return classBuffer.toString();
- }
-
- public String getFullStyle(FacesContext context, UIComponent component) {
- StringBuffer styleBuffer = new StringBuffer("");
- UIPanelMenuItem item = (UIPanelMenuItem)component;
- UIPanelMenu parentMenu = findMenu(item);
- if (!item.isDisabled()) {
- if (calculateLevel(item) == 0)
- styleBuffer.append(parentMenu.getTopItemStyle() + "; ");
- else
- styleBuffer.append(parentMenu.getItemStyle() + "; ");
- styleBuffer.append(item.getStyle());
- } else
- styleBuffer.append(parentMenu.getDisabledItemStyle() + "; ")
- .append(item.getDisabledStyle());
- return styleBuffer.toString();
- }
-
- public String getLabelClass(FacesContext context, UIComponent component) {
- UIPanelMenuItem item = (UIPanelMenuItem)component;
- UIPanelMenu parentMenu = findMenu(item);
- if(!item.isDisabled() && !parentMenu.isDisabled()){
- if(isTopLevel(component)){
- return "rich-pmenu-item-label rich-pmenu-top-item-label";
- } else return "rich-pmenu-item-label";
- }
- return "";
- }
-
- public String getIconClass(FacesContext context, UIComponent component) {
- UIPanelMenuItem item = (UIPanelMenuItem)component;
- UIPanelMenu parentMenu = findMenu(item);
- if(!item.isDisabled() && !parentMenu.isDisabled()){
- if(isTopLevel(component)){
- return "rich-pmenu-item-icon rich-pmenu-top-item-icon";
- } else return "rich-pmenu-item-icon";
- }
- return "";
- }
-}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRenderer.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,436 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-import org.ajax4jsf.framework.util.javascript.JSFunction;
-import org.richfaces.component.panelmenu.UIPanelMenu;
-import org.richfaces.component.panelmenu.UIPanelMenuGroup;
-import org.richfaces.component.panelmenu.UIPanelMenuItem;
-
-public class PanelMenuRenderer extends PanelMenuRendererBase {
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.framework.renderer.RendererBase#getComponentClass()
- */
- protected Class getComponentClass() {
- return UIComponent.class;
- }
-
- public void insertScript(FacesContext context, UIComponent component)
- throws IOException {
-
- StringBuffer buffer = new StringBuffer();
- StringBuffer panelMenu = new StringBuffer();
- List flatList = new LinkedList();
- Map levels = new HashMap();
-
- boolean expandSingle = ((UIPanelMenu)component).isExpandSingle();
-
- flatten(component.getChildren(), flatList, levels, 0);
-
- panelMenu
- .append("new PanelMenu('")
- .append(component.getClientId(context).toString())
- .append("',")
- .append(new Boolean(expandSingle).toString())
- .append(");\n");
-
- for (Iterator iter = flatList.iterator(); iter.hasNext();) {
- UIComponent child = (UIComponent) iter.next();
- if ((child instanceof UIPanelMenuItem)||(child instanceof UIPanelMenuGroup)) {
- boolean childDisabled;
- if (!((UIPanelMenu)component).isDisabled())
- childDisabled = child instanceof UIPanelMenuGroup ?
((UIPanelMenuGroup)child).isDisabled() : ((UIPanelMenuItem)child).isDisabled();
- else
- childDisabled = true;
- boolean childRendered = child instanceof UIPanelMenuGroup ?
((UIPanelMenuGroup)child).isRendered() : ((UIPanelMenuItem)child).isRendered();
- boolean parentRendered = true;
- if (! (child.getParent() instanceof UIPanelMenu))
- parentRendered = child.getParent() instanceof UIPanelMenuGroup ?
((UIPanelMenuGroup)child.getParent()).isRendered() :
((UIPanelMenuItem)child.getParent()).isRendered();
- if (!parentRendered){
- child.getAttributes().put("rendered",Boolean.FALSE);
- }
-
- UIPanelMenu parentMenu = findMenu(child);
-
- String event = parentMenu.getEvent();
- if ("".equals(event))
- event = "click";
- else if (event.startsWith("on"))
- event = event.substring(2);
-
- String onopen = (child instanceof UIPanelMenuGroup) &&
!((UIPanelMenuGroup)child).isDisabled() && !isParentDisabled(child) ?
- parentMenu.getOngroupexpand() + ";" +
((UIPanelMenuGroup)child).getOnexpand() : "";
- String onclose = (child instanceof UIPanelMenuGroup) &&
!((UIPanelMenuGroup)child).isDisabled() && !isParentDisabled(child) ?
- parentMenu.getOngroupcollapse() + ";" +
((UIPanelMenuGroup)child).getOncollapse() : "";
- String hoveredStyle = (child instanceof UIPanelMenuGroup ?
- parentMenu.getHoveredGroupStyle() : parentMenu.getHoveredItemStyle())
- + ";" + (child instanceof UIPanelMenuGroup ?
- ((UIPanelMenuGroup)child).getHoverStyle() :
((UIPanelMenuItem)child).getHoverStyle());
- String hoveredClass = (child instanceof UIPanelMenuGroup ?
- parentMenu.getHoveredGroupClass() : parentMenu.getHoveredItemClass())
- + " " + (child instanceof UIPanelMenuGroup ?
- ((UIPanelMenuGroup)child).getHoverClass() :
((UIPanelMenuItem)child).getHoverClass());
- String [] hoveredStyles = hoveredStyle.split(";");
- String [] hoveredClasses = hoveredClass.split(" ");
-
- String mode = getItemMode(child);
- Object target = child.getAttributes().get("target");
- String targetString;
- if (null == target)
- targetString = "";
- else
- targetString = target.toString();
-
-
-
- if (childRendered && parentRendered){
- if ( !isParentDisabled(child) ){
- buffer
- .append("new PanelMenuItem({myId:'")
- .append((String) child.getClientId(context))
- .append("',parentId:'")
- .append((String) child.getParent().getClientId(context))
- .append("'},{type:" + (child instanceof UIPanelMenuItem ?
"\"item\"":"\"node\""))
- .append(",onopen:"+("".equals(onopen) ?
"\"\"" : "\"" + onopen +
"\"")+",onclose:"+("".equals(onclose) ?
"\"\"" : "\"" + onclose + "\""))
- .append(",event:\"" + event + "\"")
- .append(",mode:\"" + mode + "\"")
- .append(",target:\"" + targetString + "\"")
- .append(",disabled:" +
- new Boolean(childDisabled).toString())
- .append("},{");
-
-
- for (int i = 0; i < hoveredStyles.length; i++)
- if (!"".equals(hoveredStyles[i])) {
- String [] temp = hoveredStyles[i].split(":");
- String cssName = temp[0].trim();
- String cssValue = temp[1].trim();
- buffer.append("\"" + cssName + "\": \"" +
cssValue + "\"");
- if (i != hoveredStyles.length - 1)
- buffer.append(",");
- }
-
- buffer.append("},");
- if (hoveredClasses.length > 0) {
- buffer.append("new Array(");
- for (int i = 0; i < hoveredClasses.length; i++)
- if (!"".equals(hoveredClasses[i])) {;
- buffer.append("\"" + hoveredClasses[i] + "\"");
- if (i != hoveredClasses.length - 1)
- buffer.append(",");
- }
- buffer.append("),");
- } else
- buffer.append("new Array(),");
-
- buffer.append(levels.get(child.getClientId(context)));
- switchOnImagesIfNeeded(context,child,buffer);
-
- addActionIfNeeded(context,child,buffer);
-
- setExpandedIfNeeded(context,child,buffer);
-
- addAjaxFunction(context,child,buffer);
-
- addOnItemHover(parentMenu.getOnitemhover(), child, buffer);
-
- String iconPos = "left";
- boolean isTopLevel = isTopLevel(child);
- if(child instanceof UIPanelMenuGroup){
- iconPos = isTopLevel ? parentMenu.getIconGroupTopPosition() :
parentMenu.getIconGroupPosition();
- } else {
- iconPos = isTopLevel ? parentMenu.getIconItemTopPosition() :
parentMenu.getIconItemPosition();
- }
-
- buffer.append(","+'"'+iconPos+'"');
-
- addImages(buffer,context,child,component.getClientId(context).toString());
-
- buffer.append(");\n");
- }
- } else {
- continue;
- }
- }
- }
- StringBuffer ret = new StringBuffer();
- ret.append("<script ");
- ret.append("type=\"text/javascript\" ");
- ret.append("id =\"script" +
component.getClientId(context)+"\">\n");
- ret.append(panelMenu);
- ret.append(buffer);
- ret.append("\n</script>");
-
- ResponseWriter writer = context.getResponseWriter();
- writer.write(ret.toString());
- }
-
- public void flatten(List children, List flatList, Map levels,int initialLevel) {
- FacesContext context = FacesContext.getCurrentInstance();
- if (children != null) {
- for (Iterator iter = children.iterator(); iter.hasNext();) {
- UIComponent child = (UIComponent) iter.next();
- if (child instanceof UIPanelMenu){
- continue;
- }
- flatList.add(child);
- levels.put(child.getClientId(context), new Integer(initialLevel));
- flatten(child.getChildren(), flatList, levels, initialLevel + 1);
- }
- }
- }
-
- private void switchOnImagesIfNeeded(FacesContext context, UIComponent child,
StringBuffer buffer)throws IOException {
- boolean isToplevel = isTopLevel(child);
- String customIconOpened = "";
- String customIconClosed = "";
-
- UIPanelMenu panelMenu = findMenu(child);
- if(panelMenu == null){
- return;
- }
- String iconOpened = isToplevel ? panelMenu.getIconExpandedTopGroup() :
panelMenu.getIconExpandedGroup();
- String iconClosed = isToplevel ? panelMenu.getIconCollapsedTopGroup() :
panelMenu.getIconCollapsedGroup();
-
- try {
- customIconOpened = (String)child.getAttributes().get("iconOpened");
- customIconClosed = (String)child.getAttributes().get("iconClosed");
- } catch (Exception e) {}
-
- if (child instanceof UIPanelMenuItem){
- buffer.append(",false");
- } else {
- if
(iconClosed.equals("custom")&&iconOpened.equals("custom")){
- if
(customIconClosed.equals("")&&customIconOpened.equals("")){
- buffer.append(",false");
- } else {
- buffer.append(",true");
- }
- } else {
- buffer.append(",true");
- }
- }
- }
-
- private void addActionIfNeeded(FacesContext context,UIComponent child,StringBuffer
buffer){
- //TODO by nick - dima - use CommandScriptBuilder
- if (child instanceof UIPanelMenuItem){
- if (((UIPanelMenuItem)child).getAction() == null){
- buffer.append(",false");
- } else {
- buffer.append(",true");
- }
- } else {
- if
(((UIPanelMenuGroup)child).getAction()!=null&&!((UIPanelMenuGroup)child).getAction().equals("")){
- buffer.append(",'panelMenuNodeAction'");
- } else {
- buffer.append(",false");
- }
- }
- }
-
- private void setExpandedIfNeeded(FacesContext context,UIComponent child,StringBuffer
buffer){
- if(child instanceof UIPanelMenuItem){
- buffer.append(",false");
- } else {
- UIPanelMenuGroup group = (UIPanelMenuGroup)child;
- if(group.getValue() != null){
- buffer.append(",").append(group.getValue().toString());
- } else {
- PanelMenuGroupRenderer r =
(PanelMenuGroupRenderer)context.getRenderKit().getRenderer(group.getFamily(),
group.getRendererType());
- boolean isNodeOpened;
- try {
- isNodeOpened = r.isOpened(context, child);
- } catch (IOException e) {
- // TODO Auto-generated catch block
-// e.printStackTrace();
- isNodeOpened = false;
- }
- buffer.append(",").append(String.valueOf(isNodeOpened));
- }
- }
- }
-
- private void addImages(StringBuffer buffer,FacesContext context,UIComponent
component,String id){
- UIPanelMenu panelMenu = findMenu(component);
- if(panelMenu == null){
- return;
- }
- boolean isTopLevel = isTopLevel(component);
-
- final String PANEL_MENU_SPACER_ICON = getIconByType(PANEL_MENU_SPACER_ICON_NAME,
isTopLevel,context, component);
-
- if(component instanceof UIPanelMenuItem){
- UIPanelMenuItem item = (UIPanelMenuItem)component;
-
- String defaultItemIcon = null;
- String defaultItemIconSrc = null;
- String customItemIcon = null;
- String customIconSource = null;
-
- if(isTopLevel){
- if(item.isDisabled()){
- defaultItemIcon = panelMenu.getIconTopDisabledItem();
- } else {
- defaultItemIcon = panelMenu.getIconTopItem();
- }
- if(defaultItemIcon == null || defaultItemIcon.equals("")){
- if(item.isDisabled()){
- defaultItemIcon = panelMenu.getIconDisabledItem();
- } else {
- defaultItemIcon = panelMenu.getIconItem();
- }
- }
- } else {
- //isTopLevel == false
- if(defaultItemIcon == null || defaultItemIcon.equals("")){
- if(item.isDisabled()){
- defaultItemIcon = panelMenu.getIconDisabledItem();
- } else {
- defaultItemIcon = panelMenu.getIconItem();
- }
- }
- }
-
- if(defaultItemIcon != null && defaultItemIcon.equals("none")){
- defaultItemIconSrc = PANEL_MENU_SPACER_ICON;
- } else {
- defaultItemIconSrc = getIconByType(defaultItemIcon, isTopLevel,context, component);
- }
-
-
- customItemIcon = item.isDisabled() ? item.getIconDisabled() : item.getIcon();
- if(customItemIcon != null && customItemIcon.equals("none")){
- customIconSource = PANEL_MENU_SPACER_ICON;
- } else {
- customIconSource = getIconByType(customItemIcon, isTopLevel,context, component);
- }
-
- if(customItemIcon != null && !customItemIcon.equals("")){
- buffer.append(","+'"'+customIconSource+'"').append(","+'"'+customIconSource+'"'+"
");
- } else if (defaultItemIcon != null && !defaultItemIcon.equals("")){
- buffer.append(","+'"'+defaultItemIconSrc+'"').append(","+'"'+defaultItemIconSrc+'"'+"
");
- } else {
- buffer.append(","+'"'+PANEL_MENU_SPACER_ICON+'"').append(","+'"'+PANEL_MENU_SPACER_ICON+'"'+"
");
- }
- buffer.append(",\"\" ");
-
- } else if(component instanceof UIPanelMenuGroup){
- UIPanelMenuGroup group = (UIPanelMenuGroup)component;
-
- String defaultIconNodeClosed = isTopLevel ? (group.isDisabled() ?
panelMenu.getIconTopDisableGroup() : panelMenu.getIconCollapsedTopGroup()) :
(group.isDisabled() ? panelMenu.getIconDisabledGroup() :
panelMenu.getIconCollapsedGroup());
-
- if(isTopLevel){
- if(group.isDisabled()){
- defaultIconNodeClosed = panelMenu.getIconTopDisableGroup();
- if(defaultIconNodeClosed == null || defaultIconNodeClosed.equals("")){
- defaultIconNodeClosed = panelMenu.getIconDisabledGroup();
- }
- } else {
- defaultIconNodeClosed = panelMenu.getIconCollapsedTopGroup();
- if(defaultIconNodeClosed == null || defaultIconNodeClosed.equals("")){
- defaultIconNodeClosed = panelMenu.getIconCollapsedGroup();
- }
- }
- } else {
- if(group.isDisabled()){
- defaultIconNodeClosed = panelMenu.getIconDisabledGroup();
- } else {
- defaultIconNodeClosed = panelMenu.getIconCollapsedGroup();
- }
- }
-
- String defaultIconNodeOpened = isTopLevel ? panelMenu.getIconExpandedTopGroup() :
panelMenu.getIconExpandedGroup();
-
- if(isTopLevel){
- defaultIconNodeOpened = panelMenu.getIconExpandedTopGroup();
- if(defaultIconNodeOpened == null || defaultIconNodeOpened.equals("")){
- defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
- }
- } else {
- defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
- }
-
- String defaultIconNodeClosedSrc = getIconByType(defaultIconNodeClosed,
isTopLevel,context, component);
- String defaultIconNodeOpenedSrc = getIconByType(defaultIconNodeOpened,
isTopLevel,context, component);
-
- String iconExpanded = "";
- String iconCollapsed = "";
- String iconExpandedSource = "";
- String iconCollapsedSource = "";
-
- iconExpanded = group.isDisabled() ? group.getIconDisabled() :
group.getIconExpanded();
- iconCollapsed = group.isDisabled() ? group.getIconDisabled() :
group.getIconCollapsed();
- iconExpandedSource = getIconByType(iconExpanded,isTopLevel,context,component);
- iconCollapsedSource = getIconByType(iconCollapsed,isTopLevel,context,component);
-
- if(iconExpanded != null && !iconExpanded.equals("")){
- buffer.append(","+'"'+ iconExpandedSource +
'"');
- } else if(defaultIconNodeOpened != null &&
!defaultIconNodeOpened.equals("")){
- buffer.append(","+'"'+defaultIconNodeOpenedSrc +
'"');
- } else {
- buffer.append(","+'"'+PANEL_MENU_SPACER_ICON +
'"');
- }
-
- if(iconCollapsed != null && !iconCollapsed.equals("")){
- buffer.append(","+'"'+iconCollapsedSource+'"');
- } else if(defaultIconNodeClosed != null &&
!defaultIconNodeClosed.equals("")){
- buffer.append(","+'"'+defaultIconNodeClosedSrc+'"');
- } else {
- buffer.append(","+'"'+PANEL_MENU_SPACER_ICON +
'"');
- }
- }
- buffer.append(",\"" + PANEL_MENU_SPACER_ICON + "\"");
- }
-
- protected void addAjaxFunction(FacesContext context, UIComponent child, StringBuffer
buffer) {
- JSFunction function = AjaxRendererUtils.buildAjaxFunction(child,
- context);
- Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
- child);
- function.addParameter(eventOptions);
-
- buffer.append(",\"");
- function.appendScript(buffer);
- buffer.append("\"");
- }
-
- protected void addOnItemHover(String menuOnItemHover, UIComponent child, StringBuffer
buffer) {
- buffer.append(",\"");
- if(child instanceof UIPanelMenuItem){
- if(menuOnItemHover != null && !menuOnItemHover.equals(""))
buffer.append(menuOnItemHover);
- }
- buffer.append("\"");
- }
-
-}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/PanelMenuRendererBase.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,293 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase;
-import org.ajax4jsf.framework.renderer.compiler.TemplateContext;
-import org.ajax4jsf.framework.skin.Skin;
-import org.ajax4jsf.framework.util.style.CSSFormat;
-import org.richfaces.component.panelmenu.UIPanelMenu;
-import org.richfaces.component.panelmenu.UIPanelMenuGroup;
-import org.richfaces.component.panelmenu.UIPanelMenuItem;
-import org.richfaces.renderkit.iconImages.PanelMenuIconTriangle;
-import org.richfaces.renderkit.iconImages.PanelMenuIconTriangleDown;
-import org.richfaces.renderkit.iconImages.PanelMenuIconTriangleUp;
-import org.richfaces.renderkit.iconImages.PanelMenuIconDisc;
-import org.richfaces.renderkit.iconImages.PanelMenuIconGrid;
-import org.richfaces.renderkit.iconImages.PanelMenuIconChevron;
-import org.richfaces.renderkit.iconImages.PanelMenuIconChevronDown;
-import org.richfaces.renderkit.iconImages.PanelMenuIconChevronUp;
-import org.richfaces.renderkit.iconImages.PanelMenuIconSpacer;
-import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
-
-/**
- * @author hans
- *
- */
-public abstract class PanelMenuRendererBase extends HeaderResourcesRendererBase {
-
- final static String PANEL_MENU_SPACER_ICON_NAME = "spacer";
-
- public void insertTDs(FacesContext context , UIComponent component) throws IOException
{
- ResponseWriter writer = context.getResponseWriter();
- int level = calculateLevel(component);
- //StringBuffer buffer = new StringBuffer();
- String src = getIconByType("custom",false,context,component);
- int w = 16; //width(context);
-
- for (int i=0;i<level;i++){
- writer.startElement(HTML.td_ELEM, component);
- writer.startElement("img", component);
- writer.writeAttribute("src", src, null);
- writer.writeAttribute("alt", "", null);
- writer.writeAttribute("hspace", "0", null);
- writer.writeAttribute("vspace", "0", null);
- writer.writeAttribute("height", String.valueOf(w), null);
- writer.writeAttribute("width", String.valueOf(w), null);
- writer.writeAttribute("style", "display:block; ", null);
- writer.endElement("img");
- writer.endElement(HTML.td_ELEM);
- }
- }
-
- protected int calculateLevel (UIComponent component){
- int level = 0;
- UIComponent parent = component.getParent();
- while(parent != null){
- if(parent instanceof UIPanelMenu){
- return level;
- } else if(parent instanceof UIPanelMenuGroup){
- level++;
- }
- parent = parent.getParent();
- }
- return level;
- }
-
- /**
- * If icon type is a pre-defined value, return corresponding image, otherwise
- * otherwise
- * @param iconType
- * @param context
- * @param component
- * @return URI of requested image
- */
- protected String getIconByType(String iconType, boolean isTopLevel, FacesContext
context,
- UIComponent component){
-
- String source = "";
- String color = "";
- Skin skin = getSkin(context);
-
- if (isTopLevel){
- color = (String) skin.getParameter(context,"panelmenu.headerBulletColor");
- } else {
- color = (String) skin.getParameter(context,"panelmenu.itemBulletColor");
- }
- if(iconType != null && !iconType.equals("none")){
- if (iconType.equals("custom")){
- source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
- } else if (iconType.equals("spacer")){
- source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
- } else if (iconType.equals("triangle")) {
- source = getResource(PanelMenuIconTriangle.class.getName()).getUri(context, color);
- } else if (iconType.equals("triangleDown")) {
- source = getResource(PanelMenuIconTriangleDown.class.getName()).getUri(context,
color);
- } else if (iconType.equals("triangleUp")) {
- source = getResource(PanelMenuIconTriangleUp.class.getName()).getUri(context,
color);
- } else if (iconType.equals("chevron")) {
- source = getResource(PanelMenuIconChevron.class.getName()).getUri(context, color);
- } else if (iconType.equals("chevronUp")) {
- source = getResource(PanelMenuIconChevronUp.class.getName()).getUri(context, color);
- } else if (iconType.equals("chevronDown")) {
- source = getResource(PanelMenuIconChevronDown.class.getName()).getUri(context,
color);
-// } else if (iconType.equals("square")) {
-// source = getResource(PanelMenuIconSquare.class.getName()).getUri(context, color);
- } else if (iconType.equals("disc")) {
- source = getResource(PanelMenuIconDisc.class.getName()).getUri(context, color);
- } else if (iconType.equals("grid")) {
- source = getResource(PanelMenuIconGrid.class.getName()).getUri(context, color);
- } else {
- //TODO by nick - dima - TemplateContext is deprecated and shouldn't be used
- source = (String)getUtils().encodeResourceURL(new
TemplateContext(this,context,component),iconType);
- }
- }
- return source;
- }
-
- protected UIPanelMenu findMenu (UIComponent component){
- if (component instanceof UIPanelMenu) return (UIPanelMenu)component;
- UIComponent parent = component;
- while(parent != null){
- if(parent instanceof UIPanelMenu){
- return (UIPanelMenu) parent;
- }
- parent = parent.getParent();
- }
- return (UIPanelMenu) parent;
- }
-
- public String getHideStyle(FacesContext context, UIComponent component) {
- if (!(component.getParent() instanceof UIPanelMenu)) {
- CSSFormat format = new CSSFormat();
- format.add("display", "none");
- if(component.getParent() instanceof UIPanelMenuGroup) {
- UIPanelMenuGroup parent = (UIPanelMenuGroup)component.getParent();
- PanelMenuGroupRenderer renderer = (PanelMenuGroupRenderer)
context.getRenderKit().getRenderer(parent.getFamily(), parent.getRendererType());
- try {
- if ( renderer.isOpened(context, parent) ){
- return "";
- } else
- return format.toString();
- } catch (IOException e) {
- e.printStackTrace();
- }
- } else return format.toString();
- }
- return "";
- }
-
- public void insertValue(FacesContext context, UIComponent component) throws IOException
{
- Object value = component.getAttributes().get("value");
- if (value!=null){
- context.getResponseWriter().write(value.toString());
- }
- }
-
- protected boolean isChildrenExpanded(UIComponent component){
- if (component.getChildren() != null){
- Iterator itr = component.getChildren().iterator();
- while(itr.hasNext()){
- UIComponent child = (UIComponent)itr.next();
- if(child instanceof UIPanelMenuGroup){
- if( ((UIPanelMenuGroup)child).isExpanded() ){
- return true;
- } else {
- return isChildrenExpanded(child);
- }
- }
- }
- }
- return false;
- }
-
- protected boolean isParentDisabled(UIComponent component){
- boolean returnValue = false;
- UIComponent parent = component.getParent();
- if(parent instanceof UIPanelMenuGroup){
- UIPanelMenuGroup parentGroup = (UIPanelMenuGroup)parent;
- if(parentGroup.isDisabled()){
- returnValue = true;
- } else {
- returnValue = isParentDisabled(parentGroup);
- }
- }
- return returnValue;
- }
-
- protected boolean isSubmitted(FacesContext context, UIComponent component){
- boolean submitted = false;
- String clientId = component.getClientId(context);
- Map requestParameterMap = context.getExternalContext().getRequestParameterMap();
-
- Object value = requestParameterMap.get("panelMenuAction"+clientId);
- if (clientId!=null&&value!=null){
- if (value.equals(clientId)) {
- submitted = true;
- }
- }
- return submitted;
- }
-
- protected String getItemMode(UIComponent component) {
- String parentExpandMode = findMenu(component).getExpandMode();
- String parentMode = findMenu(component).getMode();
- if (null == parentMode || "".equals(parentMode))
- parentMode = "server";
- if (null == parentExpandMode || "".equals(parentExpandMode))
- parentExpandMode = "none";
- String mode = "none";
- if (component instanceof UIPanelMenuGroup) {
- UIPanelMenuGroup group = (UIPanelMenuGroup) component;
- if (null != group.getMode() && ! "".equals(group.getMode()))
- mode = group.getMode();
- else
- mode = parentExpandMode;
- } else if (component instanceof UIPanelMenuItem) {
- UIPanelMenuItem item = (UIPanelMenuItem) component;
- if (null != item.getMode() && ! "".equals(item.getMode()))
- mode = item.getMode();
- else
- mode = parentMode;
- }
- return mode;
- }
-
- /**
- *
- * @param component
- * @return
- */
- public boolean isTopLevel(UIComponent component){
- UIComponent parent = component.getParent();
- while( !(parent instanceof UIPanelMenu) && !(parent instanceof
UIPanelMenuGroup)) {
- parent = parent.getParent();
- }
- if(parent instanceof UIPanelMenu){
- return true;
- } else {
- return false;
- }
- }
-
- /**
- *
- * @param writer
- * @param iconType
- * @param imageSrc
- * @param component
- * @throws IOException
- */
- public void drawIcon(ResponseWriter writer, String iconType, String imageSrc,
UIComponent component) throws IOException{
- if (iconType != null && !iconType.equals("") &&
!iconType.equals("none")){
- int h = 16; //width(context);
- writer.startElement("img", component);
- writer.writeAttribute("src", imageSrc, null);
- writer.writeAttribute("alt", "", null);
- writer.writeAttribute("vspace", "0", null);
- writer.writeAttribute("hspace", "0", null);
- writer.writeAttribute("style", "display:block; ", null);
- writer.writeAttribute("width", String.valueOf(h), null);
- writer.writeAttribute("height", String.valueOf(h), null);
- writer.endElement("img");
- }
-
- }
-
-}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,32 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.gradientImages;
-
-import org.ajax4jsf.framework.skin.Skin;
-import org.richfaces.renderkit.html.BaseGradient;
-
-public class PanelMenuGroupGradient extends BaseGradient {
- public PanelMenuGroupGradient() {
- super(10, 40, 14, "headerGradientColor", Skin.headerBackgroundColor);
- }
-
-}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,31 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.gradientImages;
-
-import org.ajax4jsf.framework.skin.Skin;
-import org.richfaces.renderkit.html.BaseGradient;
-
-public class PanelMenuItemGradient extends BaseGradient {
- public PanelMenuItemGradient() {
- super(10, 40, 14, "controlBackgroundColor",
Skin.generalBackgroundColor);
- }
-}
Added:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,262 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Map;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.convert.ConverterException;
+import javax.faces.event.ActionEvent;
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.richfaces.component.UIPanelMenu;
+import org.richfaces.component.UIPanelMenuGroup;
+import org.richfaces.component.UISwitchablePanel;
+
+public class PanelMenuGroupRenderer extends PanelMenuRendererBase {
+
+ protected Class getComponentClass() {
+ return UIPanelMenuGroup.class;
+ }
+
+ protected void doDecode(FacesContext context, UIComponent component) {
+ String clientId = component.getClientId(context);
+ Map requestMap =context.getExternalContext().getRequestParameterMap();
+ UIPanelMenuGroup group = ((UIPanelMenuGroup)component);
+
+ if(requestMap.containsKey("panelMenuState"+clientId)){
+ Object property = requestMap.get("panelMenuState"+clientId);
+ if (property.equals("opened")) {
+ group.setSubmittedValue("true");
+ } else if (property.equals("closed")) {
+ group.setSubmittedValue("false");
+ }
+
+ }
+ if(isSubmitted(context, component)){
+ new ActionEvent(component).queue();
+ if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(component))) {
+ new AjaxEvent(component).queue();
+ }
+ }
+ }
+
+ public void insertImage(FacesContext context, UIComponent component, Object data)
+ throws IOException {
+
+ String from = (String)data;
+ String align = "";
+
+ UIPanelMenu panelMenu = findMenu(component);
+ boolean isTopLevel = isTopLevel(component);
+
+ if (isTopLevel){
+ align = panelMenu.getIconGroupTopPosition();
+ } else {
+ align = panelMenu.getIconGroupPosition();
+ }
+
+ if (align.equalsIgnoreCase(from)){
+ image(context,component);
+ } else {
+ String iconType = PANEL_MENU_SPACER_ICON_NAME;
+ String imageSrc = getIconByType(iconType, isTopLevel, context, component);
+ drawIcon(context.getResponseWriter(), iconType, imageSrc, component);
+ }
+ }
+
+ private void image(FacesContext context, UIComponent component )throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ UIPanelMenu panelMenu = findMenu(component);
+ if(panelMenu == null){
+ return;
+ }
+ UIPanelMenuGroup panelMenuGroup = (UIPanelMenuGroup)component;
+ boolean isTopLevel = isTopLevel(panelMenuGroup);
+
+ boolean isOpened = isOpened(context,component);
+
+
+ String defaultIconNodeClosed = null;
+
+ if(isTopLevel){
+ if(panelMenuGroup.isDisabled()){
+ defaultIconNodeClosed = panelMenu.getIconTopDisableGroup();
+ if(defaultIconNodeClosed == null || defaultIconNodeClosed.equals("")){
+ defaultIconNodeClosed = panelMenu.getIconDisabledGroup();
+ }
+ } else {
+ defaultIconNodeClosed = panelMenu.getIconCollapsedTopGroup();
+ if(defaultIconNodeClosed == null || defaultIconNodeClosed.equals("")){
+ defaultIconNodeClosed = panelMenu.getIconCollapsedGroup();
+ }
+ }
+ } else {
+ if(panelMenuGroup.isDisabled()){
+ defaultIconNodeClosed = panelMenu.getIconDisabledGroup();
+ } else {
+ defaultIconNodeClosed = panelMenu.getIconCollapsedGroup();
+ }
+ }
+
+ String defaultIconNodeOpened = null;
+
+ if(isTopLevel){
+ defaultIconNodeOpened = panelMenu.getIconExpandedTopGroup();
+ if(defaultIconNodeOpened == null || defaultIconNodeOpened.equals("")){
+ defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
+ }
+ } else {
+ defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
+ }
+
+ String iconExpanded = "";
+ String iconCollapsed = "";
+
+ iconExpanded = panelMenuGroup.isDisabled() ? panelMenuGroup.getIconDisabled() :
panelMenuGroup.getIconExpanded();
+ iconCollapsed = panelMenuGroup.isDisabled() ? panelMenuGroup.getIconDisabled() :
panelMenuGroup.getIconCollapsed();
+
+ String icon = null;
+ if(isOpened){
+ if(iconExpanded != null && !iconExpanded.equals("")){
+ if(iconExpanded.equals("none")){
+ return;
+ } else {
+ icon = iconExpanded;
+ }
+ } else {
+ icon = defaultIconNodeOpened;
+ }
+ } else {
+ if(iconCollapsed!= null && !iconCollapsed.equals("")){
+ if(iconCollapsed.equals("none")){
+ return;
+ } else {
+ icon = iconCollapsed;
+ }
+ } else {
+ icon = defaultIconNodeClosed;
+ }
+ }
+ String source = getIconByType(icon, isTopLevel, context, component);
+ drawIcon(writer, icon, source, component);
+ }
+
+ public String getFullStyleClass(FacesContext context, UIComponent component) {
+ StringBuffer classBuffer = new StringBuffer("");
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ UIPanelMenu parentMenu = findMenu(group);
+ if (!parentMenu.isDisabled() && !group.isDisabled()) {
+ if (calculateLevel(group) == 0)
+ classBuffer.append(parentMenu.getTopGroupClass() + " ");
+ else
+ classBuffer.append(parentMenu.getGroupClass() + " ");
+ classBuffer.append(group.getStyleClass());
+ } else
+ classBuffer.append(parentMenu.getDisabledGroupClass() + " ")
+ .append(group.getDisabledClass());
+ return classBuffer.toString();
+ }
+
+ public String getFullStyle(FacesContext context, UIComponent component) {
+ StringBuffer styleBuffer = new StringBuffer("");
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ UIPanelMenu parentMenu = findMenu(group);
+ if (!group.isDisabled()) {
+ if (calculateLevel(group) == 0)
+ styleBuffer.append(parentMenu.getTopGroupStyle() + "; ");
+ else
+ styleBuffer.append(parentMenu.getGroupStyle() + "; ");
+ styleBuffer.append(group.getStyle());
+ } else
+ styleBuffer.append(parentMenu.getDisabledGroupStyle() + "; ")
+ .append(group.getDisabledStyle());
+ return styleBuffer.toString();
+ }
+
+ public void insertLabel(FacesContext context, UIComponent component) throws IOException
{
+ Object label = component.getAttributes().get("label");
+ if (label!=null){
+ context.getResponseWriter().write(label.toString());
+ }
+ }
+
+ public Object getConvertedValue(FacesContext context,
+ UIComponent component, Object submittedValue)
+ throws ConverterException {
+
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ if(group.getConverter() != null){
+ return group.getConverter().getAsObject(context, component, (String)submittedValue);
+ } else {
+ return submittedValue;
+ }
+
+ }
+
+ public boolean isOpened(FacesContext context, UIComponent component)throws IOException
{
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+
+ Boolean value = (Boolean)group.getValue();
+ if (value != null) {
+ return value.booleanValue();
+ } else {
+ boolean isParentDisabled = isParentDisabled(component);
+ if(component instanceof UIPanelMenuGroup){
+ if( ((UIPanelMenuGroup)component).isExpanded() &&
!((UIPanelMenuGroup)component).isDisabled() && !isParentDisabled ){
+ return true;
+ } else {
+ //check expanded attributes in children groups, if exists
+ boolean isChildrenExpanded = isChildrenExpanded(component);
+ return isChildrenExpanded && !isParentDisabled &&
!((UIPanelMenuGroup)component).isDisabled();// ? "opened" : "closed";
+ }
+ }
+ }
+ return false;
+ }
+
+ public String getLabelClass(FacesContext context, UIComponent component) {
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ UIPanelMenu parentMenu = findMenu(group);
+ if(!group.isDisabled() && !parentMenu.isDisabled()){
+ if(isTopLevel(component)){
+ return "rich-pmenu-group-self-label rich-pmenu-top-group-self-label";
+ } else return "rich-pmenu-group-self-label";
+ }
+ return "";
+ }
+
+ public String getIconClass(FacesContext context, UIComponent component) {
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+ UIPanelMenu parentMenu = findMenu(group);
+ if(!group.isDisabled() && !parentMenu.isDisabled()){
+ if(isTopLevel(component)){
+ return "rich-pmenu-group-self-icon rich-pmenu-top-group-self-icon";
+ } else return "rich-pmenu-group-self-icon";
+ }
+ return "";
+ }
+
+
+}
Property changes on:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,190 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.event.ActionEvent;
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.richfaces.component.UIPanelMenu;
+import org.richfaces.component.UIPanelMenuItem;
+import org.richfaces.component.UISwitchablePanel;
+
+public class PanelMenuItemRenderer extends PanelMenuRendererBase {
+ protected Class getComponentClass() {
+ return UIPanelMenuItem.class;
+ }
+
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context,UIComponent
component) throws IOException {
+
+ }
+ protected void doDecode(FacesContext context, UIComponent component) {
+ if(isSubmitted(context, component)) {
+ new ActionEvent(component).queue();
+ if (UISwitchablePanel.AJAX_METHOD.equals(getItemMode(component))) {
+ new AjaxEvent(component).queue();
+ } else {
+
+ }
+ }
+ }
+
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent
component) throws IOException {
+
+ }
+
+ /*
+ public String getOnClick(FacesContext context, UIComponent component) {
+ String clientId = component.getClientId(context);
+ return ";PanelMenuStorage['" + clientId +
"'].trigger(event);";
+ }
+ */
+ public void insertImage(FacesContext context, UIComponent component, Object data) throws
IOException {
+ String from = (String)data;
+ UIPanelMenu panelMenu = findMenu(component);
+ if(panelMenu == null){
+ return;
+ }
+ String align = "";
+ UIPanelMenuItem panelMenuItem = (UIPanelMenuItem)component;
+ boolean isTopLevel = isTopLevel(panelMenuItem);
+
+ if (isTopLevel){
+ align = panelMenu.getIconItemTopPosition();
+ } else {
+ align = panelMenu.getIconItemPosition();
+ }
+
+ if (align.equalsIgnoreCase(from)){
+ image(context,component);
+ } else {
+ String iconType = PANEL_MENU_SPACER_ICON_NAME;
+ String imageSrc = getIconByType(iconType, isTopLevel, context, component);
+ drawIcon(context.getResponseWriter(), iconType, imageSrc, component);
+ }
+ }
+
+ private void image(FacesContext context, UIComponent component)
+ throws IOException{
+
+ UIPanelMenu panelMenu = findMenu(component);
+ ResponseWriter writer = context.getResponseWriter();
+ boolean isTopLevel = isTopLevel(component);
+ String source = null;
+ String iconType = null;
+ UIPanelMenuItem item = (UIPanelMenuItem)component;
+
+ String defaultItemIcon = null;
+ String customItemIcon = null;
+
+ if(isTopLevel){
+ if(item.isDisabled()){
+ defaultItemIcon = panelMenu.getIconTopDisabledItem();
+ } else {
+ defaultItemIcon = panelMenu.getIconTopItem();
+ }
+ if(defaultItemIcon == null || defaultItemIcon.equals("")){
+ if(item.isDisabled()){
+ defaultItemIcon = panelMenu.getIconDisabledItem();
+ } else {
+ defaultItemIcon = panelMenu.getIconItem();
+ }
+ }
+ } else {
+ //isTopLevel == false
+ if(defaultItemIcon == null || defaultItemIcon.equals("")){
+ if(item.isDisabled()){
+ defaultItemIcon = panelMenu.getIconDisabledItem();
+ } else {
+ defaultItemIcon = panelMenu.getIconItem();
+ }
+ }
+ }
+
+ customItemIcon = item.isDisabled() ? item.getIconDisabled() : item.getIcon();
+
+ if(customItemIcon == null || customItemIcon.equals("")){
+ iconType = defaultItemIcon;
+ } else iconType = customItemIcon;
+
+ source = getIconByType(iconType, isTopLevel, context, component);
+ drawIcon(writer, iconType, source, component);
+ }
+
+
+ public String getFullStyleClass(FacesContext context, UIComponent component) {
+ StringBuffer classBuffer = new StringBuffer("");
+ UIPanelMenuItem item = (UIPanelMenuItem)component;
+ UIPanelMenu parentMenu = findMenu(item);
+ if (!parentMenu.isDisabled() && !item.isDisabled()) {
+ if (calculateLevel(item) == 0) {
+ classBuffer.append(parentMenu.getTopItemClass()).append(" ");
+ classBuffer.append("rich-pmenu-top-item ");
+ } else
+ classBuffer.append(parentMenu.getItemClass() + " ");
+ classBuffer.append(item.getStyleClass());
+ } else
+ classBuffer.append(parentMenu.getDisabledItemClass() + " ")
+ .append(item.getDisabledClass());
+ return classBuffer.toString();
+ }
+
+ public String getFullStyle(FacesContext context, UIComponent component) {
+ StringBuffer styleBuffer = new StringBuffer("");
+ UIPanelMenuItem item = (UIPanelMenuItem)component;
+ UIPanelMenu parentMenu = findMenu(item);
+ if (!item.isDisabled()) {
+ if (calculateLevel(item) == 0)
+ styleBuffer.append(parentMenu.getTopItemStyle() + "; ");
+ else
+ styleBuffer.append(parentMenu.getItemStyle() + "; ");
+ styleBuffer.append(item.getStyle());
+ } else
+ styleBuffer.append(parentMenu.getDisabledItemStyle() + "; ")
+ .append(item.getDisabledStyle());
+ return styleBuffer.toString();
+ }
+
+ public String getLabelClass(FacesContext context, UIComponent component) {
+ UIPanelMenuItem item = (UIPanelMenuItem)component;
+ UIPanelMenu parentMenu = findMenu(item);
+ if(!item.isDisabled() && !parentMenu.isDisabled()){
+ if(isTopLevel(component)){
+ return "rich-pmenu-item-label rich-pmenu-top-item-label";
+ } else return "rich-pmenu-item-label";
+ }
+ return "";
+ }
+
+ public String getIconClass(FacesContext context, UIComponent component) {
+ UIPanelMenuItem item = (UIPanelMenuItem)component;
+ UIPanelMenu parentMenu = findMenu(item);
+ if(!item.isDisabled() && !parentMenu.isDisabled()){
+ if(isTopLevel(component)){
+ return "rich-pmenu-item-icon rich-pmenu-top-item-icon";
+ } else return "rich-pmenu-item-icon";
+ }
+ return "";
+ }
+}
Property changes on:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,436 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
+import org.ajax4jsf.framework.util.javascript.JSFunction;
+import org.richfaces.component.UIPanelMenu;
+import org.richfaces.component.UIPanelMenuGroup;
+import org.richfaces.component.UIPanelMenuItem;
+
+public class PanelMenuRenderer extends PanelMenuRendererBase {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.framework.renderer.RendererBase#getComponentClass()
+ */
+ protected Class getComponentClass() {
+ return UIComponent.class;
+ }
+
+ public void insertScript(FacesContext context, UIComponent component)
+ throws IOException {
+
+ StringBuffer buffer = new StringBuffer();
+ StringBuffer panelMenu = new StringBuffer();
+ List flatList = new LinkedList();
+ Map levels = new HashMap();
+
+ boolean expandSingle = ((UIPanelMenu)component).isExpandSingle();
+
+ flatten(component.getChildren(), flatList, levels, 0);
+
+ panelMenu
+ .append("new PanelMenu('")
+ .append(component.getClientId(context).toString())
+ .append("',")
+ .append(new Boolean(expandSingle).toString())
+ .append(");\n");
+
+ for (Iterator iter = flatList.iterator(); iter.hasNext();) {
+ UIComponent child = (UIComponent) iter.next();
+ if ((child instanceof UIPanelMenuItem)||(child instanceof UIPanelMenuGroup)) {
+ boolean childDisabled;
+ if (!((UIPanelMenu)component).isDisabled())
+ childDisabled = child instanceof UIPanelMenuGroup ?
((UIPanelMenuGroup)child).isDisabled() : ((UIPanelMenuItem)child).isDisabled();
+ else
+ childDisabled = true;
+ boolean childRendered = child instanceof UIPanelMenuGroup ?
((UIPanelMenuGroup)child).isRendered() : ((UIPanelMenuItem)child).isRendered();
+ boolean parentRendered = true;
+ if (! (child.getParent() instanceof UIPanelMenu))
+ parentRendered = child.getParent() instanceof UIPanelMenuGroup ?
((UIPanelMenuGroup)child.getParent()).isRendered() :
((UIPanelMenuItem)child.getParent()).isRendered();
+ if (!parentRendered){
+ child.getAttributes().put("rendered",Boolean.FALSE);
+ }
+
+ UIPanelMenu parentMenu = findMenu(child);
+
+ String event = parentMenu.getEvent();
+ if ("".equals(event))
+ event = "click";
+ else if (event.startsWith("on"))
+ event = event.substring(2);
+
+ String onopen = (child instanceof UIPanelMenuGroup) &&
!((UIPanelMenuGroup)child).isDisabled() && !isParentDisabled(child) ?
+ parentMenu.getOngroupexpand() + ";" +
((UIPanelMenuGroup)child).getOnexpand() : "";
+ String onclose = (child instanceof UIPanelMenuGroup) &&
!((UIPanelMenuGroup)child).isDisabled() && !isParentDisabled(child) ?
+ parentMenu.getOngroupcollapse() + ";" +
((UIPanelMenuGroup)child).getOncollapse() : "";
+ String hoveredStyle = (child instanceof UIPanelMenuGroup ?
+ parentMenu.getHoveredGroupStyle() : parentMenu.getHoveredItemStyle())
+ + ";" + (child instanceof UIPanelMenuGroup ?
+ ((UIPanelMenuGroup)child).getHoverStyle() :
((UIPanelMenuItem)child).getHoverStyle());
+ String hoveredClass = (child instanceof UIPanelMenuGroup ?
+ parentMenu.getHoveredGroupClass() : parentMenu.getHoveredItemClass())
+ + " " + (child instanceof UIPanelMenuGroup ?
+ ((UIPanelMenuGroup)child).getHoverClass() :
((UIPanelMenuItem)child).getHoverClass());
+ String [] hoveredStyles = hoveredStyle.split(";");
+ String [] hoveredClasses = hoveredClass.split(" ");
+
+ String mode = getItemMode(child);
+ Object target = child.getAttributes().get("target");
+ String targetString;
+ if (null == target)
+ targetString = "";
+ else
+ targetString = target.toString();
+
+
+
+ if (childRendered && parentRendered){
+ if ( !isParentDisabled(child) ){
+ buffer
+ .append("new PanelMenuItem({myId:'")
+ .append((String) child.getClientId(context))
+ .append("',parentId:'")
+ .append((String) child.getParent().getClientId(context))
+ .append("'},{type:" + (child instanceof UIPanelMenuItem ?
"\"item\"":"\"node\""))
+ .append(",onopen:"+("".equals(onopen) ?
"\"\"" : "\"" + onopen +
"\"")+",onclose:"+("".equals(onclose) ?
"\"\"" : "\"" + onclose + "\""))
+ .append(",event:\"" + event + "\"")
+ .append(",mode:\"" + mode + "\"")
+ .append(",target:\"" + targetString + "\"")
+ .append(",disabled:" +
+ new Boolean(childDisabled).toString())
+ .append("},{");
+
+
+ for (int i = 0; i < hoveredStyles.length; i++)
+ if (!"".equals(hoveredStyles[i])) {
+ String [] temp = hoveredStyles[i].split(":");
+ String cssName = temp[0].trim();
+ String cssValue = temp[1].trim();
+ buffer.append("\"" + cssName + "\": \"" +
cssValue + "\"");
+ if (i != hoveredStyles.length - 1)
+ buffer.append(",");
+ }
+
+ buffer.append("},");
+ if (hoveredClasses.length > 0) {
+ buffer.append("new Array(");
+ for (int i = 0; i < hoveredClasses.length; i++)
+ if (!"".equals(hoveredClasses[i])) {;
+ buffer.append("\"" + hoveredClasses[i] + "\"");
+ if (i != hoveredClasses.length - 1)
+ buffer.append(",");
+ }
+ buffer.append("),");
+ } else
+ buffer.append("new Array(),");
+
+ buffer.append(levels.get(child.getClientId(context)));
+ switchOnImagesIfNeeded(context,child,buffer);
+
+ addActionIfNeeded(context,child,buffer);
+
+ setExpandedIfNeeded(context,child,buffer);
+
+ addAjaxFunction(context,child,buffer);
+
+ addOnItemHover(parentMenu.getOnitemhover(), child, buffer);
+
+ String iconPos = "left";
+ boolean isTopLevel = isTopLevel(child);
+ if(child instanceof UIPanelMenuGroup){
+ iconPos = isTopLevel ? parentMenu.getIconGroupTopPosition() :
parentMenu.getIconGroupPosition();
+ } else {
+ iconPos = isTopLevel ? parentMenu.getIconItemTopPosition() :
parentMenu.getIconItemPosition();
+ }
+
+ buffer.append(","+'"'+iconPos+'"');
+
+ addImages(buffer,context,child,component.getClientId(context).toString());
+
+ buffer.append(");\n");
+ }
+ } else {
+ continue;
+ }
+ }
+ }
+ StringBuffer ret = new StringBuffer();
+ ret.append("<script ");
+ ret.append("type=\"text/javascript\" ");
+ ret.append("id =\"script" +
component.getClientId(context)+"\">\n");
+ ret.append(panelMenu);
+ ret.append(buffer);
+ ret.append("\n</script>");
+
+ ResponseWriter writer = context.getResponseWriter();
+ writer.write(ret.toString());
+ }
+
+ public void flatten(List children, List flatList, Map levels,int initialLevel) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ if (children != null) {
+ for (Iterator iter = children.iterator(); iter.hasNext();) {
+ UIComponent child = (UIComponent) iter.next();
+ if (child instanceof UIPanelMenu){
+ continue;
+ }
+ flatList.add(child);
+ levels.put(child.getClientId(context), new Integer(initialLevel));
+ flatten(child.getChildren(), flatList, levels, initialLevel + 1);
+ }
+ }
+ }
+
+ private void switchOnImagesIfNeeded(FacesContext context, UIComponent child,
StringBuffer buffer)throws IOException {
+ boolean isToplevel = isTopLevel(child);
+ String customIconOpened = "";
+ String customIconClosed = "";
+
+ UIPanelMenu panelMenu = findMenu(child);
+ if(panelMenu == null){
+ return;
+ }
+ String iconOpened = isToplevel ? panelMenu.getIconExpandedTopGroup() :
panelMenu.getIconExpandedGroup();
+ String iconClosed = isToplevel ? panelMenu.getIconCollapsedTopGroup() :
panelMenu.getIconCollapsedGroup();
+
+ try {
+ customIconOpened = (String)child.getAttributes().get("iconOpened");
+ customIconClosed = (String)child.getAttributes().get("iconClosed");
+ } catch (Exception e) {}
+
+ if (child instanceof UIPanelMenuItem){
+ buffer.append(",false");
+ } else {
+ if
(iconClosed.equals("custom")&&iconOpened.equals("custom")){
+ if
(customIconClosed.equals("")&&customIconOpened.equals("")){
+ buffer.append(",false");
+ } else {
+ buffer.append(",true");
+ }
+ } else {
+ buffer.append(",true");
+ }
+ }
+ }
+
+ private void addActionIfNeeded(FacesContext context,UIComponent child,StringBuffer
buffer){
+ //TODO by nick - dima - use CommandScriptBuilder
+ if (child instanceof UIPanelMenuItem){
+ if (((UIPanelMenuItem)child).getAction() == null){
+ buffer.append(",false");
+ } else {
+ buffer.append(",true");
+ }
+ } else {
+ if
(((UIPanelMenuGroup)child).getAction()!=null&&!((UIPanelMenuGroup)child).getAction().equals("")){
+ buffer.append(",'panelMenuNodeAction'");
+ } else {
+ buffer.append(",false");
+ }
+ }
+ }
+
+ private void setExpandedIfNeeded(FacesContext context,UIComponent child,StringBuffer
buffer){
+ if(child instanceof UIPanelMenuItem){
+ buffer.append(",false");
+ } else {
+ UIPanelMenuGroup group = (UIPanelMenuGroup)child;
+ if(group.getValue() != null){
+ buffer.append(",").append(group.getValue().toString());
+ } else {
+ PanelMenuGroupRenderer r =
(PanelMenuGroupRenderer)context.getRenderKit().getRenderer(group.getFamily(),
group.getRendererType());
+ boolean isNodeOpened;
+ try {
+ isNodeOpened = r.isOpened(context, child);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+// e.printStackTrace();
+ isNodeOpened = false;
+ }
+ buffer.append(",").append(String.valueOf(isNodeOpened));
+ }
+ }
+ }
+
+ private void addImages(StringBuffer buffer,FacesContext context,UIComponent
component,String id){
+ UIPanelMenu panelMenu = findMenu(component);
+ if(panelMenu == null){
+ return;
+ }
+ boolean isTopLevel = isTopLevel(component);
+
+ final String PANEL_MENU_SPACER_ICON = getIconByType(PANEL_MENU_SPACER_ICON_NAME,
isTopLevel,context, component);
+
+ if(component instanceof UIPanelMenuItem){
+ UIPanelMenuItem item = (UIPanelMenuItem)component;
+
+ String defaultItemIcon = null;
+ String defaultItemIconSrc = null;
+ String customItemIcon = null;
+ String customIconSource = null;
+
+ if(isTopLevel){
+ if(item.isDisabled()){
+ defaultItemIcon = panelMenu.getIconTopDisabledItem();
+ } else {
+ defaultItemIcon = panelMenu.getIconTopItem();
+ }
+ if(defaultItemIcon == null || defaultItemIcon.equals("")){
+ if(item.isDisabled()){
+ defaultItemIcon = panelMenu.getIconDisabledItem();
+ } else {
+ defaultItemIcon = panelMenu.getIconItem();
+ }
+ }
+ } else {
+ //isTopLevel == false
+ if(defaultItemIcon == null || defaultItemIcon.equals("")){
+ if(item.isDisabled()){
+ defaultItemIcon = panelMenu.getIconDisabledItem();
+ } else {
+ defaultItemIcon = panelMenu.getIconItem();
+ }
+ }
+ }
+
+ if(defaultItemIcon != null && defaultItemIcon.equals("none")){
+ defaultItemIconSrc = PANEL_MENU_SPACER_ICON;
+ } else {
+ defaultItemIconSrc = getIconByType(defaultItemIcon, isTopLevel,context, component);
+ }
+
+
+ customItemIcon = item.isDisabled() ? item.getIconDisabled() : item.getIcon();
+ if(customItemIcon != null && customItemIcon.equals("none")){
+ customIconSource = PANEL_MENU_SPACER_ICON;
+ } else {
+ customIconSource = getIconByType(customItemIcon, isTopLevel,context, component);
+ }
+
+ if(customItemIcon != null && !customItemIcon.equals("")){
+ buffer.append(","+'"'+customIconSource+'"').append(","+'"'+customIconSource+'"'+"
");
+ } else if (defaultItemIcon != null && !defaultItemIcon.equals("")){
+ buffer.append(","+'"'+defaultItemIconSrc+'"').append(","+'"'+defaultItemIconSrc+'"'+"
");
+ } else {
+ buffer.append(","+'"'+PANEL_MENU_SPACER_ICON+'"').append(","+'"'+PANEL_MENU_SPACER_ICON+'"'+"
");
+ }
+ buffer.append(",\"\" ");
+
+ } else if(component instanceof UIPanelMenuGroup){
+ UIPanelMenuGroup group = (UIPanelMenuGroup)component;
+
+ String defaultIconNodeClosed = isTopLevel ? (group.isDisabled() ?
panelMenu.getIconTopDisableGroup() : panelMenu.getIconCollapsedTopGroup()) :
(group.isDisabled() ? panelMenu.getIconDisabledGroup() :
panelMenu.getIconCollapsedGroup());
+
+ if(isTopLevel){
+ if(group.isDisabled()){
+ defaultIconNodeClosed = panelMenu.getIconTopDisableGroup();
+ if(defaultIconNodeClosed == null || defaultIconNodeClosed.equals("")){
+ defaultIconNodeClosed = panelMenu.getIconDisabledGroup();
+ }
+ } else {
+ defaultIconNodeClosed = panelMenu.getIconCollapsedTopGroup();
+ if(defaultIconNodeClosed == null || defaultIconNodeClosed.equals("")){
+ defaultIconNodeClosed = panelMenu.getIconCollapsedGroup();
+ }
+ }
+ } else {
+ if(group.isDisabled()){
+ defaultIconNodeClosed = panelMenu.getIconDisabledGroup();
+ } else {
+ defaultIconNodeClosed = panelMenu.getIconCollapsedGroup();
+ }
+ }
+
+ String defaultIconNodeOpened = isTopLevel ? panelMenu.getIconExpandedTopGroup() :
panelMenu.getIconExpandedGroup();
+
+ if(isTopLevel){
+ defaultIconNodeOpened = panelMenu.getIconExpandedTopGroup();
+ if(defaultIconNodeOpened == null || defaultIconNodeOpened.equals("")){
+ defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
+ }
+ } else {
+ defaultIconNodeOpened = panelMenu.getIconExpandedGroup();
+ }
+
+ String defaultIconNodeClosedSrc = getIconByType(defaultIconNodeClosed,
isTopLevel,context, component);
+ String defaultIconNodeOpenedSrc = getIconByType(defaultIconNodeOpened,
isTopLevel,context, component);
+
+ String iconExpanded = "";
+ String iconCollapsed = "";
+ String iconExpandedSource = "";
+ String iconCollapsedSource = "";
+
+ iconExpanded = group.isDisabled() ? group.getIconDisabled() :
group.getIconExpanded();
+ iconCollapsed = group.isDisabled() ? group.getIconDisabled() :
group.getIconCollapsed();
+ iconExpandedSource = getIconByType(iconExpanded,isTopLevel,context,component);
+ iconCollapsedSource = getIconByType(iconCollapsed,isTopLevel,context,component);
+
+ if(iconExpanded != null && !iconExpanded.equals("")){
+ buffer.append(","+'"'+ iconExpandedSource +
'"');
+ } else if(defaultIconNodeOpened != null &&
!defaultIconNodeOpened.equals("")){
+ buffer.append(","+'"'+defaultIconNodeOpenedSrc +
'"');
+ } else {
+ buffer.append(","+'"'+PANEL_MENU_SPACER_ICON +
'"');
+ }
+
+ if(iconCollapsed != null && !iconCollapsed.equals("")){
+ buffer.append(","+'"'+iconCollapsedSource+'"');
+ } else if(defaultIconNodeClosed != null &&
!defaultIconNodeClosed.equals("")){
+ buffer.append(","+'"'+defaultIconNodeClosedSrc+'"');
+ } else {
+ buffer.append(","+'"'+PANEL_MENU_SPACER_ICON +
'"');
+ }
+ }
+ buffer.append(",\"" + PANEL_MENU_SPACER_ICON + "\"");
+ }
+
+ protected void addAjaxFunction(FacesContext context, UIComponent child, StringBuffer
buffer) {
+ JSFunction function = AjaxRendererUtils.buildAjaxFunction(child,
+ context);
+ Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
+ child);
+ function.addParameter(eventOptions);
+
+ buffer.append(",\"");
+ function.appendScript(buffer);
+ buffer.append("\"");
+ }
+
+ protected void addOnItemHover(String menuOnItemHover, UIComponent child, StringBuffer
buffer) {
+ buffer.append(",\"");
+ if(child instanceof UIPanelMenuItem){
+ if(menuOnItemHover != null && !menuOnItemHover.equals(""))
buffer.append(menuOnItemHover);
+ }
+ buffer.append("\"");
+ }
+
+}
Property changes on:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRendererBase.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRendererBase.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRendererBase.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,293 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase;
+import org.ajax4jsf.framework.renderer.compiler.TemplateContext;
+import org.ajax4jsf.framework.skin.Skin;
+import org.ajax4jsf.framework.util.style.CSSFormat;
+import org.richfaces.component.UIPanelMenu;
+import org.richfaces.component.UIPanelMenuGroup;
+import org.richfaces.component.UIPanelMenuItem;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconChevron;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconChevronDown;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconChevronUp;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconDisc;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconGrid;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconSpacer;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconTriangle;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconTriangleDown;
+import org.richfaces.renderkit.html.iconimages.PanelMenuIconTriangleUp;
+import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
+
+/**
+ * @author hans
+ *
+ */
+public abstract class PanelMenuRendererBase extends HeaderResourcesRendererBase {
+
+ final static String PANEL_MENU_SPACER_ICON_NAME = "spacer";
+
+ public void insertTDs(FacesContext context , UIComponent component) throws IOException
{
+ ResponseWriter writer = context.getResponseWriter();
+ int level = calculateLevel(component);
+ //StringBuffer buffer = new StringBuffer();
+ String src = getIconByType("custom",false,context,component);
+ int w = 16; //width(context);
+
+ for (int i=0;i<level;i++){
+ writer.startElement(HTML.td_ELEM, component);
+ writer.startElement("img", component);
+ writer.writeAttribute("src", src, null);
+ writer.writeAttribute("alt", "", null);
+ writer.writeAttribute("hspace", "0", null);
+ writer.writeAttribute("vspace", "0", null);
+ writer.writeAttribute("height", String.valueOf(w), null);
+ writer.writeAttribute("width", String.valueOf(w), null);
+ writer.writeAttribute("style", "display:block; ", null);
+ writer.endElement("img");
+ writer.endElement(HTML.td_ELEM);
+ }
+ }
+
+ protected int calculateLevel (UIComponent component){
+ int level = 0;
+ UIComponent parent = component.getParent();
+ while(parent != null){
+ if(parent instanceof UIPanelMenu){
+ return level;
+ } else if(parent instanceof UIPanelMenuGroup){
+ level++;
+ }
+ parent = parent.getParent();
+ }
+ return level;
+ }
+
+ /**
+ * If icon type is a pre-defined value, return corresponding image, otherwise
+ * otherwise
+ * @param iconType
+ * @param context
+ * @param component
+ * @return URI of requested image
+ */
+ protected String getIconByType(String iconType, boolean isTopLevel, FacesContext
context,
+ UIComponent component){
+
+ String source = "";
+ String color = "";
+ Skin skin = getSkin(context);
+
+ if (isTopLevel){
+ color = (String) skin.getParameter(context,"panelmenu.headerBulletColor");
+ } else {
+ color = (String) skin.getParameter(context,"panelmenu.itemBulletColor");
+ }
+ if(iconType != null && !iconType.equals("none")){
+ if (iconType.equals("custom")){
+ source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
+ } else if (iconType.equals("spacer")){
+ source = getResource(PanelMenuIconSpacer.class.getName()).getUri(context, color);
+ } else if (iconType.equals("triangle")) {
+ source = getResource(PanelMenuIconTriangle.class.getName()).getUri(context, color);
+ } else if (iconType.equals("triangleDown")) {
+ source = getResource(PanelMenuIconTriangleDown.class.getName()).getUri(context,
color);
+ } else if (iconType.equals("triangleUp")) {
+ source = getResource(PanelMenuIconTriangleUp.class.getName()).getUri(context,
color);
+ } else if (iconType.equals("chevron")) {
+ source = getResource(PanelMenuIconChevron.class.getName()).getUri(context, color);
+ } else if (iconType.equals("chevronUp")) {
+ source = getResource(PanelMenuIconChevronUp.class.getName()).getUri(context, color);
+ } else if (iconType.equals("chevronDown")) {
+ source = getResource(PanelMenuIconChevronDown.class.getName()).getUri(context,
color);
+// } else if (iconType.equals("square")) {
+// source = getResource(PanelMenuIconSquare.class.getName()).getUri(context, color);
+ } else if (iconType.equals("disc")) {
+ source = getResource(PanelMenuIconDisc.class.getName()).getUri(context, color);
+ } else if (iconType.equals("grid")) {
+ source = getResource(PanelMenuIconGrid.class.getName()).getUri(context, color);
+ } else {
+ //TODO by nick - dima - TemplateContext is deprecated and shouldn't be used
+ source = (String)getUtils().encodeResourceURL(new
TemplateContext(this,context,component),iconType);
+ }
+ }
+ return source;
+ }
+
+ protected UIPanelMenu findMenu (UIComponent component){
+ if (component instanceof UIPanelMenu) return (UIPanelMenu)component;
+ UIComponent parent = component;
+ while(parent != null){
+ if(parent instanceof UIPanelMenu){
+ return (UIPanelMenu) parent;
+ }
+ parent = parent.getParent();
+ }
+ return (UIPanelMenu) parent;
+ }
+
+ public String getHideStyle(FacesContext context, UIComponent component) {
+ if (!(component.getParent() instanceof UIPanelMenu)) {
+ CSSFormat format = new CSSFormat();
+ format.add("display", "none");
+ if(component.getParent() instanceof UIPanelMenuGroup) {
+ UIPanelMenuGroup parent = (UIPanelMenuGroup)component.getParent();
+ PanelMenuGroupRenderer renderer = (PanelMenuGroupRenderer)
context.getRenderKit().getRenderer(parent.getFamily(), parent.getRendererType());
+ try {
+ if ( renderer.isOpened(context, parent) ){
+ return "";
+ } else
+ return format.toString();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } else return format.toString();
+ }
+ return "";
+ }
+
+ public void insertValue(FacesContext context, UIComponent component) throws IOException
{
+ Object value = component.getAttributes().get("value");
+ if (value!=null){
+ context.getResponseWriter().write(value.toString());
+ }
+ }
+
+ protected boolean isChildrenExpanded(UIComponent component){
+ if (component.getChildren() != null){
+ Iterator itr = component.getChildren().iterator();
+ while(itr.hasNext()){
+ UIComponent child = (UIComponent)itr.next();
+ if(child instanceof UIPanelMenuGroup){
+ if( ((UIPanelMenuGroup)child).isExpanded() ){
+ return true;
+ } else {
+ return isChildrenExpanded(child);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ protected boolean isParentDisabled(UIComponent component){
+ boolean returnValue = false;
+ UIComponent parent = component.getParent();
+ if(parent instanceof UIPanelMenuGroup){
+ UIPanelMenuGroup parentGroup = (UIPanelMenuGroup)parent;
+ if(parentGroup.isDisabled()){
+ returnValue = true;
+ } else {
+ returnValue = isParentDisabled(parentGroup);
+ }
+ }
+ return returnValue;
+ }
+
+ protected boolean isSubmitted(FacesContext context, UIComponent component){
+ boolean submitted = false;
+ String clientId = component.getClientId(context);
+ Map requestParameterMap = context.getExternalContext().getRequestParameterMap();
+
+ Object value = requestParameterMap.get("panelMenuAction"+clientId);
+ if (clientId!=null&&value!=null){
+ if (value.equals(clientId)) {
+ submitted = true;
+ }
+ }
+ return submitted;
+ }
+
+ protected String getItemMode(UIComponent component) {
+ String parentExpandMode = findMenu(component).getExpandMode();
+ String parentMode = findMenu(component).getMode();
+ if (null == parentMode || "".equals(parentMode))
+ parentMode = "server";
+ if (null == parentExpandMode || "".equals(parentExpandMode))
+ parentExpandMode = "none";
+ String mode = "none";
+ if (component instanceof UIPanelMenuGroup) {
+ UIPanelMenuGroup group = (UIPanelMenuGroup) component;
+ if (null != group.getMode() && ! "".equals(group.getMode()))
+ mode = group.getMode();
+ else
+ mode = parentExpandMode;
+ } else if (component instanceof UIPanelMenuItem) {
+ UIPanelMenuItem item = (UIPanelMenuItem) component;
+ if (null != item.getMode() && ! "".equals(item.getMode()))
+ mode = item.getMode();
+ else
+ mode = parentMode;
+ }
+ return mode;
+ }
+
+ /**
+ *
+ * @param component
+ * @return
+ */
+ public boolean isTopLevel(UIComponent component){
+ UIComponent parent = component.getParent();
+ while( !(parent instanceof UIPanelMenu) && !(parent instanceof
UIPanelMenuGroup)) {
+ parent = parent.getParent();
+ }
+ if(parent instanceof UIPanelMenu){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ *
+ * @param writer
+ * @param iconType
+ * @param imageSrc
+ * @param component
+ * @throws IOException
+ */
+ public void drawIcon(ResponseWriter writer, String iconType, String imageSrc,
UIComponent component) throws IOException{
+ if (iconType != null && !iconType.equals("") &&
!iconType.equals("none")){
+ int h = 16; //width(context);
+ writer.startElement("img", component);
+ writer.writeAttribute("src", imageSrc, null);
+ writer.writeAttribute("alt", "", null);
+ writer.writeAttribute("vspace", "0", null);
+ writer.writeAttribute("hspace", "0", null);
+ writer.writeAttribute("style", "display:block; ", null);
+ writer.writeAttribute("width", String.valueOf(h), null);
+ writer.writeAttribute("height", String.valueOf(h), null);
+ writer.endElement("img");
+ }
+
+ }
+
+}
Property changes on:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/PanelMenuRendererBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/PanelMenuGroupGradient.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuGroupGradient.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/PanelMenuGroupGradient.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/PanelMenuGroupGradient.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,32 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.gradientimages;
+
+import org.ajax4jsf.framework.skin.Skin;
+import org.richfaces.renderkit.html.BaseGradient;
+
+public class PanelMenuGroupGradient extends BaseGradient {
+ public PanelMenuGroupGradient() {
+ super(10, 40, 14, "headerGradientColor", Skin.headerBackgroundColor);
+ }
+
+}
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/PanelMenuItemGradient.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/gradientImages/PanelMenuItemGradient.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/PanelMenuItemGradient.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/gradientimages/PanelMenuItemGradient.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,31 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.gradientimages;
+
+import org.ajax4jsf.framework.skin.Skin;
+import org.richfaces.renderkit.html.BaseGradient;
+
+public class PanelMenuItemGradient extends BaseGradient {
+ public PanelMenuItemGradient() {
+ super(10, 40, 14, "controlBackgroundColor",
Skin.generalBackgroundColor);
+ }
+}
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,95 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.framework.resource.GifRenderer;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.Java2Dresource;
+import org.ajax4jsf.framework.resource.ResourceContext;
+import org.ajax4jsf.framework.skin.Skin;
+import org.ajax4jsf.framework.skin.SkinFactory;
+import org.ajax4jsf.framework.util.HtmlColor;
+import org.ajax4jsf.framework.util.HtmlDimensions;
+
+
+/**
+ * @author Pavel Kotikov
+ *
+ */
+public class PanelMenuIconBasic extends Java2Dresource {
+
+ public PanelMenuIconBasic() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return calculateDimensions(getDataToStore(facesContext, data));
+ }
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return calculateDimensions(restoreData(resourceContext));
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+
+ }
+
+ protected Dimension calculateDimensions(Object data){
+ Object [] stored = (Object []) data;
+ int h = ((Integer) stored[0]).intValue();
+ return new Dimension(h,h);
+ }
+
+
+ /**
+ * @param data - pass icon color there
+ */
+ protected Object getDataToStore(FacesContext context, Object data) {
+ Object[] stored = new Object[5];
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+
+ stored[0] = new Integer(HtmlDimensions.decode("16px").intValue());
+
+ Color col = null;
+
+ if (data!=null){
+ col = HtmlColor.decode(data.toString());
+ } else {
+ col = HtmlColor.decode(skin.getParameter(context,
"headerTextColor").toString());
+ }
+ stored[1]= col;
+ return stored;
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+
+}
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevron.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,81 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconChevron extends PanelMenuIconBasic {
+
+ protected void paint(ResourceContext context, Graphics2D graphics2d) {
+
+ BufferedImage bufferedImage = new BufferedImage(128, 128,
BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g2d = bufferedImage.createGraphics();
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
+
+ Dimension dimension = getDimensions(context);
+ GeneralPath path = new GeneralPath();
+ g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
+ g2d.translate(28,28);
+ Object [] data = (Object[]) restoreData(context);
+ Color col = (Color)data[1];
+
+ g2d.setColor(col);
+
+ path.moveTo(1,1);
+ path.lineTo(17,1);
+ path.lineTo(47,31);
+ path.lineTo(17,61);
+ path.lineTo(1,61);
+ path.lineTo(31,31);
+ path.closePath();
+ g2d.fill(path);
+
+ g2d.translate(24,0);
+
+ g2d.fill(path);
+
+ AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128,
dimension.getHeight()/128);
+ AffineTransformOp transformOp = new AffineTransformOp(transform,
AffineTransformOp.TYPE_BILINEAR);
+
+ graphics2d.drawImage(bufferedImage,transformOp, 0, 0);
+
+ g2d.dispose();
+ }
+}
\ No newline at end of file
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronDown.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,80 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconChevronDown extends PanelMenuIconBasic {
+
+ protected void paint(ResourceContext context, Graphics2D graphics2D) {
+ BufferedImage bufferedImage = new BufferedImage(128, 128,
BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g2d = bufferedImage.createGraphics();
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
+
+ Dimension dimension = getDimensions(context);
+ GeneralPath path = new GeneralPath();
+ g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
+ g2d.translate(28,28);
+ Object [] data = (Object[]) restoreData(context);
+ Color col = (Color)data[1];
+
+ g2d.setColor(col);
+
+ path.moveTo(1,0);
+ path.lineTo(31,30);
+ path.lineTo(61,0);
+ path.lineTo(61,16);
+ path.lineTo(31,46);
+ path.lineTo(1,16);
+ path.closePath();
+ g2d.fill(path);
+
+ g2d.translate(0,24);
+
+ g2d.fill(path);
+
+ AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128,
dimension.getHeight()/128);
+ AffineTransformOp transformOp = new AffineTransformOp(transform,
AffineTransformOp.TYPE_BILINEAR);
+
+ graphics2D.drawImage(bufferedImage,transformOp, 0, 0);
+
+ g2d.dispose();
+ }
+}
\ No newline at end of file
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronUp.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,80 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.BufferedImage;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconChevronUp extends PanelMenuIconBasic {
+
+ protected void paint(ResourceContext context, Graphics2D graphics2D) {
+ BufferedImage bufferedImage = new BufferedImage(128, 128,
BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g2d = bufferedImage.createGraphics();
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
+
+ Dimension dimension = getDimensions(context);
+ GeneralPath path = new GeneralPath();
+ g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
+ g2d.translate(28,28);
+ Object [] data = (Object[]) restoreData(context);
+ Color col = (Color)data[1];
+
+ g2d.setColor(col);
+
+ path.moveTo(0,46);
+ path.lineTo(0,31);
+ path.lineTo(30,1);
+ path.lineTo(61,31);
+ path.lineTo(61,46);
+ path.lineTo(30,16);
+ path.closePath();
+ g2d.fill(path);
+
+ g2d.translate(0,24);
+
+ g2d.fill(path);
+
+ AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128,
dimension.getHeight()/128);
+ AffineTransformOp transformOp = new AffineTransformOp(transform,
AffineTransformOp.TYPE_BILINEAR);
+
+ graphics2D.drawImage(bufferedImage,transformOp, 0, 0);
+
+ g2d.dispose();
+ }
+}
\ No newline at end of file
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,50 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Ellipse2D;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconDisc extends PanelMenuIconBasic {
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+
+ Dimension dimension = getDimensions(context);
+ Object [] data = (Object[]) restoreData(context);
+ Color col = (Color)data[1];
+
+ int dim = (int) Math.round(dimension.getWidth() / 3);
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setColor(col);
+ g2d.translate(dim,dim);
+ Ellipse2D dot = new Ellipse2D.Double(0, 0, dim, dim);
+ g2d.fill(dot);
+
+ }
+}
\ No newline at end of file
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconGrid.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,63 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Rectangle2D;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconGrid extends PanelMenuIconBasic {
+
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
+ Rectangle2D.Float path = new Rectangle2D.Float();
+ Dimension dimension = getDimensions(context);
+ g2d.setStroke(new BasicStroke(16,BasicStroke.CAP_SQUARE,BasicStroke.JOIN_BEVEL));
+ g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
+
+ g2d.translate(40,40);
+
+ path.setRect(0,0,40,40);
+ Object [] data = (Object[]) restoreData(context);
+ Color col = (Color)data[1];
+
+ g2d.setColor(col);
+ Color bcolor = new Color(1f,1f,1f,0f);
+ g2d.setBackground(bcolor);
+ g2d.fill(path);
+ g2d.clearRect(16,0,8,40);
+ g2d.clearRect(0,16,40,8);
+ }
+}
\ No newline at end of file
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,33 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.Graphics2D;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+public class PanelMenuIconSpacer extends PanelMenuIconBasic {
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+
+ }
+}
\ No newline at end of file
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangle.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,51 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.GeneralPath;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+public class PanelMenuIconTriangle extends PanelMenuIconBasic {
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
+ GeneralPath path = new GeneralPath();
+
+ Dimension dimension = getDimensions(context);
+ g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
+ g2d.translate(47,30);
+ path.moveTo(0,0);
+ path.lineTo(33,33);
+ path.lineTo(33,34);
+ path.lineTo(0,67);
+ path.closePath();
+ g2d.setColor((Color)(((Object[]) restoreData(context))[1]));
+ g2d.fill(path);
+ }
+}
\ No newline at end of file
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleDown.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,57 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.GeneralPath;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconTriangleDown extends PanelMenuIconBasic {
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
+ GeneralPath path = new GeneralPath();
+
+ Dimension dimension = getDimensions(context);
+
+ g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
+ g2d.translate(31,54);
+
+ path.moveTo(0,0);
+ path.lineTo(33,33);
+ path.lineTo(34,33);
+ path.lineTo(67,0);
+ path.closePath();
+ Object [] data = (Object[]) restoreData(context);
+ Color col = (Color)data[1];
+
+ g2d.setColor(col);
+ g2d.fill(path);
+ }
+}
Copied:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java
(from rev 1128,
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleUp.java)
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java
(rev 0)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -0,0 +1,56 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.GeneralPath;
+import org.ajax4jsf.framework.resource.ResourceContext;
+
+
+
+public class PanelMenuIconTriangleUp extends PanelMenuIconBasic {
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
+ GeneralPath path = new GeneralPath();
+
+ Dimension dimension = getDimensions(context);
+
+ g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
+ g2d.translate(31,47);
+ path.moveTo(0,33);
+ path.lineTo(33,0);
+ path.lineTo(34,0);
+ path.lineTo(67,33);
+ path.closePath();
+ Object [] data = (Object[]) restoreData(context);
+ Color col = (Color)data[1];
+
+ g2d.setColor(col);
+ g2d.fill(path);
+ }
+}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconBasic.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,95 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.util.Date;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.framework.resource.GifRenderer;
-import org.ajax4jsf.framework.resource.InternetResourceBuilder;
-import org.ajax4jsf.framework.resource.Java2Dresource;
-import org.ajax4jsf.framework.resource.ResourceContext;
-import org.ajax4jsf.framework.skin.Skin;
-import org.ajax4jsf.framework.skin.SkinFactory;
-import org.ajax4jsf.framework.util.HtmlColor;
-import org.ajax4jsf.framework.util.HtmlDimensions;
-
-
-/**
- * @author Pavel Kotikov
- *
- */
-public class PanelMenuIconBasic extends Java2Dresource {
-
- public PanelMenuIconBasic() {
- setRenderer(new GifRenderer());
- setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
- }
-
-
- public Dimension getDimensions(FacesContext facesContext, Object data) {
- return calculateDimensions(getDataToStore(facesContext, data));
- }
- protected Dimension getDimensions(ResourceContext resourceContext) {
- return calculateDimensions(restoreData(resourceContext));
- }
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
-
- }
-
- protected Dimension calculateDimensions(Object data){
- Object [] stored = (Object []) data;
- int h = ((Integer) stored[0]).intValue();
- return new Dimension(h,h);
- }
-
-
- /**
- * @param data - pass icon color there
- */
- protected Object getDataToStore(FacesContext context, Object data) {
- Object[] stored = new Object[5];
- Skin skin = SkinFactory.getInstance().getSkin(context);
-
- stored[0] = new Integer(HtmlDimensions.decode("16px").intValue());
-
- Color col = null;
-
- if (data!=null){
- col = HtmlColor.decode(data.toString());
- } else {
- col = HtmlColor.decode(skin.getParameter(context,
"headerTextColor").toString());
- }
- stored[1]= col;
- return stored;
- }
-
- public boolean isCacheable() {
- return true;
- }
-
-}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevron.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevron.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevron.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,81 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.GeneralPath;
-import java.awt.image.AffineTransformOp;
-import java.awt.image.BufferedImage;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-
-public class PanelMenuIconChevron extends PanelMenuIconBasic {
-
- protected void paint(ResourceContext context, Graphics2D graphics2d) {
-
- BufferedImage bufferedImage = new BufferedImage(128, 128,
BufferedImage.TYPE_INT_ARGB);
- Graphics2D g2d = bufferedImage.createGraphics();
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
- g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
- g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
-
- Dimension dimension = getDimensions(context);
- GeneralPath path = new GeneralPath();
- g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
- g2d.translate(28,28);
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
-
- g2d.setColor(col);
-
- path.moveTo(1,1);
- path.lineTo(17,1);
- path.lineTo(47,31);
- path.lineTo(17,61);
- path.lineTo(1,61);
- path.lineTo(31,31);
- path.closePath();
- g2d.fill(path);
-
- g2d.translate(24,0);
-
- g2d.fill(path);
-
- AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128,
dimension.getHeight()/128);
- AffineTransformOp transformOp = new AffineTransformOp(transform,
AffineTransformOp.TYPE_BILINEAR);
-
- graphics2d.drawImage(bufferedImage,transformOp, 0, 0);
-
- g2d.dispose();
- }
-}
\ No newline at end of file
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronDown.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronDown.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronDown.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,80 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.GeneralPath;
-import java.awt.image.AffineTransformOp;
-import java.awt.image.BufferedImage;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-
-public class PanelMenuIconChevronDown extends PanelMenuIconBasic {
-
- protected void paint(ResourceContext context, Graphics2D graphics2D) {
- BufferedImage bufferedImage = new BufferedImage(128, 128,
BufferedImage.TYPE_INT_ARGB);
- Graphics2D g2d = bufferedImage.createGraphics();
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
- g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
- g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
-
- Dimension dimension = getDimensions(context);
- GeneralPath path = new GeneralPath();
- g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
- g2d.translate(28,28);
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
-
- g2d.setColor(col);
-
- path.moveTo(1,0);
- path.lineTo(31,30);
- path.lineTo(61,0);
- path.lineTo(61,16);
- path.lineTo(31,46);
- path.lineTo(1,16);
- path.closePath();
- g2d.fill(path);
-
- g2d.translate(0,24);
-
- g2d.fill(path);
-
- AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128,
dimension.getHeight()/128);
- AffineTransformOp transformOp = new AffineTransformOp(transform,
AffineTransformOp.TYPE_BILINEAR);
-
- graphics2D.drawImage(bufferedImage,transformOp, 0, 0);
-
- g2d.dispose();
- }
-}
\ No newline at end of file
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronUp.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronUp.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconChevronUp.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,80 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.GeneralPath;
-import java.awt.image.AffineTransformOp;
-import java.awt.image.BufferedImage;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-
-public class PanelMenuIconChevronUp extends PanelMenuIconBasic {
-
- protected void paint(ResourceContext context, Graphics2D graphics2D) {
- BufferedImage bufferedImage = new BufferedImage(128, 128,
BufferedImage.TYPE_INT_ARGB);
- Graphics2D g2d = bufferedImage.createGraphics();
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
- g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
- g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
-
- Dimension dimension = getDimensions(context);
- GeneralPath path = new GeneralPath();
- g2d.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
- g2d.translate(28,28);
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
-
- g2d.setColor(col);
-
- path.moveTo(0,46);
- path.lineTo(0,31);
- path.lineTo(30,1);
- path.lineTo(61,31);
- path.lineTo(61,46);
- path.lineTo(30,16);
- path.closePath();
- g2d.fill(path);
-
- g2d.translate(0,24);
-
- g2d.fill(path);
-
- AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight()/128,
dimension.getHeight()/128);
- AffineTransformOp transformOp = new AffineTransformOp(transform,
AffineTransformOp.TYPE_BILINEAR);
-
- graphics2D.drawImage(bufferedImage,transformOp, 0, 0);
-
- g2d.dispose();
- }
-}
\ No newline at end of file
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconDisc.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,50 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Ellipse2D;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-
-public class PanelMenuIconDisc extends PanelMenuIconBasic {
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
-
- Dimension dimension = getDimensions(context);
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
-
- int dim = (int) Math.round(dimension.getWidth() / 3);
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setColor(col);
- g2d.translate(dim,dim);
- Ellipse2D dot = new Ellipse2D.Double(0, 0, dim, dim);
- g2d.fill(dot);
-
- }
-}
\ No newline at end of file
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconGrid.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconGrid.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconGrid.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,63 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Rectangle2D;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-
-public class PanelMenuIconGrid extends PanelMenuIconBasic {
-
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
- g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
- Rectangle2D.Float path = new Rectangle2D.Float();
- Dimension dimension = getDimensions(context);
- g2d.setStroke(new BasicStroke(16,BasicStroke.CAP_SQUARE,BasicStroke.JOIN_BEVEL));
- g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
-
- g2d.translate(40,40);
-
- path.setRect(0,0,40,40);
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
-
- g2d.setColor(col);
- Color bcolor = new Color(1f,1f,1f,0f);
- g2d.setBackground(bcolor);
- g2d.fill(path);
- g2d.clearRect(16,0,8,40);
- g2d.clearRect(0,16,40,8);
- }
-}
\ No newline at end of file
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconSpacer.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,33 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.Graphics2D;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-public class PanelMenuIconSpacer extends PanelMenuIconBasic {
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
-
- }
-}
\ No newline at end of file
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangle.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangle.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangle.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,51 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.GeneralPath;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-public class PanelMenuIconTriangle extends PanelMenuIconBasic {
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
- GeneralPath path = new GeneralPath();
-
- Dimension dimension = getDimensions(context);
- g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
- g2d.translate(47,30);
- path.moveTo(0,0);
- path.lineTo(33,33);
- path.lineTo(33,34);
- path.lineTo(0,67);
- path.closePath();
- g2d.setColor((Color)(((Object[]) restoreData(context))[1]));
- g2d.fill(path);
- }
-}
\ No newline at end of file
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleDown.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleDown.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleDown.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,57 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.GeneralPath;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-
-public class PanelMenuIconTriangleDown extends PanelMenuIconBasic {
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
- GeneralPath path = new GeneralPath();
-
- Dimension dimension = getDimensions(context);
-
- g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
- g2d.translate(31,54);
-
- path.moveTo(0,0);
- path.lineTo(33,33);
- path.lineTo(34,33);
- path.lineTo(67,0);
- path.closePath();
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
-
- g2d.setColor(col);
- g2d.fill(path);
- }
-}
Deleted:
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleUp.java
===================================================================
---
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleUp.java 2007-06-13
15:37:49 UTC (rev 1161)
+++
trunk/sandbox/panelmenu/src/main/java/org/richfaces/renderkit/iconImages/PanelMenuIconTriangleUp.java 2007-06-13
16:07:14 UTC (rev 1162)
@@ -1,56 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.renderkit.iconImages;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.GeneralPath;
-import org.ajax4jsf.framework.resource.ResourceContext;
-
-
-
-public class PanelMenuIconTriangleUp extends PanelMenuIconBasic {
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
- GeneralPath path = new GeneralPath();
-
- Dimension dimension = getDimensions(context);
-
- g2d.scale(dimension.getHeight()/128,dimension.getHeight()/128);
- g2d.translate(31,47);
- path.moveTo(0,33);
- path.lineTo(33,0);
- path.lineTo(34,0);
- path.lineTo(67,33);
- path.closePath();
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
-
- g2d.setColor(col);
- g2d.fill(path);
- }
-}