View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   
6   package com.hack23.cia.web.views.components.panels;
7   
8   import thinwire.ui.Image;
9   import thinwire.ui.Panel;
10  import thinwire.ui.layout.TableLayout;
11  import thinwire.util.ImageInfo;
12  
13  /***
14   * The Class ImagePanel.
15   */
16  public class ImagePanel extends Panel {
17  
18  	/***
19  	 * Instantiates a new image panel.
20  	 *
21  	 * @param fileName the file name
22  	 */
23  	public ImagePanel(final String fileName) {
24          setLayout(new TableLayout(new double[][] { { 0 }, // Column Widths
25                  { 0 } }, // Row Heights
26                  1, // Margin around edge of container
27                  5)); // Spacing between cells
28  
29          if (fileName != null) {
30  			final ImageInfo imageInfo = new ImageInfo("services/image?filename=" + fileName,ImageInfo.Format.PNG , 800, 600);
31  	        final Image image = new Image(imageInfo);
32  	        image.setLimit("0,0,1,1"); //$NON-NLS-1$
33  	        image.setVisible(true);
34  	        getChildren().add(image);
35          }
36  	}
37  }