Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
License Agreement. Rich Faces - Natural Ajax for Java Server Faces (JSF) Copyright (C) 2007 Exadel, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 package org.richfaces.renderkit.html.images;
 
 import java.awt.Color;
 import java.util.Date;
 import java.util.Map;
 
 import  javax.faces.context.FacesContext;
 
 import  org.richfaces.resource.DynamicUserResource;
 import  org.richfaces.resource.ImageType;
 import  org.richfaces.resource.Java2DUserResource;
 import  org.richfaces.resource.PostConstructResource;
 import  org.richfaces.resource.StateHolderResource;
 import  org.richfaces.skin.Skin;
 import  org.richfaces.skin.SkinFactory;
 
 @DynamicUserResource
 public class MenuNodeImage implements Java2DUserResource, StateHolderResource {
     private static final Dimension DIMENSIONS = new Dimension(7, 14);
     private Integer disabledColor;
     private Integer generalColor;
 
     public Integer getDisabledColor() {
         return ;
     }
 
     public void setDisabledColor(Integer disabledColor) {
         this. = disabledColor;
     }
 
     public Integer getGeneralColor() {
         return ;
     }
 
     public void setGeneralColor(Integer generalColor) {
         this. = generalColor;
     }
 
     public boolean isTransient() {
         return false;
     }
 
     public void writeState(FacesContext contextDataOutput dataOutputthrows IOException {
         dataOutput.writeInt();
         dataOutput.writeInt();
     }
 
     public void readState(FacesContext contextDataInput dataInputthrows IOException {
         this. = dataInput.readInt();
         this. = dataInput.readInt();
     }
 
     public Map<StringStringgetResponseHeaders() {
         return null;
     }
 
     public Date getLastModified() {
         return null;
     }
 
     public ImageType getImageType() {
         return ImageType.GIF;
     }
 
     public Dimension getDimension() {
         return ;
     }
 
     public void paint(Graphics2D g2d) {
 
         g2d.setColor(new Color(getGeneralColor().intValue()));
         drawTriangle(g2d, 2, 0);
        g2d.setColor(new Color(getDisabledColor().intValue()));
        drawTriangle(g2d, 2, . / 2);
    }
    private void drawTriangle(Graphics2D g2dint startPosXint startPosY) {
        int dTriangle = 6;
        for (int i = 0; i < 4; i++) {
            g2d.drawLine(startPosX + istartPosY + istartPosX + istartPosY + dTriangle - i);
        }
    }
    @PostConstructResource
    public final void initialize() {
        FacesContext context = FacesContext.getCurrentInstance();
        Skin skin = SkinFactory.getInstance(context).getSkin(context);
        Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
        String skinParameter = "generalTextColor";
        String tmp = (Stringskin.getParameter(contextskinParameter);
        if (null == tmp || "".equals(tmp)) {
            tmp = (StringdefaultSkin.getParameter(contextskinParameter);
        }
        this.setGeneralColor(Color.decode(tmp == null ? "#4A75B5" : tmp).getRGB());
        skinParameter = "tabDisabledTextColor";
        tmp = (Stringskin.getParameter(contextskinParameter);
        if (null == tmp || "".equals(tmp)) {
            tmp = (StringdefaultSkin.getParameter(contextskinParameter);
        }
        this.setDisabledColor(Color.decode(tmp == null ? "#6A92CF" : tmp).getRGB());
    }
New to GrepCode? Check out our FAQ X