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.Button;
9   import thinwire.ui.Component;
10  import thinwire.ui.Label;
11  import thinwire.ui.Panel;
12  import thinwire.ui.layout.TableLayout;
13  
14  import com.hack23.cia.web.common.BeanLocator;
15  
16  /***
17   * The Class CategoryDescriptionPanel.
18   */
19  public class CategoryDescriptionPanel extends Panel {
20  
21      /***
22       * Instantiates a new category description panel.
23       *
24       * @param filePath the file path
25       * @param actionDescription the action description
26       * @param userObject the user object
27       * @param longDescription the long description
28       */
29      public CategoryDescriptionPanel(final String filePath,
30              final String actionDescription, final Object userObject,
31              final String longDescription) {
32          setLayout(new TableLayout(new double[][] { { 0, 0 }, // Column Widths
33                  { 0 } }, // Row Heights
34                  1, // Margin around edge of container
35                  5)); // Spacing between cells
36  
37          final Button actionButton = new Button(actionDescription, filePath);
38          actionButton.setLimit("0,0,1,1"); //$NON-NLS-1$
39          actionButton.setUserObject(userObject);
40          actionButton.addActionListener(Component.ACTION_CLICK, BeanLocator
41                  .getApplicationActionListener());
42  
43          final Label longDescriptionLabel = new Label();
44          longDescriptionLabel.setWrapText(true);
45          longDescriptionLabel.setText(longDescription);
46          longDescriptionLabel.setLimit("1,0,1,1"); //$NON-NLS-1$      
47  
48          getChildren().add(actionButton);
49          getChildren().add(longDescriptionLabel);
50      }
51  
52  }