Difference between revisions of "GCube Widgets Library - General guidelines about Portlet StyleSheets"

From Gcube Wiki
Jump to: navigation, search
(gCube GWT Widgets Library (gWL))
(gCube GWT Widgets Library (gWL))
Line 61: Line 61:
 
Using gWL is a straight forward operation, it defines css classes for all GWT Widget, hence you don't need to define css classes anymore for them.
 
Using gWL is a straight forward operation, it defines css classes for all GWT Widget, hence you don't need to define css classes anymore for them.
  
However you should make use of the ''org.gcube.portlets.user.gcubewidgets.client.GCubeFrame'' class as main panel in your entry point class.
+
However you should make use of the ''org.gcube.portlets.user.gcubewidgets.client.GCubePanel'' class as main panel in your entry point class.
  
* the GCubeFrame class constructor can be instanciated in two ways:
+
* the GCubePanel class constructor can be instanciated in two ways:
** GCubeFrame(String helpLink)  
+
** GCubePanel(String helpLink)  
** GCubeFrame(String headerCaption, String helpLink)
+
** GCubePanel(String headerCaption, String helpLink)
  
 
'''Note:'''
 
'''Note:'''
Line 71: Line 71:
  
  
GCubeFrame usage examples:
+
===GCubePanel usage examples:===
 +
 
 +
==== Panel with Header and Caption ====
  
 
<pre>
 
<pre>
Line 78: Line 80:
 
   */
 
   */
 
   public void onModuleLoad() {      
 
   public void onModuleLoad() {      
GCubeFrame mainLayout = new GCubeFrame( "My Header Caption", "http://myporlet-usersguide-url");
+
GCubePanel mainLayout = new GCubePanel( "My Header Caption", "http://myporlet-usersguide-url");
 
         ...
 
         ...
 
         ...
 
         ...
 
</pre>
 
</pre>
 +
 +
gives the following result (panel content is arbitrary):
 +
 +
[[Image:Gcube-panel-s1.jpg]]
 +
 +
==== Panel with Header NO Caption ====
 +
 +
<pre>
 +
  /**
 +
  * This is the entry point method.
 +
  */
 +
  public void onModuleLoad() {    
 +
GCubePanel mainLayout = new GCubePanel("http://myporlet-usersguide-url");
 +
        ...
 +
        ...
 +
</pre>
 +
 +
gives the following result (panel content is arbitrary):
 +
 +
[[Image:Gcube-panel-s2.jpg]]

Revision as of 15:53, 23 December 2009

gCube GWT Widgets Library (gWL)

gWL has been created to uniform the Look & Feel for gCube Portlets using plain GWT (Not GWT-Ext).

Note:

This guide is divided in two parts, in the first part you will learn how to configure/setup you GWT Application to use gWL, in the second one a tutorial will show you how to actually exploit gWL in your GWT Application.

Setup you GWT Application to use gWL

Your existing GWT Portlet needs few changes to make use the of gWL

First Step - Download gWL

You can download the gWL (beta) from here: gWL Download‎

Second Step - Add gWL to your Build Path

Place gCube-Widgets-Library.jar in a convenience folder, we suggest ./lib, and add it to your project build path.

Once the jar file is added in the build path edit your GWT Application configuration file (file.gwt.xml). Add the following:

<module>
   ...
   <!-- inherits gCube Widgets Library  	               -->
   <inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory'/>
   ...
   ...
   ...
 </module>

Third Step - Remove the default GWT style sheet (if any)

edit your GWT Application configuration file (file.gwt.xml). remove or comment the following:

<module>
   ...
      <!-- Inherit the default GWT style sheet.  You can change       -->
      <!-- the theme of your GWT application by uncommenting          -->
      <!-- any one of the following lines.                            -->
      <inherits name='com.google.gwt.user.theme.standard.Standard'/> 
       ....
      <!-- inherits name='com.google.gwt.user.theme.dark.Dark'/ -->
   ...
   ...
   ...
 </module>

You should also remove all the .gwt-* css classes from your portlet css (if any) e.g. .gwt-Button, .gwt-TextBox etc.

You are now ready to use gWL!!

gCube Widgets Library Tutorial

Using gWL is a straight forward operation, it defines css classes for all GWT Widget, hence you don't need to define css classes anymore for them.

However you should make use of the org.gcube.portlets.user.gcubewidgets.client.GCubePanel class as main panel in your entry point class.

  • the GCubePanel class constructor can be instanciated in two ways:
    • GCubePanel(String helpLink)
    • GCubePanel(String headerCaption, String helpLink)

Note: a helpLink parameter must be always passed to the constructor, if you don't have any help url for your portlet just pass an empty String to the constructor. Make sure to edit it once the portlet is deployed in production though.


GCubePanel usage examples:

Panel with Header and Caption

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {	    
	GCubePanel mainLayout = new GCubePanel( "My Header Caption", "http://myporlet-usersguide-url");
        ...
        ...

gives the following result (panel content is arbitrary):

Gcube-panel-s1.jpg

Panel with Header NO Caption

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {	    
	GCubePanel mainLayout = new GCubePanel("http://myporlet-usersguide-url");
        ...
        ...

gives the following result (panel content is arbitrary):

Gcube-panel-s2.jpg