This is an implementation of the Forte Panel class. It is identical to the JPanel and is included to provide type compatability PM:5/8/07 remove toString() TF:16/8/07 Major overhaul to make compatible with Forte TF:2/10/07 Added the ignoreInvisibleChildren attribute
Panels are blocks of HTML / JSP that may be added by plugins to one of the main areas of the Adito layout.
Every panel must have a unique ID.
Each panel has a Placement that determines where it will appear, a weight for determining where it appears in relation to other panels with the same placement and a path to JSP / HTML fragment to include.
Before the panel is rendered, {@link #isAvailable(HttpServletRequest,HttpServletResponse,String)}is called to determine if the panel should be shown in the current context.
A widget consisting of a single <div> element that can accept child widgets. Child widgets may be created within it using {@link #getContainer()} and{@link #getInsertingContainer(Widget)}.
Panel is a container that has specific functionality and structural components that make it the perfect building block for application-oriented user interfaces. The Panel contains bottom and top toolbars, along with separate header, footer and body sections. It also provides built-in expandable and collapsible behavior, along with a variety of prebuilt tool buttons that can be wired up to provide other customized behavior. Panels can be easily dropped into any Container or layout, and the layout and rendering pipeline is completely managed by the framework.
@author Sanjiv Jivan
The Panel class is a helper class for a graphical component that consists of an outer frame and the content where the drawing is done. The panel can furthermore have up to four labels that can be added to the top, the bottom, the left and the right side of the content. Adding those labels is done by setting their height (top and bottom label) or their width respectively (right and left label).
@author jarontec gmail com
@version 1.2
@since 1.0
Panel is the simplest container class. A panel provides space in which an application can attach any other component, including other panels.
The default layout manager for a panel is the FlowLayout layout manager.
@version 1.37, 04/07/06
@author Sami Shaio
@see java.awt.FlowLayout
@since JDK1.0
This is an implementation of the Forte Panel class. It is identical to the JPanel and is included to provide type compatability PM:5/8/07 remove toString() TF:16/8/07 Major overhaul to make compatible with Forte TF:2/10/07 Added the ignoreInvisibleChildren attribute
the $time variable to the panel model panel.getModel().put("time", time); addControl(panel); } } The SimplePanelDemo template, /simple-panel-demo.htm, would reference the panel control:
$panel
The Panel template would then be merged with the Panel model and rendered in the page as:
Time time is now Sun Mar 15 07:32:51 EST 2009
Example 2 - Localization support
In this example, we demonstrate localization support by specifying the Panel content in the SimplePanelDemo.properties file. Since the Panel model and Page model are merged at runtime, the Panel template can access the Page messages. First we create the SimplePanelDemo.properties file which specifies two properties: heading and content.
heading=Welcome content=Welcome to MyCorp<p/>MyCorp is your telecommuting office portal. Its just like being there at the office!
Then we create the /panel/simple-panel.htm that references the localized Page properties. Since a Page properties are made available through the $messages map, the Panel can access the Page properties using the variables $messages.header and $messages.content:
In our page class, SimplePageDemo, we create and add the Panel instance:
public class SimplePanelDemo extends Page { public Panel panel = new Panel("panel", "/panel/simple-panel.htm"); }
In the Page above we make use of Click's autobinding feature by declaring a public Panel field. Autobinding will automatically add the Panel to the Page model. The SimplePanelDemo template, /simple-panel-demo.htm, would reference the panel control:
$panel
And the result is:
Example 3 - Reusing and Nesting Panels
Panels provide a good way to create reusable components, and since Panel is a Container it can hold child controls, even other Panels. In this example we create a reusable CustomerPanel which is added to a Border Panel. First we create the /panel/customer-panel.htm template which references the $form variable:
$form
Next up is the CustomerPanel:
public class CustomerPanel extends Panel { private Form form = new Form("form"); public CustomerPanel(String name) { super(name); // We explicitly set the customer panel template setTemplate("/panel/customer-panel.htm"); form.add(new TextField("name"); form.add(new DateField("dateJoined"); form.add(new DoubleField("holdings"); } }
The Border Panel template, /panel/border-panel.htm, will draw a Border around its contents:
Lastly we specify the NestedDemo Page, that creates a Border Panel, and adds CustomerPanel as a child.
public class NestedDemo extends Page { private Panel borderPanel = new Panel("borderPanel", "/panel/border-panel.htm"); private CustomerPanel customerPanel = new CustomerPanel("panel"); public void onInit() { // Add CustomerPanel to the Border panel parentPanel.add(childPanel); // Add border panel to page addControl(parentPanel); } }
The Page template, /nested-demo.htm, would reference the $borderPanel variable:
$borderPanel
Template Model
To render the panel's template, a model is created ( {@link #createTemplateModel()}) which is merged with the template. This model will include the page model values, plus any Panel defined model values, with the Panel's values overriding the Page defined values. In addition a number of predefined values are automatically added to the model. These values include:
attributes - the panel HTML attributes map
context - the Servlet context path, e.g. /mycorp
format - the page {@link Format} object for formatting the display of objects
this - a reference to this panel object
messages - the panel messages bundle
request - the servlet request
response - the servlet request
session - the {@link SessionMap} adaptor for the users HttpSession
Render a panel for tabbedPanel. Examples See the example in {@link TabbedPanel}.
@see TabbedPanel
@s.tag name="panel" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.PanelTag"description="Render a panel for tabbedPanel"
A basic Panel Widget, which can be positioned based on Page XY co-ordinates and is stackable (z-index support). It also provides alignment and centering support and uses a standard module format for it's content, with header, body and footer section support. It can be made modal, and has functionality to hide and focus on different events. The header and footer sections can be modified to allow for button support.
@author sg
Panel is a container that has specific functionality and structural components that make it the perfect building block for application-oriented user interfaces. The Panel contains bottom, top, and foot toolbars, along with separate header, footer and body sections. It also provides built-in collapsible, closable, maximizable, and minimizable behavior, along with a variety of pre-built tool buttons that can be wired up to provide other customized behavior. Panels can be easily embedded into any kind of ZUL component that is allowed to have children or layout component. Panels also provide specific features like float and move. Unlike {@link Window}, Panels can only be floated and moved inside its parent node, which is not using zk.setVParent() function at client side. In other words, if Panel's parent node is an relative position, the floated panel is only inside its parent, not the whole page. The second difference of {@link Window} is that Panel is not an independent IDspace (by implementing {@link IdSpace}), so the ID of each child can be used throughout the panel.
Events: onMove, onOpen, onZIndex, onMaximize, onMinimize, and onClose.
Convenient base class for any Panel implementation. It includes support for hijacking an element sourced from the dom. Creating a new panel including a new element.
{@link #beforeCreatePanelElement()}
{@link #createPanelElement()}
{@link #afterCreatePanelElement()}
{@link #applyStyleName()} Override this to do nothing if this panel hasno initial style.
Create a new panel with an element hijacked from the dom.
{@link #checkElement(Element)} Check that the element is of the correcttype
{@link #beforeCreatePanelElement()}
{@link #setElement( Element from constructor )}
{@link #afterCreatePanelElement()}
{@link #applyStyleName()} Override this to do nothing if this panel hasno initial style.
The initial style of the root element from this panel is taken from {@link #getInitialStyleName()}
@author Miroslav Pokorny (mP)
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.