Revision 41853 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/TocItemBranch.java

View differences:

TocItemBranch.java
58 58
	private ImageIcon finalIcon = null;
59 59

  
60 60
	private BufferedImage unavailableImg = null;
61

  
61
        
62
	private BufferedImage temporaryLayerImg = null;
63
        
62 64
	private final String defaultIcon = "images/icolayer.PNG";
63 65

  
64 66
	private boolean isAvailable = true;
......
118 120

  
119 121
	}
120 122
	private void updateStateIcon() {
121
		if (icolayer == null) return;
122
		if (lyr.getTocStatusImage() != null)
123
		{
124
			BufferedImage newImage = new BufferedImage(icolayer.getIconWidth(),icolayer.getIconHeight(),BufferedImage.TYPE_INT_ARGB);
125
			Graphics2D grp = newImage.createGraphics();
126
			grp.drawImage(icolayer.getImage(),0,0,null);
123
		if (icolayer == null) {
124
                    return;
125
                }
126
        	BufferedImage newImage = new BufferedImage(icolayer.getIconWidth(),icolayer.getIconHeight(),BufferedImage.TYPE_INT_ARGB);
127
                Graphics2D grp = newImage.createGraphics();
128
                grp.drawImage(icolayer.getImage(),0,0,null);
129
		if (lyr.getTocStatusImage() != null) {
127 130
			Image img = lyr.getTocStatusImage();
128
			grp.drawImage(
129
					img,
130
					0,
131
					icolayer.getIconHeight() -img.getHeight(null),
132
					null
133
			);
134
			this.finalIcon = new ImageIcon(newImage);
131
			grp.drawImage(img,0,icolayer.getIconHeight()-img.getHeight(null),null);
135 132
		}
136
		if (this.lyr.isAvailable() != this.isAvailable || finalIcon==null) {
133

  
134
                if (this.lyr.isAvailable() != this.isAvailable ) {
137 135
			if (!this.lyr.isAvailable()) {
138
				BufferedImage newImage = new BufferedImage(icolayer.getIconWidth(),icolayer.getIconHeight(),BufferedImage.TYPE_INT_ARGB);
139
				Graphics2D grp = newImage.createGraphics();
140
				grp.drawImage(icolayer.getImage(),0,0,null);
141
				/*grp.setComposite(AlphaComposite.getInstance(
142
				 AlphaComposite.SRC_OVER, (float) 1));*/
143 136
				BufferedImage img = this.getUnavailableImage();
144
				grp.drawImage(
145
						img,
146
						0,
147
						icolayer.getIconHeight() -img.getHeight(),
148
						null
149
				);
150
				this.finalIcon = new ImageIcon(newImage);
151

  
152
			} else {
153
				this.finalIcon = new ImageIcon(icolayer.getImage());
137
				grp.drawImage(img,0,icolayer.getIconHeight()-img.getHeight(),null);
154 138
			}
155 139
			this.isAvailable =(this.lyr.isAvailable());
156 140
		}
141
                
142
                if( this.lyr.isTemporary() ) {
143
                        BufferedImage img = this.getTemporaryLayerImage();
144
                        grp.drawImage(img,icolayer.getIconWidth()-img.getWidth(),icolayer.getIconHeight()-img.getHeight(),null);
145
                }
146
                
147
		this.finalIcon = new ImageIcon(newImage);
148
        }
157 149

  
158
	}
159

  
160 150
	private void setIcon(ImageIcon icon) {
161 151
		if (icon!=null) {
162 152
			icolayer = icon;
......
210 200

  
211 201
	private BufferedImage getUnavailableImage() {
212 202
		if (this.unavailableImg == null) {
213
			ImageIcon uIcon = IconThemeHelper.getImageIcon("layer-icon-unavailable");
203
			ImageIcon uIcon = IconThemeHelper.getImageIcon("layer-chk-unavailable");
214 204
			if (uIcon != null) {
215 205
				this.unavailableImg = new BufferedImage(uIcon.getIconWidth(), uIcon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
216 206
				this.unavailableImg.getGraphics().drawImage(uIcon.getImage(), 0, 0, null);
......
218 208
		}
219 209
		return this.unavailableImg;
220 210
	}
211
        
212
	private BufferedImage getTemporaryLayerImage() {
213
		if (this.temporaryLayerImg == null) {
214
			ImageIcon uIcon = IconThemeHelper.getImageIcon("layer-chk-temporary");
215
			if (uIcon != null) {
216
				this.temporaryLayerImg = new BufferedImage(uIcon.getIconWidth(), uIcon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
217
				this.temporaryLayerImg.getGraphics().drawImage(uIcon.getImage(), 0, 0, null);
218
			}
219
		}
220
		return this.temporaryLayerImg;
221
	}
221 222

  
222 223
	public IContextMenuAction getDoubleClickAction() {
223 224
		// TODO

Also available in: Unified diff