[richfaces-svn-commits] JBoss Rich Faces SVN: r2396 - in trunk/test-applications/jsp/src/main: webapp/Insert and 1 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Wed Aug 22 07:52:31 EDT 2007
Author: ayanul
Date: 2007-08-22 07:52:31 -0400 (Wed, 22 Aug 2007)
New Revision: 2396
Added:
trunk/test-applications/jsp/src/main/webapp/Insert/src/
trunk/test-applications/jsp/src/main/webapp/Insert/src/test.bsh
trunk/test-applications/jsp/src/main/webapp/Insert/src/test.cpp
trunk/test-applications/jsp/src/main/webapp/Insert/src/test.groovy
trunk/test-applications/jsp/src/main/webapp/Insert/src/test.html
trunk/test-applications/jsp/src/main/webapp/Insert/src/test.java
trunk/test-applications/jsp/src/main/webapp/Insert/src/test.lzx
trunk/test-applications/jsp/src/main/webapp/Insert/src/test.xml
Removed:
trunk/test-applications/jsp/src/main/webapp/Insert/test.html
Modified:
trunk/test-applications/jsp/src/main/java/insert/Insert.java
trunk/test-applications/jsp/src/main/webapp/Insert/Insert.jsp
Log:
update
Modified: trunk/test-applications/jsp/src/main/java/insert/Insert.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/insert/Insert.java 2007-08-22 11:52:21 UTC (rev 2395)
+++ trunk/test-applications/jsp/src/main/java/insert/Insert.java 2007-08-22 11:52:31 UTC (rev 2396)
@@ -2,19 +2,20 @@
public class Insert {
private String highlight;
- private String rendered;
+ private String src;
+ private boolean rendered;
public Insert() {
- //info = "no";
- highlight = "";
- rendered = "true";
+ src = "/Insert/src/test.html";
+ rendered = true;
+ highlight = "HTML";
}
- public String getRendered() {
+ public boolean isRendered() {
return rendered;
}
- public void setRendered(String rendered) {
+ public void setRendered(boolean rendered) {
this.rendered = rendered;
}
@@ -25,4 +26,13 @@
public void setHighlight(String highlight) {
this.highlight = highlight;
}
+
+ public String getSrc() {
+ return src;
+ }
+
+ public void setSrc(String src) {
+ this.src = src;
+ }
+
}
Modified: trunk/test-applications/jsp/src/main/webapp/Insert/Insert.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/Insert.jsp 2007-08-22 11:52:21 UTC (rev 2395)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/Insert.jsp 2007-08-22 11:52:31 UTC (rev 2396)
@@ -11,22 +11,44 @@
<body>
<h:form>
<h:messages />
- <h:outputText value="include test.html: " />
- <rich:spacer></rich:spacer>
- <rich:insert id="insertID" rendered="#{insert.rendered}"
- src="/Insert/test.html"></rich:insert>
-
- <f:verbatim>
- <br />
- </f:verbatim>
- <h:outputText value="Rendered:" />
- <h:selectBooleanCheckbox value="#{insert.rendered}" />
+ <rich:panel id="panelID" header="Highlight: #{insert.highlight}; File: #{insert.src}">
+ <rich:insert id="insertID" highlight="#{insert.highlight}"
+ rendered="#{insert.rendered}" src="#{insert.src}"></rich:insert>
+ </rich:panel>
- <f:verbatim>
- <br />
- </f:verbatim>
-
+ <h:panelGrid columns="2">
+ <h:outputText value="Highlight:" />
+ <h:selectOneMenu value="#{insert.highlight}">
+ <f:selectItem itemValue="HTML" itemLabel="HTML" />
+ <f:selectItem itemValue="GROOVY" itemLabel="GROOVY" />
+ <f:selectItem itemValue="JAVA" itemLabel="JAVA" />
+ <f:selectItem itemValue="BEANSHELL" itemLabel="BEANSHELL" />
+ <f:selectItem itemValue="BSH" itemLabel="BSH" />
+ <f:selectItem itemValue="XML" itemLabel="XML" />
+ <f:selectItem itemValue="XHTML" itemLabel="XHTML" />
+ <f:selectItem itemValue="LZX" itemLabel="LZX" />
+ <f:selectItem itemValue="CPP" itemLabel="CPP" />
+ <f:selectItem itemValue="CXX" itemLabel="CXX" />
+ <a4j:support event="onclick" reRender="panelID,insertID"></a4j:support>
+ </h:selectOneMenu>
+
+ <h:outputText value="Select file:" />
+ <h:selectOneMenu value="#{insert.src}">
+ <f:selectItem itemValue="/Insert/src/test.html" itemLabel="HTML" />
+ <f:selectItem itemValue="/Insert/src/test.java" itemLabel="JAVA" />
+ <f:selectItem itemValue="/Insert/src/test.groovy" itemLabel="GROOVY" />
+ <f:selectItem itemValue="/Insert/src/test.bsh" itemLabel="BEANSHELL,BSH" />
+ <f:selectItem itemValue="/Insert/src/test.xml" itemLabel="XML" />
+ <f:selectItem itemValue="/Insert/Insert.jsp" itemLabel="XHTML" />
+ <f:selectItem itemValue="/Insert/src/test.lzx" itemLabel="LZX" />
+ <f:selectItem itemValue="/Insert/src/test.cpp" itemLabel="CPP,CXX" />
+ <a4j:support event="onclick" action="submit();" reRender="panelID,insertID"></a4j:support>
+ </h:selectOneMenu>
+
+ <h:outputText value="Rendered" />
+ <h:selectBooleanCheckbox value="#{insert.rendered}" />
+ </h:panelGrid>
<h:commandLink value="Back" action="main"></h:commandLink>
</h:form>
</body>
Added: trunk/test-applications/jsp/src/main/webapp/Insert/src/test.bsh
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/src/test.bsh (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/src/test.bsh 2007-08-22 11:52:31 UTC (rev 2396)
@@ -0,0 +1,76 @@
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.text.*;
+import java.awt.event.*;
+import java.awt.*;
+
+JFrame browser( startingUrl ) {
+ invoke( method, args ) {}
+
+ windowClosing(WindowEvent we) {
+ we.getWindow().setVisible(false);
+ }
+
+ setPage( url ) {
+ try {
+ pane.setPage( url );
+ } catch(Exception e) {
+ statusBar.setText("Error opening page: "+url);
+ }
+ }
+
+ hyperlinkUpdate( HyperlinkEvent he ) {
+ type = he.getEventType();
+ if (type == HyperlinkEvent.EventType.ENTERED) {
+ pane.setCursor(
+ Cursor.getPredefinedCursor( Cursor.HAND_CURSOR) );
+ statusBar.setText(he.getURL().toString());
+ } else
+ if (type == HyperlinkEvent.EventType.EXITED) {
+ pane.setCursor( Cursor.getDefaultCursor() );
+ statusBar.setText(" ");
+ } else {
+ setPage( he.getURL() );
+ if (urlField != null)
+ urlField.setText(he.getURL().toString());
+ }
+ }
+
+ frame = new JFrame("Browser");
+ frame.setSize(400,300);
+ frame.addWindowListener( this );
+
+ urlPanel = new JPanel();
+ urlPanel.setLayout(new BorderLayout());
+ urlField = new JTextField(startingUrl);
+ urlPanel.add(new JLabel("Site: "), BorderLayout.WEST);
+ urlPanel.add(urlField, BorderLayout.CENTER);
+
+ statusBar = new JLabel(" ");
+ pane = new JEditorPane();
+ pane.setEditable(false);
+ setPage( startingUrl );
+ jsp = new JScrollPane(pane);
+
+ frame.getContentPane().add(jsp, BorderLayout.CENTER);
+ frame.getContentPane().add(urlPanel, BorderLayout.SOUTH);
+ frame.getContentPane().add(statusBar, BorderLayout.NORTH);
+
+ // This is the equivalent of an inner class in bsh.
+ urlTextHandler() {
+ actionPerformed(ActionEvent ae) {
+ setPage( ae.getActionCommand() );
+ }
+ return this;
+ }
+
+ urlField.addActionListener( urlTextHandler() );
+ pane.addHyperlinkListener( (HyperlinkListener)this );
+
+ return frame;
+}
+
+browser = browser("http://java.sun.com/");
+browser.show();
+
+
Added: trunk/test-applications/jsp/src/main/webapp/Insert/src/test.cpp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/src/test.cpp (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/src/test.cpp 2007-08-22 11:52:31 UTC (rev 2396)
@@ -0,0 +1,119 @@
+extern LArc RiflemanTBL[];
+class CRifleman : public LFsaAppl
+{
+public:
+ int GetNumber();
+ void SetNumber(int n);
+ void SetLink(CRifleman *pFsaLeft,
+ CRifleman
+*pFsaRigtht);
+ CRifleman *pFsaRightMan;
+ CRifleman *pFsaLeftMan;
+ CRifleman();
+ CRifleman(int n, CWnd* pW, LArc
+ *pTBL=RiflemanTBL);
+ virtual ~CRifleman();
+ bool operator==(const CRifleman
+ &var) const;
+ bool operator<(const CRifleman
+ &var) const;
+ bool operator!=(const CRifleman
+ &var) const;
+ bool operator>(const CRifleman
+ &var) const;
+protected:
+ CWnd* pParentWnd;
+ CFireApp *pApp; // óêàçàòåëü íà îáúåêò
+ // îñíîâíîãî êëàññà ïðîãðàììû
+ int x1(); // Is fire?
+ int x2(); // Is ready?
+ int x3(); // Number is equal to zero? Shot!
+ int x4(); //
+ void y1(); // To place number.
+ void y2(); // To reduce number by unit.
+ void y3(); // Gunshot
+ void y4(); //
+ void y5(); //
+ int nNumber;
+ int nSaveNumber;
+ int nLengthQueue; // Length of queue.
+ int nCurrentQueue; //
+};
+typedef vector<CRifleman*>
+TIArrayRifleman;
+typedef vector<CRifleman*>:
+:iterator TIIteratorRifleman;
+extern LArc RiflemanTBL[];
+CRifleman::CRifleman():LFsaAppl() { }
+CRifleman::CRifleman(int n, CWnd* pW,
+LArc* pTBL):
+LFsaAppl(pTBL)
+{
+ pParentWnd = pW;
+ pFsaRightMan = NULL;
+ pFsaLeftMan = NULL;
+ nNumber = n;
+ nLengthQueue = 5;
+ nCurrentQueue = nLengthQueue;
+ if (pParentWnd)
+ {
+ pApp = (CFireApp*)AfxGetApp();
+ FLoad(pApp->pNetFsa,1);
+ }
+}
+bool CRifleman::operator==(const CRifleman
+&var) const
+{
+ if (nNumber==var.nNumber) return true;
+ else return false;
+}
+void CRifleman::SetLink(CRifleman
+* pFsaLeft, CRifleman *
+pFsaRigtht)
+{
+ pFsaRightMan = pFsaRigtht;
+ pFsaLeftMan = pFsaLeft;
+}
+LArc RiflemanTBL[] = {
+ LArc("Ñîí", "Îãîíü", "x1", "y1"),
+ LArc("Îãîíü", "Ãîòîâ", "x2", "y2"),
+ LArc("Ãîòîâ", "Ãîòîâ", "x3", "y2"),
+ LArc("Ãîòîâ", "Âûñòðåë", "^x3", "y3y4"),
+ LArc("Âûñòðåë", "Âûñòðåë", "x4", "y3y5"),
+ LArc("Âûñòðåë", "Ñîí", "^x4", "-"),
+ LArc()
+ };
+int CRifleman::x1()
+{
+ if (!pFsaLeftMan) return false;
+ return string((pFsaLeftMan)-
+ >FGetState()) == "Îãîíü";
+}
+int CRifleman::x2()
+{
+ if (!pFsaRightMan) return true;
+ else return string((pFsaRightMan)-
+ >FGetState()) ==
+"Ãîòîâ";
+}
+int CRifleman::x3() { return nNumber; }
+int CRifleman::x4() { return nCurrentQueue; }
+void CRifleman::y1()
+{
+ int n = pFsaLeftMan->GetNumber();
+ SetNumber(n+1);
+}
+void CRifleman::y2() { nNumber-; }
+void CRifleman::y3() { }
+void CRifleman::y4()
+{
+ nCurrentQueue = nLengthQueue;
+}
+// ôîðìèðîâàíèå çàäåðæêè ìåæäó âûñòðåëàìè
+void CRifleman::y5()
+{
+ CFDelay *pCFDelay;
+ pCFDelay = new CFDelay(200);
+ pCFDelay->FCall(this);
+ nCurrentQueue-;
+}
Added: trunk/test-applications/jsp/src/main/webapp/Insert/src/test.groovy
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/src/test.groovy (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/src/test.groovy 2007-08-22 11:52:31 UTC (rev 2396)
@@ -0,0 +1,34 @@
+import groovy.swing.SwingBuilder
+import groovy.net.soap.SoapClient
+
+proxy = new SoapClient("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL")
+
+def currency = ['USD', 'EUR', 'CAD', 'GBP', 'AUD']
+def rate = 0.0
+
+swing = new SwingBuilder()
+
+refresh = swing.action(
+ name:'Refresh',
+ closure:this.&refreshText,
+ mnemonic:'R'
+)
+
+frame = swing.frame(title:'Currency Demo') {
+ panel {
+ label 'Currency rate from '
+ comboBox(id:'from', items:currency)
+ label ' to '
+ comboBox(id:'to', items:currency)
+ label ' is '
+ textField(id:'currency', columns:10, rate.toString())
+ button(text:'Go !', action:refresh)
+ }
+}
+frame.pack()
+frame.show()
+
+def refreshText(event) {
+ rate = proxy.ConversionRate(swing.from.getSelectedItem(), swing.to.getSelectedItem())
+ swing.currency.text = rate
+}
Added: trunk/test-applications/jsp/src/main/webapp/Insert/src/test.html
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/src/test.html (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/src/test.html 2007-08-22 11:52:31 UTC (rev 2396)
@@ -0,0 +1,18 @@
+<html>
+ <head>
+ </head>
+ <body>
+ html page
+ <br>
+ html page
+ <br>
+ html page
+ <br>
+ html page
+ <br>
+ html page
+ <br>
+ html page
+ <br>
+ </body>
+</html>
Added: trunk/test-applications/jsp/src/main/webapp/Insert/src/test.java
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/src/test.java (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/src/test.java 2007-08-22 11:52:31 UTC (rev 2396)
@@ -0,0 +1,291 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.renderkit.compiler.TemplateContext;
+import org.richfaces.skin.Skin;
+import org.ajax4jsf.util.style.CSSFormat;
+import org.richfaces.component.UIPanelMenu;
+import org.richfaces.component.UIPanelMenuGroup;
+import org.richfaces.component.UIPanelMenuItem;
+import org.richfaces.renderkit.html.PanelMenuGroupRenderer;
+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.renderkit.RendererUtils.HTML;
+
+/**
+ * @author hans
+ *
+ */
+public abstract class PanelMenuRendererBase extends HeaderResourcesRendererBase {
+
+ public final static String PANEL_MENU_SPACER_ICON_NAME = "spacer";
+
+ public void insertSpacerImages(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("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.endElement("img");
+ }
+ }
+
+ 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") || "".equals(iconType)){
+ 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 insertLabel(FacesContext context, UIComponent component) throws IOException {
+ Object value = component.getAttributes().get("label");
+ 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.getExpandMode() && ! "".equals(group.getExpandMode()))
+ mode = group.getExpandMode();
+ 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, String id) 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("width", String.valueOf(h), null);
+ writer.writeAttribute("height", String.valueOf(h), null);
+ writer.writeAttribute("id", id, null);
+ writer.endElement("img");
+ }
+
+ }
+
+}
Added: trunk/test-applications/jsp/src/main/webapp/Insert/src/test.lzx
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/src/test.lzx (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/src/test.lzx 2007-08-22 11:52:31 UTC (rev 2396)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <canvas debug="false" bgcolor='#D4D0C8'>
+
+ <dataset name='dset' request='true' type='http' src='/app/user/list?keyword='/>
+ <grid id="gd" datapath="dset:/rowset" contentdatapath="row" doesenter="true">
+ <gridcolumn width='100'>name<text datapath='@name'></text></gridcolumn>
+ <gridcolumn width='100'>email<text datapath='@email'></text> </gridcolumn>
+ </grid>
+ </canvas>
+
+
Added: trunk/test-applications/jsp/src/main/webapp/Insert/src/test.xml
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/src/test.xml (rev 0)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/src/test.xml 2007-08-22 11:52:31 UTC (rev 2396)
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//EXADEL//Generator config/EN" "http://exadel.com/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.PanelBar</name>
+ <family>org.richfaces.PanelBar</family>
+ <classname>org.richfaces.component.html.HtmlPanelBar</classname>
+ <superclass>org.richfaces.component.UIPanelBar</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlPanelBarComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+ <description>
+ <![CDATA[A component with categories sliding up and down to reveal and hide items under selected
+ categories (as used in Microsoft Outlook).
+ ]]>
+ </description>
+ <renderer generate="true" override="true">
+ <name>org.richfaces.PanelBarRenderer</name>
+ <template>panelBar.jspx</template>
+ </renderer>
+ <tag>
+ <name>panelBar</name>
+ <classname>org.richfaces.taglib.PanelBarTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ </tag>
+ <property>
+ <name>converterMessage</name>
+ <classname>java.lang.String</classname>
+ <description>
+ A ValueExpression enabled attribute that, if present, will be used as the text of the converter message, replacing any message that comes from the converter.
+ </description>
+ </property>
+ <property>
+ <name>requiredMessage</name>
+ <classname>java.lang.String</classname>
+ <description>
+ A ValueExpression enabled attribute that, if present, will be used as the text of the validation message for the "required" facility, if the "required" facility is used.
+ </description>
+ </property>
+ <property>
+ <name>validatorMessage</name>
+ <classname>java.lang.String</classname>
+ <description>
+ A ValueExpression enabled attribute that, if present, will be used as the text of the validator message, replacing any message that comes from the validator.
+ </description>
+ </property>
+ <property>
+ <name>width</name>
+ <classname>java.lang.String</classname>
+ <description>The width of the slide panel. Might be defined as pixels or as percentage.
+ The default width is 100%</description>
+ <defaultvalue><![CDATA["100%"]]></defaultvalue>
+ </property>
+
+ <property>
+ <name>height</name>
+ <classname>java.lang.String</classname>
+ <description>The height of the slide panel. Might be defined as pixels or as percentage.
+ The default height is 100%</description>
+ <defaultvalue><![CDATA["100%"]]></defaultvalue>
+ </property>
+ <property>
+ <name>style</name>
+ <classname>java.lang.String</classname>
+ <description>CSS style(s) is/are to be applied when this component is rendered</description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>styleClass</name>
+ <classname>java.lang.String</classname>
+ <description>Corresponds to the HTML class attribute.</description>
+ </property>
+ <property>
+ <name>headerStyleActive</name>
+ <classname>java.lang.String</classname>
+ <description>The component header style active</description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>headerClassActive</name>
+ <classname>java.lang.String</classname>
+ <description>The component header style class active</description>
+ </property>
+ <property>
+ <name>value</name>
+ <classname>java.lang.String</classname>
+ <description>Id of expanded panelBarItem</description>
+ </property>
+ <property >
+ <name>converter</name>
+ <classname>javax.faces.convert.Converter</classname>
+ <description>
+ Id of Converter to be used or reference to a Converter.
+ </description>
+ </property>
+ <property hidden="true">
+ <name>localValueSet</name>
+ <classname>boolean</classname>
+ </property>
+ <property hidden="true">
+ <name>switchType</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
+ <name>onclick</name>
+ <classname>java.lang.String</classname>
+ <description>JavaScript code for call before header onclick</description>
+ </property>
+ <property>
+ <name>selectedPanel</name>
+ <classname>java.lang.Object</classname>
+ <description>Attribure defines name of selected item</description>
+ </property>
+
+ &ui_component_attributes;
+ &header_component_attributes;
+ &content_component_attributes;
+ &ui_input_attributes;
+ <!--
+ <taghandler>
+ <classname>org.ajax4jsf.tag.TestHandler</classname>
+ </taghandler>
+ -->
+
+ <property hidden="true">
+ <name>valid</name>
+ <classname>java.lang.String</classname>
+ </property>
+ </component>
+
+ <component>
+ <name>org.richfaces.PanelBarItem</name>
+ <family>org.richfaces.PanelBarItem</family>
+ <description>Slider Panel Item</description>
+ <classname>org.richfaces.component.html.HtmlPanelBarItem</classname>
+ <superclass>org.richfaces.component.UIPanelBarItem</superclass>
+ <test>
+ <classname>org.richfaces.component.html.HtmlPanelBarItemComponentTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+ <renderer generate="true" override="true">
+ <name>org.richfaces.PanelBarItemRenderer</name>
+ <template>panelBarItem.jspx</template>
+ </renderer>
+ <tag>
+ <name>panelBarItem</name>
+ <classname>org.richfaces.taglib.PanelBarItemTag</classname>
+ <superclass>org.ajax4jsf.webapp.taglib.HtmlComponentTagBase</superclass>
+ <description>A child component of a slide panel component</description>
+ </tag>
+
+ <property>
+ <name>label</name>
+ <classname>java.lang.String</classname>
+ <description>Label text appears on a panel item header</description>
+ <defaultvalue><![CDATA["auto generated label"]]></defaultvalue>
+ </property>
+ <property>
+ <name>headerStyleActive</name>
+ <classname>java.lang.String</classname>
+ <description>The component header style active</description>
+ <defaultvalue><![CDATA[""]]></defaultvalue>
+ </property>
+ <property>
+ <name>headerClassActive</name>
+ <classname>java.lang.String</classname>
+ <description>The component header style class active</description>
+ </property>
+ <property>
+ <name>name</name>
+ <classname>java.lang.Object</classname>
+ <description>Attribute defines item name</description>
+ <defaultvalue>getId()</defaultvalue>
+ </property>
+
+ &ui_component_attributes;
+ &header_component_attributes;
+ &content_component_attributes;
+ <property hidden="true">
+ <name>expanded</name>
+ <classname>java.lang.String</classname>
+ <description>
+ Notifies that an element has to be expanded
+ </description>
+ <defaultvalue><![CDATA["false"]]></defaultvalue>
+ </property>
+ </component>
+
+</components>
Deleted: trunk/test-applications/jsp/src/main/webapp/Insert/test.html
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/Insert/test.html 2007-08-22 11:52:21 UTC (rev 2395)
+++ trunk/test-applications/jsp/src/main/webapp/Insert/test.html 2007-08-22 11:52:31 UTC (rev 2396)
@@ -1,18 +0,0 @@
-<html>
- <head>
- </head>
- <body>
- html page
- <br>
- html page
- <br>
- html page
- <br>
- html page
- <br>
- html page
- <br>
- html page
- <br>
- </body>
-</html>
More information about the richfaces-svn-commits
mailing list