JBoss Rich Faces SVN: r2397 - trunk/ui/message/src/test/java/org/richfaces/renderer.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-08-22 09:33:17 -0400 (Wed, 22 Aug 2007)
New Revision: 2397
Modified:
trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessageRendererTest.java
trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessagesRendererTest.java
Log:
fix url check
Modified: trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessageRendererTest.java
===================================================================
--- trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessageRendererTest.java 2007-08-22 11:52:31 UTC (rev 2396)
+++ trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessageRendererTest.java 2007-08-22 13:33:17 UTC (rev 2397)
@@ -66,7 +66,7 @@
List links = page.getDocumentElement().getHtmlElementsByTagName("link");
assertNotNull(links);
HtmlElement link = (HtmlElement)links.get(0);
- assertTrue(link.getAttributeValue("href").contains("/org/richfaces/renderkit/html/css/msg.css"));
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/msg.css"));
}
public void testRendererMessage() throws Exception{
Modified: trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessagesRendererTest.java
===================================================================
--- trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessagesRendererTest.java 2007-08-22 11:52:31 UTC (rev 2396)
+++ trunk/ui/message/src/test/java/org/richfaces/renderer/RichMessagesRendererTest.java 2007-08-22 13:33:17 UTC (rev 2397)
@@ -46,7 +46,7 @@
List links = page.getDocumentElement().getHtmlElementsByTagName("link");
assertNotNull(links);
HtmlElement link = (HtmlElement)links.get(0);
- assertTrue(link.getAttributeValue("href").contains("/org/richfaces/renderkit/html/css/msgs.css"));
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/msgs.css"));
}
public void tearDown() throws Exception {
18 years, 8 months
JBoss Rich Faces SVN: r2396 - in trunk/test-applications/jsp/src/main: webapp/Insert and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
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>
18 years, 8 months
JBoss Rich Faces SVN: r2395 - in trunk/test-applications/facelets/src/main: webapp/Insert and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2007-08-22 07:52:21 -0400 (Wed, 22 Aug 2007)
New Revision: 2395
Added:
trunk/test-applications/facelets/src/main/webapp/Insert/src/
trunk/test-applications/facelets/src/main/webapp/Insert/src/test.bsh
trunk/test-applications/facelets/src/main/webapp/Insert/src/test.cpp
trunk/test-applications/facelets/src/main/webapp/Insert/src/test.groovy
trunk/test-applications/facelets/src/main/webapp/Insert/src/test.html
trunk/test-applications/facelets/src/main/webapp/Insert/src/test.java
trunk/test-applications/facelets/src/main/webapp/Insert/src/test.lzx
trunk/test-applications/facelets/src/main/webapp/Insert/src/test.xml
Removed:
trunk/test-applications/facelets/src/main/webapp/Insert/test.html
Modified:
trunk/test-applications/facelets/src/main/java/insert/Insert.java
trunk/test-applications/facelets/src/main/webapp/Insert/Insert.xhtml
Log:
update
Modified: trunk/test-applications/facelets/src/main/java/insert/Insert.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/insert/Insert.java 2007-08-22 11:49:57 UTC (rev 2394)
+++ trunk/test-applications/facelets/src/main/java/insert/Insert.java 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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/facelets/src/main/webapp/Insert/Insert.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/Insert.xhtml 2007-08-22 11:49:57 UTC (rev 2394)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/Insert.xhtml 2007-08-22 11:52:21 UTC (rev 2395)
@@ -10,22 +10,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}" />
-
- <f:verbatim>
- <br />
- </f:verbatim>
-
+
+ <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>
+
+ <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.xhtml" 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/facelets/src/main/webapp/Insert/src/test.bsh
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/src/test.bsh (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/src/test.bsh 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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/facelets/src/main/webapp/Insert/src/test.cpp
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/src/test.cpp (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/src/test.cpp 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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/facelets/src/main/webapp/Insert/src/test.groovy
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/src/test.groovy (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/src/test.groovy 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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/facelets/src/main/webapp/Insert/src/test.html
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/src/test.html (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/src/test.html 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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/facelets/src/main/webapp/Insert/src/test.java
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/src/test.java (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/src/test.java 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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/facelets/src/main/webapp/Insert/src/test.lzx
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/src/test.lzx (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/src/test.lzx 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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/facelets/src/main/webapp/Insert/src/test.xml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/src/test.xml (rev 0)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/src/test.xml 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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/facelets/src/main/webapp/Insert/test.html
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/Insert/test.html 2007-08-22 11:49:57 UTC (rev 2394)
+++ trunk/test-applications/facelets/src/main/webapp/Insert/test.html 2007-08-22 11:52:21 UTC (rev 2395)
@@ -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>
18 years, 8 months
JBoss Rich Faces SVN: r2394 - in trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable: examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-08-22 07:49:57 -0400 (Wed, 22 Aug 2007)
New Revision: 2394
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml
Log:
added scrollableTableDemo
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/scrollableDataTable/examples/scrollableDataTable.xhtml 2007-08-22 11:49:57 UTC (rev 2394)
@@ -0,0 +1,58 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <style>
+ </style>
+
+ <h:form>
+ <rich:spacer height="30" />
+ <rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1" height="400px" width="700px" id="carList" rows="40" columnClasses="col"
+ value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single">
+
+ <rich:column id="make">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Make" />
+ </f:facet>
+ <h:outputText value="#{category.make}" />
+ </rich:column>
+ <rich:column id="model">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Model" />
+ </f:facet>
+ <h:outputText value="#{category.model}" />
+ </rich:column>
+ <rich:column id="price">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Price" />
+ </f:facet>
+ <h:outputText value="#{category.price}" />
+ </rich:column>
+ <rich:column id="mileage">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Mileage" />
+ </f:facet>
+ <h:outputText value="#{category.mileage}" />
+ </rich:column>
+ <rich:column width="200px" id="vin">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="VIN" />
+ </f:facet>
+ <h:outputText value="#{category.vin}" />
+ </rich:column>
+ <rich:column id="stock">
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Stock" />
+ </f:facet>
+ <h:outputText value="#{category.stock}" />
+ </rich:column>
+
+
+
+ </rich:scrollableDataTable>
+ </h:form>
+
+</ui:composition>
\ No newline at end of file
18 years, 8 months
JBoss Rich Faces SVN: r2393 - in trunk/framework/impl/src/main: resources/org/ajax4jsf/javascript/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2007-08-22 04:18:20 -0400 (Wed, 22 Aug 2007)
New Revision: 2393
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/imagecache.js
trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js
Log:
RF-636
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/imagecache.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/imagecache.js 2007-08-22 00:57:49 UTC (rev 2392)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/imagecache.js 2007-08-22 08:18:20 UTC (rev 2393)
@@ -1,4 +1,4 @@
-if (!Richfaces) var Richfaces = {};
+if (!window.Richfaces) var RichFaces = {};
Richfaces.setImages =
function (element, images) {
Modified: trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js 2007-08-22 00:57:49 UTC (rev 2392)
+++ trunk/framework/impl/src/main/resources/org/ajax4jsf/javascript/scripts/form.js 2007-08-22 08:18:20 UTC (rev 2393)
@@ -97,5 +97,4 @@
A4J._formInput = null;
}
}
-}
-//
\ No newline at end of file
+}
\ No newline at end of file
18 years, 8 months
JBoss Rich Faces SVN: r2392 - trunk/samples/richfaces-demo/src/main/resources.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-08-21 20:57:49 -0400 (Tue, 21 Aug 2007)
New Revision: 2392
Modified:
trunk/samples/richfaces-demo/src/main/resources/
Log:
Property changes on: trunk/samples/richfaces-demo/src/main/resources
___________________________________________________________________
Name: svn:ignore
+ logging.properties
18 years, 8 months
JBoss Rich Faces SVN: r2391 - in trunk/samples/richfaces-demo/src/main/webapp/richfaces: effect and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-08-21 20:53:20 -0400 (Tue, 21 Aug 2007)
New Revision: 2391
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/attributes.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/diffTypes.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/snippets/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/snippets/usecases.html
Removed:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/edvToogl.xhtml
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/usage.xhtml
Log:
demo updates. effects
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/attributes.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/attributes.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/attributes.xhtml 2007-08-22 00:53:20 UTC (rev 2391)
@@ -0,0 +1,49 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+
+
+ <p>
+ <b>name</b> attribute defines the name of the javascript function will be generated
+ on the page when the component is rendered. You can invoke this function to activate
+ the effect. The function access one parameter. It is a set of effect options in JSON
+ format.
+ </p>
+ <p>
+ <b>type</b> attribute defines the type of effect. For example, "Fade", "Blind",
+ "Opacity". Take a look at scriptaculous documentation for set of available effect.
+ </p>
+
+ <p>
+ <b>for</b> attribute defines the id of the component or html tag, the effect will
+ be attached to. Richfaces converts the 'for' attribute value to the client id
+ of the component if such component is found. If not, the value is left as is for
+ possible wiring with on the DOM element's id on the client side.<br/>
+ By default, the target of the effect is the same element that effect pointed to.
+ However, the target element is might be overridden with 'effectId' option passed
+ with 'params' attribute of with function paramenter.
+ </p>
+ <p>
+ <b>params</b> attribute allows to define the set of options possible for
+ particurar effect. For example, 'duration', 'delay', 'from', 'to'. Additionally to
+ the options used by the effect itself, there are two option that might override the
+ rich:effect attribute. Those are:
+ <ul>
+ <li><b>targetId</b> allows to re-define the target of effect. The option
+ is overrire the value of 'for' attribute</li>
+ <li><b>type</b> defines the effect type. The option
+ is overrire the value of 'type' attribute</li>
+ </ul>
+ </p>
+
+
+ </ui:define>
+
+ </ui:composition>
+</html>
Copied: trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/diffTypes.xhtml (from rev 2378, trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/edvToogl.xhtml)
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/diffTypes.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/diffTypes.xhtml 2007-08-22 00:53:20 UTC (rev 2391)
@@ -0,0 +1,90 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+<style type="text/css">
+ .box {
+ background-color: #FFF;
+ height:100px;
+ width: 200px;
+ text-align:center;
+ }
+ .cell {
+ height:120px;
+ width: 220px;
+ vertical-align:top;
+
+ }
+
+</style>
+
+<h:panelGrid columns="3" columnClasses="cell">
+
+ <rich:panel id="fadebox" styleClass="box">
+ <f:facet name="header">Fade Effect</f:facet>
+ <rich:effect event="onclick" type="Fade" />
+ <rich:effect event="onclick" for="fadebox" type="Appear" params="delay:3.0,duration:0.5" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+ <rich:panel id="bdbox" styleClass="box">
+ <f:facet name="header">BlindDown Effect</f:facet>
+ <rich:effect event="onclick" type="BlindDown" params="duration:0.8" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+ <rich:panel id="bubox" styleClass="box">
+ <f:facet name="header">BlindUp Effect</f:facet>
+ <rich:effect event="onclick" type="BlindUp" params="duration:0.8" />
+ <rich:effect event="onclick" for="bubox" type="Appear" params="delay:3.0,duration:0.5" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+ <rich:panel id="opacitybox" styleClass="box">
+ <f:facet name="header">Opacity Effect</f:facet>
+ <rich:effect event="onclick" type="Opacity" params="duration:0.8, from:1.0, to:0.1" />
+ <rich:effect event="onclick" for="opacitybox" type="Appear" params="delay:3.0,duration:0.5" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+ <rich:panel id="switchbox" styleClass="box">
+ <f:facet name="header">SwitchOff Effect</f:facet>
+ <rich:effect event="onclick" type="SwitchOff" params="duration:0.8" />
+ <rich:effect event="onclick" for="switchbox" type="Appear" params="delay:3.0,duration:0.5" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+ <rich:panel id="dobox" styleClass="box">
+ <f:facet name="header">DropOut Effect</f:facet>
+ <rich:effect event="onclick" type="DropOut" params="duration:0.8" />
+ <rich:effect event="onclick" for="dobox" type="Appear" params="delay:3.0,duration:0.5" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+ <rich:panel id="highlightbox" styleClass="box">
+ <f:facet name="header">Highlight Effect</f:facet>
+ <rich:effect event="onclick" type="Highlight" params="duration:0.8" />
+ <rich:effect event="onclick" for="highlightbox" type="Appear" params="delay:3.0,duration:0.5" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+ <rich:panel id="foldbox" styleClass="box">
+ <f:facet name="header">Fold Effect</f:facet>
+ <rich:effect event="onclick" type="Fold" params="duration:0.8" />
+ <rich:effect event="onclick" for="foldbox" type="Appear" params="delay:3.0,duration:0.5" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+ <rich:panel id="squishbox" styleClass="box">
+ <f:facet name="header">Squish Effect</f:facet>
+ <rich:effect event="onclick" type="Squish" params="duration:0.8" />
+ <rich:effect event="onclick" for="squishbox" type="Appear" params="delay:3.0,duration:0.5" />
+ <h:outputText value="Click to Activate" />
+ </rich:panel>
+
+</h:panelGrid>
+
+</ui:composition>
\ No newline at end of file
Deleted: trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/edvToogl.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/edvToogl.xhtml 2007-08-22 00:22:56 UTC (rev 2390)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/examples/edvToogl.xhtml 2007-08-22 00:53:20 UTC (rev 2391)
@@ -1,28 +0,0 @@
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich">
-
-<script>
- function fin(obj){
- alert(obj);
- /*
- for(var i in obj.effects){
- alert(obj.effects[i]['element'].id);
- }
- */
- }
-</script>
-
-<div id="dv2" style="width:200px;height:10px;background-color:lightgreen"></div>
-
-<div id="dv" style="width:200px;height:200px;background-color:lightblue"></div>
-
-<rich:effect event="onclick" for="dv" type="Opacity" params="from:1.0,to:.1,afterFinish:fin" />
-<rich:effect event="onclick" for="dv2" type="Opacity" params="targetId:'dv',from:0.3,to:1.0" />
-
-
-
-</ui:composition>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/snippets/usecases.html
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/snippets/usecases.html (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/snippets/usecases.html 2007-08-22 00:53:20 UTC (rev 2391)
@@ -0,0 +1,21 @@
+<!-- attaching by event -->
+<rich:panel>
+ <rich:effect event="onmouseout" type="Opacity" params="duration:0.8,from:1.0,to:0.3" />
+ .... panel content ....
+</rich:panel>
+...
+
+<!-- invoking from javascript -->
+<div id="contentDiv">
+ ..... div content ......
+</div>
+
+<input type="button" onclick="hideDiv({duration:0.7})" value="Hide" />
+<input type="button" onclick="showDiv()" value="Show" />
+
+<rich:effect name="hideDiv" for="contentDiv" type="Fade" />
+<rich:effect name="showDiv" for="contentDiv" type="Appear" />
+
+<!-- attaching to window on load and applying on particular page element -->
+<rich:effect for="window" event="onload"
+ type="Appear" params="id:'contentDiv',duration:0.8,from:0.3,to:1.0" />
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/usage.xhtml 2007-08-22 00:22:56 UTC (rev 2390)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/usage.xhtml 2007-08-22 00:53:20 UTC (rev 2391)
@@ -8,15 +8,17 @@
<ui:composition template="/templates/component-sample.xhtml">
<ui:define name="sample">
- <ui:include src="/richfaces/effect/examples/edvToogl.xhtml" />
- <ui:include src="/templates/include/sourceview.xhtml">
- <ui:param name="sourcepath" value="/richfaces/effect/examples/edvToogl.xhtml"/>
- </ui:include>
-
<p>rich:effect utilizes the set of effects provided by scriptaculous javascript library. It
allows to attach effects to JSF components and html tags. For the reference of the available
- effects and thier parameters see the scriptaculous documentation and wiki.
+ effects and thier parameters see the scriptaculous documentation and wiki. Those are
+ some of many possible effects available out-of-the-box:
</p>
+ <div class="sample-container">
+ <ui:include src="/richfaces/effect/examples/diffTypes.xhtml" />
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/effect/examples/diffTypes.xhtml"/>
+ </ui:include>
+ </div>
<p>
It is possible to use rich:effect in two modes:
<ul>
@@ -27,93 +29,14 @@
function with defined name. When the function is called, the effect is applied</li>
</ul>
Those a the typical variants of using:
-<pre>
-<!-- attaching by event -->
-<rich:panel>
- <rich:effect event="onmouseout" type="Opacity" params="duration:0.8,from:1.0,to:0.3" />
- .... panel content ....
-</rich:panel>
-...
-
-<!-- invoking from javascript -->
-<div id="contentDiv">
- ..... div content ......
-</div>
-
-<input type="button" onclick="hideDiv({duration:0.7})" value="Hide" />
-<input type="button" onclick="showDiv()" value="Show" />
-
-<rich:effect name="hideDiv" for="contentDiv" type="Fade" />
-<rich:effect name="showDiv" for="contentDiv" type="Appear" />
-
-<!-- attaching to window on load and applying on particular page element -->
-<rich:effect for="window" event="onload"
- type="Appear" params="id:'contentDiv',duration:0.8,from:0.3,to:1.0" />
-</pre>
-
</p>
-
- <div class="sample-container" >
-
- <rich:separator height="1" style="padding-bottom:10px" />
-
-
- <div id="mypaneldiv" style="padding:6px;background-color:lightblue;width:300px" >
- <rich:effect for="mypaneldiv" event="onmouseout" type="Opacity" params="from:1.0,to:0.3" />
- <rich:effect for="mypaneldiv" event="onmouseover" type="Opacity" params="from:0.3,to:1.0" />
-
- The opacity of this panel will be set to 0.3 when the mouse cursor is out set
- to 1.0 if the mouse is over. The default opacity is set to 0.3 when the page
- is loaded.
-
- </div>
- <rich:effect for="window" event="load" type="Opacity" params="targetId:'mypaneldiv',from:1.0,to:0.3" />
+ <div class="sample-container">
+ <rich:insert src="/richfaces/effect/snippets/usecases.html" highlight="xhtml" />
+ </div>
+
- <rich:separator height="1" style="padding-top:10px" />
-
-
-
- </div>
- <h2>Key Attributes</h2>
- <p>
- <b>name</b> attribute defines the name of the javascript function will be generated
- on the page when the component is rendered. You can invoke this function to activate
- the effect. The function access one parameter. It is a set of effect options in JSON
- format.
- </p>
- <p>
- <b>type</b> attribute defines the type of effect. For example, "Fade", "Blind",
- "Opacity". Take a look at scriptaculous documentation for set of available effect.
- </p>
-
- <p>
- <b>for</b> attribute defines the id of the component or html tag, the effect will
- be attached to. Richfaces converts the 'for' attribute value to the client id
- of the component if such component is found. If not, the value is left as is for
- possible wiring with on the DOM element's id on the client side.<br/>
- By default, the target of the effect is the same element that effect pointed to.
- However, the target element is might be overridden with 'effectId' option passed
- with 'params' attribute of with function paramenter.
- </p>
- <p>
- <b>params</b> attribute allows to define the set of options possible for
- particurar effect. For example, 'duration', 'delay', 'from', 'to'. Additionally to
- the options used by the effect itself, there are two option that might override the
- rich:effect attribute. Those are:
- <ul>
- <li><b>effectId</b> allows to re-define the target of effect. The option
- is overrire the value of 'for' attribute</li>
- <li><b>effectType</b> defines the effect type. The option
- is overrire the value of 'type' attribute</li>
- </ul>
- </p>
-
-
</ui:define>
- <ui:define name="sources">
- Here is a fragment of page sources for the given example:
- <iframe src="${facesContext.externalContext.requestContextPath}/richfaces/form/source/usage.html" class="source_frame"/>
- </ui:define>
+
</ui:composition>
</html>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect.xhtml 2007-08-22 00:22:56 UTC (rev 2390)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect.xhtml 2007-08-22 00:53:20 UTC (rev 2391)
@@ -11,6 +11,9 @@
<rich:tab label="Usage">
<ui:include src="/richfaces/effect/usage.xhtml"/>
</rich:tab>
+ <rich:tab label="Key Attributes">
+ <ui:include src="/richfaces/effect/attributes.xhtml"/>
+ </rich:tab>
</rich:tabPanel>
</ui:define>
</ui:composition>
18 years, 8 months
JBoss Rich Faces SVN: r2390 - in trunk/framework/impl/src/main: resources/org/ajax4jsf and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-08-21 20:22:56 -0400 (Tue, 21 Aug 2007)
New Revision: 2390
Modified:
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
trunk/framework/impl/src/main/resources/org/ajax4jsf/messages.properties
Log:
Check response status, for a network communication problems.
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-08-21 23:38:32 UTC (rev 2389)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-08-22 00:22:56 UTC (rev 2390)
@@ -54,7 +54,14 @@
if(_this._timeoutID){
window.clearTimeout(_this._timeoutID);
}
- if(_this._request.status == 200){
+ var requestStatus;
+ try{
+ requestStatus = _this._request.status;
+ } catch(e){
+ LOG.error("request don't have status code - network problem");
+ requestStatus = 501;
+ }
+ if(requestStatus == 200){
try {
LOG.debug("Response with content-type: "+ _this.getResponseHeader('Content-Type'));
LOG.debug("Full response content: ", _this.getResponseText());
@@ -72,10 +79,10 @@
_this.onready(_this);
}
} else {
- _this._errorMessage = "Reqest error, status : "+_this._request.status +" " + _this._request.statusText + "\n Message: " + _this.getResponseHeader("Ajax-Error-Message");
+ _this._errorMessage = "Reqest error, status : "+requestStatus +" " + _this._request.statusText + "\n Message: " + _this.getResponseHeader("Ajax-Error-Message");
LOG.error(_this._errorMessage);
if(typeof(_this._onerror) == "function"){
- _this._onerror(_this,_this._request.status,_this._errorMessage);
+ _this._onerror(_this,requestStatus,_this._errorMessage);
}
}
if(_this.onfinish){
Modified: trunk/framework/impl/src/main/resources/org/ajax4jsf/messages.properties
===================================================================
--- trunk/framework/impl/src/main/resources/org/ajax4jsf/messages.properties 2007-08-21 23:38:32 UTC (rev 2389)
+++ trunk/framework/impl/src/main/resources/org/ajax4jsf/messages.properties 2007-08-22 00:22:56 UTC (rev 2390)
@@ -230,7 +230,7 @@
AJAX_SUPPORT_REQUEST_PARAMETER_INFO=Have request parameter for AjaxSupport component {0}
COMMAND_LINK_SUBMIT_INFO=CommandLink component {0} submit request
COMMAND_LINK_NOT_IN_FORM_WARNING=CommandLink {0} not enclosed in form
-MUST_BE_EXPRESSION_ERROR=Must be expression to modifyable property
+MUST_BE_EXPRESSION_ERROR=Must be expression to modifiable property
NOT_PARENT_AJAX_CONTAINER_ERROR=Parent is not of type AjaxContainer, type is\: {0}
NOT_PARENT_AJAX_COMPONENT_ERROR=Parent component {0} for a ajaxListener is not source of AjaxEvent's
MUST_BE_LITERAL_ERROR=Must be literal
@@ -250,4 +250,5 @@
AJAX_VIEW_EXPIRED=View state could't be restored - reload page ?
SKIN_CYCLIC_REFERENCE=Cyclic reference in Skin configuration for property \: {0}
SKIN_ILLEGAL_REFERENCE=Reference for property "{0}" not present in Skin configuration
-NULL_ATTRIBUTE_ERROR="Requied attribute {0} for component {1} is null
\ No newline at end of file
+NULL_ATTRIBUTE_ERROR=Requied attribute {0} for component {1} is null
+UI_INSERT_RESOURCE_NOT_FOUND="Resource {1} not found, component {0}
\ No newline at end of file
18 years, 8 months
JBoss Rich Faces SVN: r2389 - in trunk: framework/impl/src/main/java/org/ajax4jsf/util and 22 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-08-21 19:38:32 -0400 (Tue, 21 Aug 2007)
New Revision: 2389
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java
trunk/framework/impl/src/test/java/org/ajax4jsf/util/
trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java
Removed:
trunk/framework/impl/src/main/javascript/dnd/dnd-draggable.js
trunk/framework/impl/src/main/javascript/dnd/dnd-dropzone.js
Modified:
trunk/framework/impl/generatescript.xml
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-common.js
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/json/json-mini.js
trunk/samples/pom.xml
trunk/samples/tree-demo/src/main/webapp/pages/index.jsp
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarIcon.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js
trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-dropzone.js
trunk/ui/inputnumber-spinner/src/main/java/org/richfaces/renderkit/html/images/buttons/SpinnerButtonImage.java
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/images/MenuNodeImage.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconBasic.java
trunk/ui/separator/src/main/java/org/richfaces/renderkit/html/images/BevelSeparatorImage.java
trunk/ui/separator/src/main/java/org/richfaces/renderkit/html/images/SimpleSeparatorImage.java
trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/images/ToolBarSeparatorImage.java
trunk/ui/tree/src/main/config/component/treeNode.xml
trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java
trunk/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item-dnd.js
trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
Log:
- Java2Dresource instances switched to Zipper2
- Legacy DnD scripts removed
- http://jira.jboss.com/jira/browse/RF-642:
- Evaluation to functions for on* properties of DnD options added
- EventHandlersWalk function added to json-mini.js
- tree-demo: ondrop handler added
- unit test for DnD event getters added
- getDraggableOptions & getDropzoneOptions methods added
- effect-sample added to pom.xml
Modified: trunk/framework/impl/generatescript.xml
===================================================================
--- trunk/framework/impl/generatescript.xml 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/framework/impl/generatescript.xml 2007-08-21 23:38:32 UTC (rev 2389)
@@ -55,7 +55,7 @@
<filelist id="dnd"
dir="${basedir}/src/main/javascript/dnd"
- files="prolog.js,dnd.js,dnd-draggable.js,dnd-dropzone.js,epilog.js"
+ files="prolog.js,dnd.js,epilog.js"
>
</filelist>
Added: trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -0,0 +1,104 @@
+/**
+ * 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.ajax4jsf.util;
+
+import java.awt.Color;
+import java.nio.ByteBuffer;
+
+/**
+ *
+ * <br /><br />
+ *
+ * Created 21.08.2007
+ * @author Nick Belaevski
+ * @since 3.1
+ */
+
+public class Zipper2 {
+ private byte[] buffer;
+
+ int offset = 0;
+
+ public Zipper2(byte[] buffer) {
+ super();
+ this.buffer = buffer;
+ }
+
+ public Zipper2 addByte(byte b) {
+ buffer[offset++] = b;
+ return this;
+ }
+
+ public Zipper2 addShort(short s) {
+ ByteBuffer.wrap(buffer, offset, 2).asShortBuffer().put(s);
+ offset += 2;
+ return this;
+ }
+
+ public Zipper2 addColor(Color color) {
+ addColor(color.getRGB());
+ return this;
+ }
+
+ public Zipper2 addColor(int i) {
+ buffer[offset] = (byte) ((i >> 0) & 0xFF);
+ buffer[offset + 1] = (byte) ((i >> 8) & 0xFF);
+ buffer[offset + 2] = (byte) ((i >> 16) & 0xFF);
+ offset += 3;
+ return this;
+ }
+
+ public Zipper2 addInt(int i) {
+ ByteBuffer.wrap(buffer, offset, 4).asIntBuffer().put(i);
+ offset += 4;
+ return this;
+ }
+
+ public byte nextByte() {
+ return buffer[offset++];
+ }
+
+ public short nextShort() {
+ short s = ByteBuffer.wrap(buffer, offset, 2).asShortBuffer().get();
+ offset += 2;
+ return s;
+ }
+
+ public Color nextColor() {
+ return new Color(nextIntColor());
+ }
+
+ public int nextIntColor() {
+ int r0 = buffer[offset]&0x0ff;
+ int r1 = (buffer[offset+1]<<8)&0x0ff00;
+ int r2 = (buffer[offset+2]<<16)&0x0ff0000;
+ int ret = r0 | r1 | r2;
+ offset += 3;
+ return ret;
+ }
+
+ public int nextInt() {
+ int i = ByteBuffer.wrap(buffer, offset, 4).asIntBuffer().get();
+ offset += 4;
+ return i;
+ }
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -29,7 +29,6 @@
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
import java.util.Date;
-import java.util.StringTokenizer;
import javax.faces.context.FacesContext;
@@ -38,7 +37,7 @@
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
-import org.ajax4jsf.util.Zipper;
+import org.ajax4jsf.util.Zipper2;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -183,8 +182,9 @@
}
public Data(byte[] data) {
- headerBackgroundColor = new Integer(Zipper.unzip(data,0));
- headerGradientColor = new Integer(Zipper.unzip(data,3));
+ Zipper2 zipper2 = new Zipper2(data);
+ headerBackgroundColor = new Integer(zipper2.nextIntColor());
+ headerGradientColor = new Integer(zipper2.nextIntColor());
}
protected Data(FacesContext context) {
@@ -230,8 +230,7 @@
protected Integer headerGradientColor;
public byte[] toByteArray() {
byte[] ret = new byte[6];
- Zipper.zip(ret,headerBackgroundColor.intValue(),0);
- Zipper.zip(ret,headerGradientColor.intValue(),3);
+ new Zipper2(ret).addColor(headerBackgroundColor.intValue()).addColor(headerGradientColor.intValue());
return ret;
}
}
Deleted: trunk/framework/impl/src/main/javascript/dnd/dnd-draggable.js
===================================================================
--- trunk/framework/impl/src/main/javascript/dnd/dnd-draggable.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/framework/impl/src/main/javascript/dnd/dnd-draggable.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -1,55 +0,0 @@
-/**
- * @author Maksim Kaszynski
- * base class for draggable component.
- */
-DnD.Draggable = function() {};
-DnD.Draggable.prototype = {
-
- /**
- * @return type of draggable content
- */
- getContentType: function() {
- return "ZZZZZ";
- },
- /**
- * implementations are responsible for getting drag indicator
- * @return DnD.Indicator
- */
- getIndicator: function() {
- return null;
- },
-
- startDrag : function(event) {
- var type = this.getContentType();
- var indicator = this.getIndicator();
- var drag = new DnD.Drag(this, indicator, type);
- DnD.startDrag(drag);
- DnD.updateDrag(event);
- this.ondragstart(event, drag);
- if (indicator) {
- indicator.show();
- }
- },
- /**
- *
- * @param {DnD.Drag} drag
- */
- endDrag: function(event, drag) {
- var indicator = drag.indicator;
- if (indicator) {
- indicator.hide();
- }
- this.ondragend(event, drag);
- },
- /**
- * cubclasses may define custom behavior
- * @param {Object} drag
- */
- ondragstart: function(event, drag) {
-
- },
-
- ondragend: function (event, drag) {
-
- }
-};
\ No newline at end of file
Deleted: trunk/framework/impl/src/main/javascript/dnd/dnd-dropzone.js
===================================================================
--- trunk/framework/impl/src/main/javascript/dnd/dnd-dropzone.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/framework/impl/src/main/javascript/dnd/dnd-dropzone.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -1,82 +0,0 @@
-/**
- * @author Maksim Kaszynski
- * @classDescription
- * Base class for drop zones
- */
-DnD.Dropzone = function(){};
-DnD.Dropzone.DROP_TARGET_ID = "dropTargetId";
-DnD.Dropzone.prototype = {
- /**
- *
- * @param {Object} drag
- * @return
- */
- accept: function(drag) {
- return this.getAcceptedTypes().indexOf(drag.type) > -1 ;
- },
- getAcceptedTypes: function() {
- return [];
- },
- getTypeMapping: function() {
- return {};
- },
- drop: function(event, drag){
- },
- getIconCodeForType: function(type) {
- var types = this.getTypeMapping();
- if (type && types) {
- return types[type];
- }
- return null;
- },
-
- /**
- * implementations call this method when mouse over them
- * @param {Object} drag
- */
- dragEnter: function(event) {
- var drag = window.drag;
- drag.dropzone = this;
- var icon;
- var indicator = drag.indicator;
- if (this.accept(drag)) {
- icon = this.getIconCodeForType(drag.type);
- if (!indicator.hasTemplate(icon)) {
- icon = DnD.CODE_ACCEPT;
- }
- indicator.accept();
- } else {
- icon = DnD.CODE_REJECT;
- indicator.reject();
- }
- indicator.setLeftCell(icon);
- },
-
-
- /**
- * Implementations call this method when mouse exits them
- * @param {Object} drag
- */
- dragLeave: function(event) {
- var drag = window.drag;
- drag.dropzone = null;
- var indicator = drag.indicator;
- indicator.setLeftCell(DnD.CODE_DEFAULT);
- indicator.leave();
- },
-
- onafterdrag: function(event) {
- },
-
- onbeforedrag: function(event, drag){
- },
-
- ondragenter: function(event) {
-
- },
- ondragexit : function(event) {
-
- }
-
-};
-
Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-common.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-common.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-common.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -2,7 +2,7 @@
var attr = Richfaces.getNSAttribute("defaultdndparams", elt);
if (attr) {
- var params = attr.parseJSON();
+ var params = attr.parseJSON(EventHandlersWalk);
if (params) {
return params;
}
@@ -17,7 +17,7 @@
var attr = Richfaces.getNSAttribute(name, elt);
if (attr) {
- var dndParams = attr.parseJSON();
+ var dndParams = attr.parseJSON(EventHandlersWalk);
if (params) {
if (dndParams) {
Object.extend(params, dndParams);
Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -64,6 +64,10 @@
return $(this.id);
},
+ getDraggableOptions: function() {
+ return null;
+ },
+
getDnDDefaultParams: function() {
return DnD.getDnDDefaultParams(this.getElement());
},
@@ -193,8 +197,9 @@
indicator.show();
}
- if( this.options && this.options.ondragstart) {
- this.options.ondragstart();
+ var options = this.getDraggableOptions();
+ if (options && options.ondragstart) {
+ options.ondragstart();
}
// cancel out any text selections
@@ -230,8 +235,9 @@
this.ondragend(event, drag);
}
- if( this.options && this.options.ondragend) {
- this.options.ondragend();
+ var options = this.getDraggableOptions();
+ if (options && options.ondragend) {
+ options.ondragend();
}
},
Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -12,6 +12,10 @@
return $(this.id);
},
+ getDropzoneOptions: function() {
+ return null;
+ },
+
getDnDDefaultParams: function() {
return DnD.getDnDDefaultParams(this.getElement());
},
@@ -112,8 +116,9 @@
dragUp: function(event) {
this.ondropend(event);
- if( this.options && this.options.ondropend) {
- this.options.ondropend();
+ var options = this.getDropzoneOptions();
+ if (options && options.ondropend) {
+ options.ondropend();
}
},
Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/json/json-mini.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/json/json-mini.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/json/json-mini.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -69,3 +69,29 @@
throw new SyntaxError("parseJSON");
};
}
+
+EventHandlersWalk = function(v) {
+ if (v && typeof v == 'object') {
+ var names = new Array();
+ for (var i in v) {
+ if (v.hasOwnProperty(i)) {
+ if (i.length > 2 && i.substring(0, 2) == 'on') {
+ names.push(i);
+ }
+ }
+ }
+
+ for (var i = 0; i < names.length; i++) {
+ var name = names[i];
+ var value = v[name];
+ if (value && typeof value != 'function') {
+ var f = eval('([' + v[name] + '])')[0];
+ if (typeof f == 'function') {
+ v[name] = f;
+ }
+ }
+ }
+ }
+
+ return v;
+};
\ No newline at end of file
Added: trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java
===================================================================
--- trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java (rev 0)
+++ trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -0,0 +1,89 @@
+/**
+ * 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.ajax4jsf.util;
+
+import java.awt.Color;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * <br /><br />
+ *
+ * Created 21.08.2007
+ * @author Nick Belaevski
+ * @since 3.1
+ */
+
+public class Zipper2Test extends TestCase {
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testByte() throws Exception {
+ byte[] b = new byte[3];
+ new Zipper2(b).addByte((byte) 0xDF).addByte((byte) 0x90).addByte((byte) 0xAA);
+ Zipper2 zipper2 = new Zipper2(b);
+ assertEquals((byte) 0xDF, zipper2.nextByte());
+ assertEquals((byte) 0x90, zipper2.nextByte());
+ assertEquals((byte) 0xAA, zipper2.nextByte());
+ }
+
+ public void testShort() throws Exception {
+ byte[] b = new byte[6];
+ new Zipper2(b).addShort((short) 0xA7DF).addShort((short) 0xFE90).addShort((short) 0x34AA);
+ Zipper2 zipper2 = new Zipper2(b);
+ assertEquals((short) 0xA7DF, zipper2.nextShort());
+ assertEquals((short) 0xFE90, zipper2.nextShort());
+ assertEquals((short) 0x34AA, zipper2.nextShort());
+ }
+
+ public void testColor() throws Exception {
+ byte[] b = new byte[9];
+ new Zipper2(b).addColor(new Color(0xA7DFE0)).addColor(0xE2349A).addColor(new Color(0x4812F9));
+ Zipper2 zipper2 = new Zipper2(b);
+ assertEquals(0xA7DFE0, zipper2.nextIntColor());
+ assertEquals(new Color(0xE2349A), zipper2.nextColor());
+ assertEquals(0x4812F9, zipper2.nextIntColor());
+ }
+
+ public void testInt() throws Exception {
+ byte[] b = new byte[12];
+ new Zipper2(b).addInt(0x12A7DFE0).addInt(0x67E2349A).addInt(0xBD4812F9);
+ Zipper2 zipper2 = new Zipper2(b);
+ assertEquals(0x12A7DFE0, zipper2.nextInt());
+ assertEquals(0x67E2349A, zipper2.nextInt());
+ assertEquals(0xBD4812F9, zipper2.nextInt());
+ }
+
+}
Modified: trunk/samples/pom.xml
===================================================================
--- trunk/samples/pom.xml 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/samples/pom.xml 2007-08-21 23:38:32 UTC (rev 2389)
@@ -405,6 +405,7 @@
<module>dataTableDemo</module>
<module>modalpanel-sample</module>
<module>datascroller-sample</module>
+ <module>effect-sample</module>
<module>richfaces-demo</module>
<module>dropdownmenu-sample</module>
<module>tooltip-sample</module>
Modified: trunk/samples/tree-demo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/tree-demo/src/main/webapp/pages/index.jsp 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/samples/tree-demo/src/main/webapp/pages/index.jsp 2007-08-21 23:38:32 UTC (rev 2389)
@@ -42,7 +42,18 @@
height : 32px;
}
</style>
-
+ <script type="text/javascript">
+ function blinkElement(elt) {
+ while (elt.tagName.toLowerCase() != 'table') {
+ elt = elt.parentNode;
+ }
+
+ elt.style.borderColor= '#5555FF';
+ elt.style.borderStyle= 'dotted';
+ elt.style.borderWidth = '3px';
+ setTimeout( function() { this.style.borderStyle = 'none'; }.bind(elt), 300);
+ }
+ </script>
</head>
<body>
<f:view>
@@ -120,7 +131,8 @@
iconLeaf="#{bean.iconLeaf}"
icon="#{bean.icon}"
dropListener="#{bean.processDrop}"
- styleClass="#{bean.styleClass}">
+ styleClass="#{bean.styleClass}"
+ >
<f:facet name="icon">
<h:outputText value="icon" rendered="#{bean.renderFacets}"/>
@@ -141,7 +153,7 @@
<dnd:dndParam name="treeParam" value="Tree Parameter" />
<dnd:dndParam name="accept" value="accept" />
- <rich:treeNode type="input" dropListener="#{bean.processDrop}" oncollapse="Element.removeClassName(event['treeItem'].getElement(), 'colored')" onexpand="Element.addClassName(event['treeItem'].getElement(), 'colored')">
+ <rich:treeNode ondrop="blinkElement(this.getElement())" type="input" dropListener="#{bean.processDrop}" oncollapse="Element.removeClassName(event['treeItem'].getElement(), 'colored')" onexpand="Element.addClassName(event['treeItem'].getElement(), 'colored')">
<h:outputText value="#{data} : " />
<h:inputText value="#{data.name}" required="true" styleClass="inputs">
</h:inputText>
Modified: trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarIcon.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarIcon.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarIcon.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -40,6 +40,8 @@
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper;
+import org.ajax4jsf.util.Zipper2;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -80,29 +82,31 @@
Skin skin = SkinFactory.getInstance().getSkin(context);
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
- Object [] stored = new Object[2];
-
- Color col = null;
-
String skinParameter = "headerBackgroundColor";
String headerTextColor = (String) skin.getParameter(context, skinParameter);
if (null == headerTextColor || "".equals(headerTextColor))
headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
- col = HtmlColor.decode(headerTextColor);
- stored[0] = col;
+ byte[] ret = new byte[6];
+ Zipper2 zipper2 = new Zipper2(ret).addColor(HtmlColor.decode(headerTextColor).getRGB());
skinParameter = "selectControlColor";
String headerBackgroundColor = (String) skin.getParameter(context, skinParameter);
if (null == headerBackgroundColor || "".equals(headerBackgroundColor))
headerBackgroundColor = (String) defaultSkin.getParameter(context, skinParameter);
- col = HtmlColor.decode(headerBackgroundColor);
- stored[1] = col;
-
- return stored;
+ zipper2.addColor(HtmlColor.decode(headerBackgroundColor).getRGB());
+
+ return ret;
}
+ protected Object deserializeData(byte[] objectArray) {
+ Object[] colors = new Object[2];
+ Zipper2 z = new Zipper2(objectArray);
+ colors[0] = z.nextColor();
+ colors[1] = z.nextColor();
+ return colors;
+ }
public void paint(ResourceContext context, Graphics2D graphics) {
Object[] stored = (Object[]) restoreData(context);
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -169,7 +169,7 @@
definition.addToBody("options.parameters['" + DROP_TARGET_ID + "'] = '" + component.getClientId(context) + "';");
//TODO nick - remove as legacy
definition.addToBody("Object.extend(options.parameters,drag.getParameters());");
- definition.addToBody("if (this.options.ondrop) { if (!this.options.ondrop.call(this, event)) return; };");
+ definition.addToBody("var dzOptions = this.getDropzoneOptions(); if (dzOptions.ondrop) { if (!dzOptions.ondrop.call(this, event)) return; };");
JSFunction dropFunction = AjaxRendererUtils.buildAjaxFunction(component, context);
dropFunction.addParameter(new JSReference("options"));
Modified: trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js
===================================================================
--- trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -21,7 +21,7 @@
getDnDDragParams: function() {
if (this.options.dndParams) {
- return this.options.dndParams.parseJSON();
+ return this.options.dndParams.parseJSON(EventHandlersWalk);
}
return null;
@@ -49,6 +49,10 @@
return this.options.dragType;
},
+ getDraggableOptions: function() {
+ return this.options;
+ },
+
initDrag: function(event) {
if(Event.isLeftClick(event)) {
var src = Event.element(event);
Modified: trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-dropzone.js
===================================================================
--- trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-dropzone.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-dropzone.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -35,9 +35,13 @@
},
+ getDropzoneOptions: function() {
+ return this.options;
+ },
+
getDnDDropParams: function() {
if (this.options.dndParams) {
- return this.options.dndParams.parseJSON();
+ return this.options.dndParams.parseJSON(EventHandlersWalk);
}
return null;
Modified: trunk/ui/inputnumber-spinner/src/main/java/org/richfaces/renderkit/html/images/buttons/SpinnerButtonImage.java
===================================================================
--- trunk/ui/inputnumber-spinner/src/main/java/org/richfaces/renderkit/html/images/buttons/SpinnerButtonImage.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/inputnumber-spinner/src/main/java/org/richfaces/renderkit/html/images/buttons/SpinnerButtonImage.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -29,6 +29,7 @@
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -39,6 +40,10 @@
setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
}
+ protected Object deserializeData(byte[] objectArray) {
+ return new Integer(new Zipper2(objectArray).nextIntColor());
+ }
+
protected Object getDataToStore(FacesContext context, Object data) {
Skin skin = SkinFactory.getInstance().getSkin(context);
@@ -50,7 +55,9 @@
}
int intValue = HtmlColor.decode( tmp ==null? "#000000":tmp ).getRGB();
- return new Integer(intValue);
+ byte[] ret = new byte[3];
+ new Zipper2(ret).addColor(intValue);
+ return ret;
}
}
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/images/MenuNodeImage.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/images/MenuNodeImage.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/images/MenuNodeImage.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -14,6 +14,8 @@
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper;
+import org.ajax4jsf.util.Zipper2;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -33,9 +35,15 @@
setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
}
+ protected Object deserializeData(byte[] objectArray) {
+ MenuNodeImageData mnd = new MenuNodeImageData();
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ mnd.setGeneralColor(new Integer(zipper2.nextIntColor()));
+ mnd.setDisabledColor(new Integer(zipper2.nextIntColor()));
+ return mnd;
+ }
+
protected Object getDataToStore(FacesContext context, Object data) {
-
- MenuNodeImageData mnd = new MenuNodeImageData();
Skin skin = SkinFactory.getInstance().getSkin(context);
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
@@ -50,8 +58,10 @@
if (tmp == null || "".equals(tmp))
tmp = "#4A75B5";
intValue = HtmlColor.decode(tmp).getRGB();
- mnd.setGeneralColor(new Integer(intValue));
+ byte[] ret = new byte[6];
+ Zipper2 zipper2 = new Zipper2(ret).addColor(intValue);
+
skinParameter = "tabDisabledTextColor";
tmp = (String) skin.getParameter(context, skinParameter);
if (null == tmp || "".equals(tmp)) {
@@ -60,9 +70,10 @@
if (tmp == null || "".equals(tmp))
tmp = "#6A92CF";
intValue = HtmlColor.decode(tmp).getRGB();
- mnd.setDisabledColor(new Integer(intValue));
- return mnd;
+ zipper2.addColor(intValue);
+
+ return ret;
}
protected void paint(ResourceContext context, Graphics2D g2d) {
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconBasic.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -32,10 +32,10 @@
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
-import org.ajax4jsf.util.HtmlColor;
-import org.ajax4jsf.util.HtmlDimensions;
/**
@@ -62,21 +62,21 @@
}
protected Dimension calculateDimensions(Object data){
- Object [] stored = (Object []) data;
- int h = ((Integer) stored[0]).intValue();
- return new Dimension(h,h);
+ return new Dimension(16, 16);
}
+ protected Object deserializeData(byte[] objectArray) {
+ return new Zipper2(objectArray).nextColor();
+ }
/**
* @param data - pass icon color there
*/
protected Object getDataToStore(FacesContext context, Object data) {
- Object[] stored = new Object[5];
Skin skin = SkinFactory.getInstance().getSkin(context);
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
- stored[0] = new Integer(HtmlDimensions.decode("16px").intValue());
+ byte[] ret = new byte[3];
Color col = null;
@@ -89,8 +89,10 @@
headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
col = HtmlColor.decode(headerTextColor);
}
- stored[1]= col;
- return stored;
+
+ new Zipper2(ret).addColor(col);
+
+ return ret;
}
public boolean isCacheable() {
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -53,8 +53,7 @@
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];
+ Color col = (Color) restoreData(context);
g2d.setColor(col);
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -52,8 +52,7 @@
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];
+ Color col = (Color) restoreData(context);
g2d.setColor(col);
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -52,8 +52,7 @@
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];
+ Color col = (Color) restoreData(context);
g2d.setColor(col);
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -35,8 +35,7 @@
protected void paint(ResourceContext context, Graphics2D g2d) {
Dimension dimension = getDimensions(context);
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
+ Color col = (Color) restoreData(context);
int dim = (int) Math.round(dimension.getWidth() / 3);
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -50,8 +50,7 @@
g2d.translate(40,40);
path.setRect(0,0,40,40);
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
+ Color col = (Color) restoreData(context);
g2d.setColor(col);
Color bcolor = new Color(1f,1f,1f,0f);
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -45,7 +45,7 @@
path.lineTo(33,34);
path.lineTo(0,67);
path.closePath();
- g2d.setColor((Color)(((Object[]) restoreData(context))[1]));
+ g2d.setColor((Color)restoreData(context));
g2d.fill(path);
}
}
\ No newline at end of file
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleDown.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -48,8 +48,7 @@
path.lineTo(34,33);
path.lineTo(67,0);
path.closePath();
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
+ Color col = (Color) restoreData(context);
g2d.setColor(col);
g2d.fill(path);
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleUp.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -47,8 +47,7 @@
path.lineTo(34,0);
path.lineTo(67,33);
path.closePath();
- Object [] data = (Object[]) restoreData(context);
- Color col = (Color)data[1];
+ Color col = (Color) restoreData(context);
g2d.setColor(col);
g2d.fill(path);
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconBasic.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconBasic.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconBasic.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -11,6 +11,7 @@
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -28,6 +29,13 @@
return calculateDimensions();
}
+ protected Object deserializeData(byte[] objectArray) {
+ Object [] stored = new Object[2];
+ stored[0] = new Color(Zipper.unzip(objectArray, 0));
+ stored[1] = new Color(Zipper.unzip(objectArray, 3));
+ return stored;
+ }
+
public abstract Dimension calculateDimensions();
@@ -35,8 +43,6 @@
Skin skin = SkinFactory.getInstance().getSkin(context);
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
- Object [] stored = new Object[2];
-
Color col = null;
String skinParameter = "headerTextColor";
@@ -45,7 +51,8 @@
headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
col = HtmlColor.decode(headerTextColor);
- stored[0] = col;
+ byte[] ret = new byte[6];
+ Zipper.zip(ret, col.getRGB(), 0);
skinParameter = "headerBackgroundColor";
String headerBackgroundColor = (String) skin.getParameter(context, skinParameter);
@@ -53,8 +60,8 @@
headerBackgroundColor = (String) defaultSkin.getParameter(context, skinParameter);
col = HtmlColor.decode(headerBackgroundColor);
- stored[1] = col;
+ Zipper.zip(ret, col.getRGB(), 3);
- return stored;
+ return ret;
}
}
Modified: trunk/ui/separator/src/main/java/org/richfaces/renderkit/html/images/BevelSeparatorImage.java
===================================================================
--- trunk/ui/separator/src/main/java/org/richfaces/renderkit/html/images/BevelSeparatorImage.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/separator/src/main/java/org/richfaces/renderkit/html/images/BevelSeparatorImage.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -39,6 +39,8 @@
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.HtmlDimensions;
+import org.ajax4jsf.util.Zipper;
+import org.ajax4jsf.util.Zipper2;
import org.richfaces.component.UISeparator;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -126,17 +128,29 @@
}
}
+
+ protected Object deserializeData(byte[] objectArray) {
+ SeparatorData separatorData = new SeparatorData();
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ separatorData.setHeight(zipper2.nextShort());
+ separatorData.setLevel3D(zipper2.nextShort());
+ separatorData.setBgColor(zipper2.nextIntColor());
+ separatorData.setGradColor(zipper2.nextIntColor());
+ return separatorData;
+ }
protected Object getDataToStore(FacesContext context, Object data) {
- SeparatorData separatorData = new SeparatorData();
Skin skin = SkinFactory.getInstance().getSkin(context);
//XXX by nick - fantonov - ((UISeparator)data).getHeight() ?
String tmp = (String) ((UISeparator) data).getHeight();
- separatorData.setHeight(HtmlDimensions.decode(tmp == null ? "6" : tmp).intValue());
+
+ byte[] ret = new byte[10];
+
+ Zipper2 zipper2 = new Zipper2(ret).addShort((short) HtmlDimensions.decode(tmp == null ? "6" : tmp).intValue());
tmp = (String) skin.getParameter(context, "interfaceLevel3D");
- separatorData.setLevel3D(HtmlDimensions.decode(tmp == null ? "5" : tmp).intValue());
+ zipper2.addShort((short) HtmlDimensions.decode(tmp == null ? "5" : tmp).intValue());
String skinParameter = "headerBackgroundColor";
tmp = (String) skin.getParameter(context, skinParameter);
@@ -144,7 +158,7 @@
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
tmp = (String) defaultSkin.getParameter(context, skinParameter);
}
- separatorData.setBgColor(HtmlColor.decode(tmp == null ? "#4169E1" : tmp).getRGB());
+ zipper2.addColor(HtmlColor.decode(tmp == null ? "#4169E1" : tmp).getRGB());
skinParameter = "overAllBackground";
tmp = (String) skin.getParameter(context, skinParameter);
@@ -152,9 +166,9 @@
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
tmp = (String) defaultSkin.getParameter(context, skinParameter);
}
- separatorData.setGradColor(HtmlColor.decode(tmp == null ? "#FFFFFF" : tmp).getRGB());
+ zipper2.addColor(HtmlColor.decode(tmp == null ? "#FFFFFF" : tmp).getRGB());
- return separatorData;
+ return ret;
}
protected static class SeparatorData implements Serializable {
Modified: trunk/ui/separator/src/main/java/org/richfaces/renderkit/html/images/SimpleSeparatorImage.java
===================================================================
--- trunk/ui/separator/src/main/java/org/richfaces/renderkit/html/images/SimpleSeparatorImage.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/separator/src/main/java/org/richfaces/renderkit/html/images/SimpleSeparatorImage.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -37,6 +37,8 @@
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.HtmlDimensions;
+import org.ajax4jsf.util.Zipper;
+import org.ajax4jsf.util.Zipper2;
import org.richfaces.component.UISeparator;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -103,12 +105,23 @@
return null;
}
+ protected Object deserializeData(byte[] objectArray) {
+ SimpleSeparatorData separatorData = new SimpleSeparatorData();
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ separatorData.setHeight(zipper2.nextShort());
+ separatorData.setColor(zipper2.nextIntColor());
+ separatorData.setLineType(zipper2.nextByte());
+ return separatorData;
+ }
+
protected Object getDataToStore(FacesContext context, Object data) {
- SimpleSeparatorData separatorData = new SimpleSeparatorData();
Skin skin = SkinFactory.getInstance().getSkin(context);
+ byte[] ret = new byte[6];
+
String tmp = (String) ((UIComponent) data).getAttributes().get("height");
- separatorData.setHeight(HtmlDimensions.decode(tmp == null ? "6" : tmp).intValue());
+ int height = HtmlDimensions.decode(tmp == null ? "6" : tmp).intValue();
+ Zipper2 zipper2 = new Zipper2(ret).addShort((short) height);
String skinParameter = "headerBackgroundColor";
tmp = (String) skin.getParameter(context, skinParameter);
@@ -116,7 +129,7 @@
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
tmp = (String) defaultSkin.getParameter(context, skinParameter);
}
- separatorData.setColor(HtmlColor.decode(tmp == null ? "#4169E1" : tmp).getRGB());
+ zipper2.addColor(HtmlColor.decode(tmp == null ? "#4169E1" : tmp).getRGB());
//XXX by nick - fantonov - ((UISeparator)data).getLineType() ?
tmp = (String) ((UISeparator) data).getLineType();
@@ -126,12 +139,12 @@
} else if (tmp.equalsIgnoreCase(UISeparator.LINE_TYPE_DASHED)) {
lineType = LINE_TYPE_DASHED;
} else
- if (tmp.equalsIgnoreCase(UISeparator.LINE_TYPE_DOUBLE) && separatorData.getHeight() > 2)
+ if (tmp.equalsIgnoreCase(UISeparator.LINE_TYPE_DOUBLE) && height > 2)
{
lineType = LINE_TYPE_DOUBLE;
}
- separatorData.setLineType(lineType);
- return separatorData;
+ zipper2.addByte((byte) lineType);
+ return ret;
}
protected static class SimpleSeparatorData implements Serializable {
Modified: trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/images/ToolBarSeparatorImage.java
===================================================================
--- trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/images/ToolBarSeparatorImage.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/images/ToolBarSeparatorImage.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -31,6 +31,8 @@
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.HtmlDimensions;
+import org.ajax4jsf.util.Zipper;
+import org.ajax4jsf.util.Zipper2;
import org.richfaces.component.UIToolBar;
import org.richfaces.component.UIToolBarGroup;
import org.richfaces.skin.Skin;
@@ -47,8 +49,19 @@
setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
}
+ protected Object deserializeData(byte[] objectArray) {
+ SeparatorData separatorData = new SeparatorData();
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ separatorData.setHeaderBackgroundColor(zipper2.nextIntColor());
+ separatorData.setHeaderGradientColor(zipper2.nextIntColor());
+ separatorData.setHeaderTextColor(zipper2.nextIntColor());
+ separatorData.setFontSize(zipper2.nextShort());
+ separatorData.setSeparatorHeight(zipper2.nextShort());
+
+ return separatorData;
+ }
+
protected Object getDataToStore(FacesContext context, Object data) {
- SeparatorData separatorData = new SeparatorData();
Skin skin = SkinFactory.getInstance().getSkin(context);
Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
@@ -57,32 +70,33 @@
if (null == tmp || "".equals(tmp)) {
tmp = (String) defaultSkin.getParameter(context, skinParameter);
}
- separatorData.setHeaderBackgroundColor(HtmlColor.decode( tmp == null ? "#224986" : tmp ).getRGB());
+ byte[] ret = new byte[13];
+ Zipper2 zipper2 = new Zipper2(ret).addColor(HtmlColor.decode( tmp == null ? "#224986" : tmp ).getRGB());
+
skinParameter = "headerGradientColor";
tmp = (String) skin.getParameter(context, skinParameter);
if (null == tmp || "".equals(tmp)) {
tmp = (String) defaultSkin.getParameter(context, skinParameter);
}
- separatorData.setHeaderGradientColor(HtmlColor.decode( tmp == null ? "#CCCCFF" : tmp).getRGB());
+ zipper2.addColor(HtmlColor.decode( tmp == null ? "#CCCCFF" : tmp).getRGB());
skinParameter = "headerTextColor";
tmp = (String) skin.getParameter(context, skinParameter);
if (null == tmp || "".equals(tmp)) {
tmp = (String) defaultSkin.getParameter(context, skinParameter);
}
- separatorData.setHeaderTextColor(HtmlColor.decode( tmp == null ? "#000000" : tmp ).getRGB());
+ zipper2.addColor(HtmlColor.decode( tmp == null ? "#000000" : tmp ).getRGB());
skinParameter = "headerSizeFont";
tmp = (String) skin.getParameter(context, skinParameter);
if (null == tmp || "".equals(tmp)) {
tmp = (String) defaultSkin.getParameter(context, skinParameter);
}
- separatorData.setFontSize(HtmlDimensions.decode( tmp == null ? "11px" : tmp ).intValue());
-
- separatorData.setSeparatorHeight(resolveBarHeight(data));
+ zipper2.addShort((short) HtmlDimensions.decode( tmp == null ? "11px" : tmp ).intValue());
+ zipper2.addShort((short) resolveBarHeight(data));
- return separatorData;
+ return ret;
}
private int resolveBarHeight(Object data){
Modified: trunk/ui/tree/src/main/config/component/treeNode.xml
===================================================================
--- trunk/ui/tree/src/main/config/component/treeNode.xml 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/tree/src/main/config/component/treeNode.xml 2007-08-21 23:38:32 UTC (rev 2389)
@@ -59,7 +59,34 @@
<name>ondrop</name>
<classname>java.lang.String</classname>
<description>It's an event that is called when something is dropped on a drop zone</description>
+ <defaultvalue>getDefaultOndrop()</defaultvalue>
</property>
+ <property>
+ <name>ondropend</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>getDefaultOndropend()</defaultvalue>
+ </property>
+ <property>
+ <name>ondragstart</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>getDefaultOndragstart()</defaultvalue>
+ </property>
+ <property>
+ <name>ondragend</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>getDefaultOndragend()</defaultvalue>
+ </property>
+ <property>
+ <name>ondragenter</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>getDefaultOndragenter()</defaultvalue>
+ </property>
+ <property>
+ <name>ondragexit</name>
+ <classname>java.lang.String</classname>
+ <defaultvalue>getDefaultOndragexit()</defaultvalue>
+ </property>
+
<property>
<name>oncontextmenu</name>
<classname>java.lang.String</classname>
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -359,4 +359,53 @@
return null;
}
+ protected String getDefaultOndragend() {
+ //tag invokes read method on component creation
+ //we shouldn't fail with NPE
+ UITree tree = getUITree();
+ if (tree == null) {
+ return null;
+ }
+ return tree.getOndragend();
+ }
+
+ protected String getDefaultOndragenter() {
+ UITree tree = getUITree();
+ if (tree == null) {
+ return null;
+ }
+ return tree.getOndragenter();
+ }
+
+ protected String getDefaultOndragexit() {
+ UITree tree = getUITree();
+ if (tree == null) {
+ return null;
+ }
+ return tree.getOndragexit();
+ }
+
+ protected String getDefaultOndragstart() {
+ UITree tree = getUITree();
+ if (tree == null) {
+ return null;
+ }
+ return tree.getOndragstart();
+ }
+
+ protected String getDefaultOndrop() {
+ UITree tree = getUITree();
+ if (tree == null) {
+ return null;
+ }
+ return tree.getOndrop();
+ }
+
+ protected String getDefaultOndropend() {
+ UITree tree = getUITree();
+ if (tree == null) {
+ return null;
+ }
+ return tree.getOndropend();
+ }
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/tree/src/main/java/org/richfaces/renderkit/NodeRendererBase.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -6,6 +6,7 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -13,6 +14,7 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
@@ -308,11 +310,25 @@
return null;
}
+
+ private void convertOptions(Map opts) {
+ //converts JSFunctionDefinition to string
+ Iterator iterator = opts.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ Object value = entry.getValue();
+ if (value instanceof JSFunctionDefinition) {
+ JSFunctionDefinition definition = (JSFunctionDefinition) value;
+ entry.setValue(definition.toScript());
+ }
+ }
+ }
public String getDraggableScriptOptions(FacesContext context,
UITreeNode component) {
ScriptOptions options = new TreeNodeOptions(component);
mergeScriptOptions(options, context, component, Draggable.class);
+ convertOptions(options.getMap());
return ScriptUtils.toScript(options);
}
@@ -320,6 +336,7 @@
UITreeNode component) {
ScriptOptions options = new TreeNodeOptions(component);
mergeScriptOptions(options, context, component, Dropzone.class);
+ convertOptions(options.getMap());
return ScriptUtils.toScript(options);
}
}
Modified: trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item-dnd.js
===================================================================
--- trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item-dnd.js 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item-dnd.js 2007-08-21 23:38:32 UTC (rev 2389)
@@ -56,7 +56,7 @@
getDropzoneOptions: function() {
var attr = Richfaces.getNSAttribute("dropzoneoptions", $(this.elementID.icon));
if (attr) {
- return attr.parseJSON();
+ return attr.parseJSON(EventHandlersWalk);
}
return null;
@@ -74,7 +74,7 @@
Object.extend(drag.params, opts.parameters);
}
- this.tree.drop(event, drag);
+ this.tree.drop.call(this, event, drag);
},
getIndicator: function() {
@@ -110,7 +110,7 @@
var attr = Richfaces.getNSAttribute("draggableoptions", $(this.elementID.icon));
if (attr) {
- var opts = attr.parseJSON();
+ var opts = attr.parseJSON(EventHandlersWalk);
if (window.drag) {
window.drag.treeDraggableOptions = opts;
}
Modified: trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
===================================================================
--- trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java 2007-08-21 23:19:31 UTC (rev 2388)
+++ trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java 2007-08-21 23:38:32 UTC (rev 2389)
@@ -72,26 +72,27 @@
private static Set javaScripts = new HashSet();
static {
- javaScripts.add("/org/richfaces/renderkit/html/scripts/json/json-mini.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/json/json-dom.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/json/json-mini.js");
- javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript");
- javaScripts.add("scripts/AJAX.js");
- javaScripts.add("org.ajax4jsf.dnd.DnDScript");
+ javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ javaScripts.add("org.ajax4jsf.javascript.DnDScript");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/utils.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/dnd/dnd-common.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/utils.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/dnd/dnd-common.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js");
- javaScripts.add("/org/ajax4jsf/renderkit/html/scripts/form.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/form.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/events.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/tree.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/tree-selection.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/tree-item.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/tree-item-dnd.js");
- javaScripts.add("/org/richfaces/renderkit/html/scripts/drag-indicator.js");
+ javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/form.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/events.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/tree.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/tree-selection.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/tree-item.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/tree-item-dnd.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/drag-indicator.js");
}
@@ -801,6 +802,58 @@
assertEquals("indicator2", treeNode.getDragIndicator());
assertNull(treeNode.getLocalDragIndicator());
}
+
+ public void testDnDEventGetters() throws Exception {
+ assertNull(treeNode.getOndragend());
+ assertNull(treeNode.getOndragenter());
+ assertNull(treeNode.getOndragexit());
+ assertNull(treeNode.getOndragstart());
+ assertNull(treeNode.getOndrop());
+ assertNull(treeNode.getOndropend());
+
+ tree.setOndragend("dragEnd1");
+ tree.setOndragenter("dragEnter1");
+ tree.setOndragexit("dragExit1");
+ tree.setOndragstart("dragStart1");
+ tree.setOndrop("drop1");
+ tree.setOndropend("dropEnd1");
+
+ assertEquals("dragEnd1", treeNode.getOndragend());
+ assertEquals("dragEnter1", treeNode.getOndragenter());
+ assertEquals("dragExit1", treeNode.getOndragexit());
+ assertEquals("dragStart1", treeNode.getOndragstart());
+ assertEquals("drop1", treeNode.getOndrop());
+ assertEquals("dropEnd1", treeNode.getOndropend());
+
+ treeNode.setOndragend("dragEnd2");
+ treeNode.setOndragenter("dragEnter2");
+ treeNode.setOndragexit("dragExit2");
+ treeNode.setOndragstart("dragStart2");
+ treeNode.setOndrop("drop2");
+ treeNode.setOndropend("dropEnd2");
+
+ assertEquals("dragEnd2", treeNode.getOndragend());
+ assertEquals("dragEnter2", treeNode.getOndragenter());
+ assertEquals("dragExit2", treeNode.getOndragexit());
+ assertEquals("dragStart2", treeNode.getOndragstart());
+ assertEquals("drop2", treeNode.getOndrop());
+ assertEquals("dropEnd2", treeNode.getOndropend());
+
+ tree.setOndragend(null);
+ tree.setOndragenter(null);
+ tree.setOndragexit(null);
+ tree.setOndragstart(null);
+ tree.setOndrop(null);
+ tree.setOndropend(null);
+
+ assertEquals("dragEnd2", treeNode.getOndragend());
+ assertEquals("dragEnter2", treeNode.getOndragenter());
+ assertEquals("dragExit2", treeNode.getOndragexit());
+ assertEquals("dragStart2", treeNode.getOndragstart());
+ assertEquals("drop2", treeNode.getOndrop());
+ assertEquals("dropEnd2", treeNode.getOndropend());
+
+ }
}
18 years, 8 months
JBoss Rich Faces SVN: r2388 - trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-08-21 19:19:31 -0400 (Tue, 21 Aug 2007)
New Revision: 2388
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
Log:
Remove JDK6 dependency.
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2007-08-21 23:19:11 UTC (rev 2387)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/datatablescroller/DataTableScrollerBean.java 2007-08-21 23:19:31 UTC (rev 2388)
@@ -135,6 +135,6 @@
byte b[] = new byte[n];
for (int i = 0; i < n; i++)
b[i] = (byte)rand('A', 'Z');
- return new String(b,Charset.defaultCharset());
+ return new String(b);
}
}
18 years, 8 months