Author: nbelaevski
Date: 2010-11-01 14:02:02 -0400 (Mon, 01 Nov 2010)
New Revision: 19857
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/BaseTreeImage.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineImage.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineLastImage.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeMinusImage.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java
Removed:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/last.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/line.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/minus.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/plus.gif
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
Log:
https://jira.jboss.org/browse/RF-9316
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/BaseTreeImage.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/BaseTreeImage.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/BaseTreeImage.java 2010-11-01
18:02:02 UTC (rev 19857)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Dimension;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.CacheableResource;
+import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.ImageType;
+import org.richfaces.resource.Java2DUserResource;
+import org.richfaces.resource.StateHolderResource;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@DynamicResource
+public abstract class BaseTreeImage implements Java2DUserResource, StateHolderResource,
CacheableResource {
+
+ private Dimension dimension;
+
+ protected BaseTreeImage(Dimension dimension) {
+ super();
+ this.dimension = dimension;
+ }
+ public boolean isCacheable(FacesContext context) {
+ return true;
+ }
+ public Date getExpires(FacesContext context) {
+ return null;
+ }
+
+ public int getTimeToLive(FacesContext context) {
+ return -1;
+ }
+
+ public String getEntityTag(FacesContext context) {
+ return null;
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public Map<String, String> getResponseHeaders() {
+ return null;
+ }
+
+ public Date getLastModified() {
+ return null;
+ }
+
+ public ImageType getImageType() {
+ return ImageType.PNG;
+ }
+
+ public Dimension getDimension() {
+ return dimension;
+ }
+
+}
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineImage.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineImage.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineImage.java 2010-11-01
18:02:02 UTC (rev 19857)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.PostConstructResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@DynamicResource
+public class TreeLineImage extends BaseTreeImage {
+
+ private static final Dimension DIMENSION = new Dimension(16, 16);
+
+ protected Integer trimColorValue;
+
+ public TreeLineImage() {
+ super(DIMENSION);
+ }
+
+ protected TreeLineImage(Dimension dimension) {
+ super(dimension);
+ }
+
+ @PostConstructResource
+ public void init() {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+
+ trimColorValue = skin.getColorParameter(context, Skin.TRIM_COLOR);
+ }
+
+ public void paint(Graphics2D g2d, Dimension dimension) {
+ g2d.setColor(new Color(trimColorValue));
+
+ g2d.drawLine(7, 0, 7, 15);
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
+ dataOutput.writeInt(trimColorValue);
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException
{
+ trimColorValue = dataInput.readInt();
+ }
+
+
+
+}
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineLastImage.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineLastImage.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineLastImage.java 2010-11-01
18:02:02 UTC (rev 19857)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+
+import org.richfaces.resource.DynamicResource;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@DynamicResource
+public class TreeLineLastImage extends TreeLineImage {
+
+ private static final Dimension DIMENSION = new Dimension(16, 200);
+
+ public TreeLineLastImage() {
+ super(DIMENSION);
+ }
+
+ public void paint(Graphics2D g2d, Dimension dimension) {
+ g2d.setColor(new Color(trimColorValue));
+
+ g2d.drawLine(7, 0, 7, 99);
+ g2d.drawLine(7, 99, 15, 99);
+ }
+
+}
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeMinusImage.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeMinusImage.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeMinusImage.java 2010-11-01
18:02:02 UTC (rev 19857)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+
+import org.richfaces.resource.DynamicResource;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@DynamicResource
+public class TreeMinusImage extends TreePlusImage {
+
+ public void paint(Graphics2D g2d, Dimension dimension) {
+ drawFrame(g2d);
+ drawHorizontalCrossLine(g2d);
+ }
+
+}
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java 2010-11-01
18:02:02 UTC (rev 19857)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.DynamicResource;
+import org.richfaces.resource.PostConstructResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@DynamicResource
+public class TreePlusImage extends BaseTreeImage {
+
+ private static final Dimension DIMENSION = new Dimension(16, 16);
+
+ protected Integer generalColorValue;
+
+ protected Integer controlColorValue;
+
+ protected Integer trimColorValue;
+
+ public TreePlusImage() {
+ super(DIMENSION);
+ }
+
+ @PostConstructResource
+ public void init() {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+
+ generalColorValue = skin.getColorParameter(context, Skin.GENERAL_TEXT_COLOR);
+ controlColorValue = skin.getColorParameter(context,
Skin.CONTROL_BACKGROUND_COLOR);
+ trimColorValue = skin.getColorParameter(context, Skin.TRIM_COLOR);
+ }
+
+ protected void drawFrame(Graphics2D g2d) {
+ Color trimColor = new Color(trimColorValue);
+ Color controlColor = new Color(controlColorValue);
+
+ g2d.setColor(trimColor);
+ g2d.drawRect(3, 3, 8, 8);
+
+ Rectangle2D rect = new Rectangle2D.Float(4, 4, 7, 7);
+ GradientPaint gragient = new GradientPaint(4, 4, controlColor, 13, 13,
trimColor);
+ g2d.setPaint(gragient);
+ g2d.fill(rect);
+ }
+
+ public void paint(Graphics2D g2d, Dimension dimension) {
+ drawFrame(g2d);
+
+ drawHorizontalCrossLine(g2d);
+ drawVerticalCrossLine(g2d);
+ }
+
+ protected void drawVerticalCrossLine(Graphics2D g2d) {
+ g2d.setColor(new Color(generalColorValue));
+ //vertical cross line
+ g2d.drawLine(7, 5, 7, 9);
+ }
+
+ protected void drawHorizontalCrossLine(Graphics2D g2d) {
+ g2d.setColor(new Color(generalColorValue));
+ //horizontal cross line
+ g2d.drawLine(5, 7, 9, 7);
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
+ dataOutput.writeInt(generalColorValue);
+ dataOutput.writeInt(controlColorValue);
+ dataOutput.writeInt(trimColorValue);
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException
{
+ generalColorValue = dataInput.readInt();
+ controlColorValue = dataInput.readInt();
+ trimColorValue = dataInput.readInt();
+ }
+
+}
Deleted:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/last.gif
===================================================================
(Binary files differ)
Deleted:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/line.gif
===================================================================
(Binary files differ)
Deleted:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/minus.gif
===================================================================
(Binary files differ)
Deleted:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/plus.gif
===================================================================
(Binary files differ)
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-11-01
16:54:36 UTC (rev 19856)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-11-01
18:02:02 UTC (rev 19857)
@@ -1,5 +1,5 @@
.rf-trn {
- background: "url(#{resource['org.richfaces.images:last.gif']}) no-repeat
center left";
+ background: "url(#{resource['org.richfaces.images:last.png']}) no-repeat
center left";
cursor: default;
font-size: '#{richSkin.generalSizeFont}';
font-family: '#{richSkin.generalFamilyFont}';
@@ -26,7 +26,7 @@
}
.rf-tr-nd {
- background: "url(#{resource['org.richfaces.images:line.gif']})
repeat-y";
+ background: "url(#{resource['org.richfaces.images:line.png']})
repeat-y";
}
.rf-tr-nd-last {
@@ -51,11 +51,11 @@
}
.rf-trn-hnd-colps {
- background: "url(#{resource['org.richfaces.images:plus.gif']}) no-repeat
center";
+ background: "url(#{resource['org.richfaces.images:plus.png']}) no-repeat
center";
}
.rf-trn-hnd-exp {
- background: "url(#{resource['org.richfaces.images:minus.gif']}) no-repeat
center";
+ background: "url(#{resource['org.richfaces.images:minus.png']}) no-repeat
center";
}
.rf-trn-ico-nd {
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2010-11-01
16:54:36 UTC (rev 19856)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2010-11-01
18:02:02 UTC (rev 19857)
@@ -6,9 +6,9 @@
{baseColorParam=additionalBackgroundColor, gradientColorParam=tableBackgroundColor}
org.richfaces.images\:colHdrGrad.png=org.richfaces.renderkit.html.BaseGradient\
{baseColorParam=tableSubHeaderBackgroundColor,
gradientColorParam=tableHeaderBackgroundColor}
-org.richfaces.images\:last.gif=org.richfaces\:last.gif
-org.richfaces.images\:line.gif=org.richfaces\:line.gif
-org.richfaces.images\:plus.gif=org.richfaces\:plus.gif
-org.richfaces.images\:minus.gif=org.richfaces\:minus.gif
+org.richfaces.images\:last.png=org.richfaces.renderkit.html.images.TreeLineLastImage
+org.richfaces.images\:line.png=org.richfaces.renderkit.html.images.TreeLineImage
+org.richfaces.images\:plus.png=org.richfaces.renderkit.html.images.TreePlusImage
+org.richfaces.images\:minus.png=org.richfaces.renderkit.html.images.TreeMinusImage
org.richfaces.images\:node_icon.gif=org.richfaces\:node_icon.gif
org.richfaces.images\:leaf_icon.gif=org.richfaces\:leaf_icon.gif
\ No newline at end of file