Java Doc for UIObject.java in  » Ajax » GWT » com » google » gwt » user » client » ui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » GWT » com.google.gwt.user.client.ui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.google.gwt.user.client.ui.UIObject

All known Subclasses:   com.google.gwt.user.client.ui.MenuItem,  com.google.gwt.user.client.ui.TreeItem,  com.google.gwt.user.client.ui.Widget,
UIObject
abstract public class UIObject (Code)
The superclass for all user-interface objects. It simply wraps a DOM element, and cannot receive events. Most interesting user-interface classes derive from com.google.gwt.user.client.ui.Widget .

Styling With CSS

All UIObject objects can be styled using CSS. Style names that are specified programmatically in Java source are implicitly associated with CSS style rules. In terms of HTML and CSS, a GWT style name is the element's CSS "class". By convention, GWT style names are of the form [project]-[widget].

For example, the Button widget has the style name gwt-Button, meaning that within the Button constructor, the following call occurs:

 setStyleName("gwt-Button");
A corresponding CSS style rule can then be written as follows:
 // Example of how you might choose to style a Button widget 
 .gwt-Button {
 background-color: yellow;
 color: black;
 font-size: 24pt;
 }
Note the dot prefix in the CSS style rule. This syntax is called a CSS class selector.

Style Name Specifics

Every UIObject has a primary style name that identifies the key CSS style rule that should always be applied to it. Use UIObject.setStylePrimaryName(String) to specify an object's primary style name. In most cases, the primary style name is set in a widget's constructor and never changes again during execution. In the case that no primary style name is specified, it defaults to the first style name that is added.

More complex styling behavior can be achieved by manipulating an object's secondary style names. Secondary style names can be added and removed using UIObject.addStyleName(String) and UIObject.removeStyleName(String) . The purpose of secondary style names is to associate a variety of CSS style rules over time as an object progresses through different visual states.

There is an important special formulation of secondary style names called dependent style names. A dependent style name is a secondary style name prefixed with the primary style name of the widget itself. See UIObject.addStyleName(String) for details.





Method Summary
public  voidaddStyleDependentName(String styleSuffix)
     Adds a dependent style name by specifying the style name's suffix.
public  voidaddStyleName(String style)
     Adds a secondary or dependent style name to this object.
public  intgetAbsoluteLeft()
     Gets the object's absolute left position in pixels, as measured from the browser window's client area.
public  intgetAbsoluteTop()
     Gets the object's absolute top position in pixels, as measured from the browser window's client area.
public  ElementgetElement()
     Gets a handle to the object's underlying DOM element.
public  intgetOffsetHeight()
     Gets the object's offset height in pixels.
public  intgetOffsetWidth()
     Gets the object's offset width in pixels.
protected  ElementgetStyleElement()
     Template method that returns the element to which style names will be applied.
protected static  StringgetStyleName(Element elem)
     Gets all of the element's style names, as a space-separated list.
public  StringgetStyleName()
     Gets all of the object's style names, as a space-separated list.
protected static  StringgetStylePrimaryName(Element elem)
     Gets the element's primary style name.
public  StringgetStylePrimaryName()
     Gets the primary style name associated with the object.
public  StringgetTitle()
     Gets the title associated with this object.
native public static  booleanisVisible(Element elem)
    
public  booleanisVisible()
     Determines whether or not this object is visible.
public  voidremoveStyleDependentName(String styleSuffix)
     Removes a dependent style name by specifying the style name's suffix.
public  voidremoveStyleName(String style)
     Removes a style name.
protected  voidsetElement(Element elem)
     Sets this object's browser element.
public  voidsetHeight(String height)
     Sets the object's height.
public  voidsetPixelSize(int width, int height)
     Sets the object's size, in pixels, not including decorations such as border, margin, and padding.
public  voidsetSize(String width, String height)
     Sets the object's size.
protected static  voidsetStyleName(Element elem, String styleName)
     Clears all of the element's style names and sets it to the given style.
protected static  voidsetStyleName(Element elem, String style, boolean add)
     This convenience method adds or removes a style name for a given element. This method is typically used to add and remove secondary style names, but it can be used to remove primary stylenames as well, but that is not recommended.
public  voidsetStyleName(String style)
     Clears all of the object's style names and sets it to the given style.
protected static  voidsetStylePrimaryName(Element elem, String style)
     Sets the element's primary style name and updates all dependent style names.
public  voidsetStylePrimaryName(String style)
     Sets the object's primary style name and updates all dependent style names.
public  voidsetTitle(String title)
     Sets the title associated with this object.
native public static  voidsetVisible(Element elem, boolean visible)
    
public  voidsetVisible(boolean visible)
     Sets whether this object is visible.
public  voidsetWidth(String width)
     Sets the object's width.
public  voidsinkEvents(int eventBitsToAdd)
     Adds a set of events to be sunk by this object.
public  StringtoString()
     This method is overridden so that any object can be viewed in the debugger as an HTML snippet.
public  voidunsinkEvents(int eventBitsToRemove)
     Removes a set of events from this object's event list.



Method Detail
addStyleDependentName
public void addStyleDependentName(String styleSuffix)(Code)
Adds a dependent style name by specifying the style name's suffix. The actual form of the style name that is added is:
 getStylePrimaryName() + '-' + styleSuffix
 

Parameters:
  styleSuffix - the suffix of the dependent style to be added.
See Also:   UIObject.setStylePrimaryName(String)
See Also:   UIObject.removeStyleDependentName(String)
See Also:   UIObject.addStyleName(String)



addStyleName
public void addStyleName(String style)(Code)
Adds a secondary or dependent style name to this object. A secondary style name is an additional style name that is, in HTML/CSS terms, included as a space-separated token in the value of the CSS class attribute for this object's root element.

The most important use for this method is to add a special kind of secondary style name called a dependent style name. To add a dependent style name, use UIObject.addStyleDependentName(String) , which will prefix the 'style' argument with the result of UIObject.getStylePrimaryName() (followed by a '-'). For example, suppose the primary style name is gwt-TextBox. If the following method is called as obj.setReadOnly(true):

 public void setReadOnly(boolean readOnly) {
 isReadOnlyMode = readOnly;
 // Create a dependent style name.
 String readOnlyStyle = "readonly";
 if (readOnly) {
 addStyleDependentName(readOnlyStyle);
 } else {
 removeStyleDependentName(readOnlyStyle);
 }
 }

then both of the CSS style rules below will be applied:

 // This rule is based on the primary style name and is always active.
 .gwt-TextBox {
 font-size: 12pt;
 }
 // This rule is based on a dependent style name that is only active
 // when the widget has called addStyleName(getStylePrimaryName() +
 // "-readonly").
 .gwt-TextBox-readonly {
 background-color: lightgrey;
 border: none;
 }

Dependent style names are powerful because they are automatically updated whenever the primary style name changes. Continuing with the example above, if the primary style name changed due to the following call:

setStylePrimaryName("my-TextThingy");

then the object would be re-associated with following style rules, removing those that were shown above.

 .my-TextThingy {
 font-size: 20pt;
 }
 .my-TextThingy-readonly {
 background-color: red;
 border: 2px solid yellow;
 }

Secondary style names that are not dependent style names are not automatically updated when the primary style name changes.


Parameters:
  style - the secondary style name to be added
See Also:   UIObject
See Also:   UIObject.removeStyleName(String)



getAbsoluteLeft
public int getAbsoluteLeft()(Code)
Gets the object's absolute left position in pixels, as measured from the browser window's client area. the object's absolute left position



getAbsoluteTop
public int getAbsoluteTop()(Code)
Gets the object's absolute top position in pixels, as measured from the browser window's client area. the object's absolute top position



getElement
public Element getElement()(Code)
Gets a handle to the object's underlying DOM element. the object's browser element



getOffsetHeight
public int getOffsetHeight()(Code)
Gets the object's offset height in pixels. This is the total height of the object, including decorations such as border, margin, and padding. the object's offset height



getOffsetWidth
public int getOffsetWidth()(Code)
Gets the object's offset width in pixels. This is the total width of the object, including decorations such as border, margin, and padding. the object's offset width



getStyleElement
protected Element getStyleElement()(Code)
Template method that returns the element to which style names will be applied. By default it returns the root element, but this method may be overridden to apply styles to a child element. the element to which style names will be applied



getStyleName
protected static String getStyleName(Element elem)(Code)
Gets all of the element's style names, as a space-separated list.
Parameters:
  elem - the element whose style is to be retrieved the objects's space-separated style names



getStyleName
public String getStyleName()(Code)
Gets all of the object's style names, as a space-separated list. If you wish to retrieve only the primary style name, call UIObject.getStylePrimaryName() . the objects's space-separated style names
See Also:   UIObject.getStylePrimaryName()



getStylePrimaryName
protected static String getStylePrimaryName(Element elem)(Code)
Gets the element's primary style name.
Parameters:
  elem - the element whose primary style name is to be retrieved the element's primary style name



getStylePrimaryName
public String getStylePrimaryName()(Code)
Gets the primary style name associated with the object. the object's primary style name
See Also:   UIObject.setStyleName(String)
See Also:   UIObject.addStyleName(String)
See Also:   UIObject.removeStyleName(String)



getTitle
public String getTitle()(Code)
Gets the title associated with this object. The title is the 'tool-tip' displayed to users when they hover over the object. the object's title



isVisible
native public static boolean isVisible(Element elem)(Code)



isVisible
public boolean isVisible()(Code)
Determines whether or not this object is visible. true if the object is visible



removeStyleDependentName
public void removeStyleDependentName(String styleSuffix)(Code)
Removes a dependent style name by specifying the style name's suffix.
Parameters:
  styleSuffix - the suffix of the dependent style to be removed
See Also:   UIObject.setStylePrimaryName(Element,String)
See Also:   UIObject.addStyleDependentName(String)
See Also:   UIObject.addStyleName(String)



removeStyleName
public void removeStyleName(String style)(Code)
Removes a style name. This method is typically used to remove secondary style names, but it can be used to remove primary stylenames as well. That use is not recommended.
Parameters:
  style - the secondary style name to be removed
See Also:   UIObject.addStyleName(String)



setElement
protected void setElement(Element elem)(Code)
Sets this object's browser element. UIObject subclasses must call this method before attempting to call any other methods. If the browser element has already been set, then the current element's position is located in the DOM and removed. The new element is added into the previous element's position.
Parameters:
  elem - the object's new element



setHeight
public void setHeight(String height)(Code)
Sets the object's height. This height does not include decorations such as border, margin, and padding.
Parameters:
  height - the object's new height, in CSS units (e.g. "10px", "1em")



setPixelSize
public void setPixelSize(int width, int height)(Code)
Sets the object's size, in pixels, not including decorations such as border, margin, and padding.
Parameters:
  width - the object's new width, in pixels
Parameters:
  height - the object's new height, in pixels



setSize
public void setSize(String width, String height)(Code)
Sets the object's size. This size does not include decorations such as border, margin, and padding.
Parameters:
  width - the object's new width, in CSS units (e.g. "10px", "1em")
Parameters:
  height - the object's new height, in CSS units (e.g. "10px", "1em")



setStyleName
protected static void setStyleName(Element elem, String styleName)(Code)
Clears all of the element's style names and sets it to the given style.
Parameters:
  elem - the element whose style is to be modified
Parameters:
  styleName - the new style name



setStyleName
protected static void setStyleName(Element elem, String style, boolean add)(Code)
This convenience method adds or removes a style name for a given element. This method is typically used to add and remove secondary style names, but it can be used to remove primary stylenames as well, but that is not recommended. See UIObject.setStyleName(String) for a description of how primary and secondary style names are used.
Parameters:
  elem - the element whose style is to be modified
Parameters:
  style - the secondary style name to be added or removed
Parameters:
  add - true to add the given style, falseto remove it



setStyleName
public void setStyleName(String style)(Code)
Clears all of the object's style names and sets it to the given style. You should normally use UIObject.setStylePrimaryName(String) unless you wish to explicitly remove all existing styles.
Parameters:
  style - the new style name
See Also:   UIObject.setStylePrimaryName(String)



setStylePrimaryName
protected static void setStylePrimaryName(Element elem, String style)(Code)
Sets the element's primary style name and updates all dependent style names.
Parameters:
  elem - the element whose style is to be reset
Parameters:
  style - the new primary style name
See Also:   UIObject.setStyleName(Element,String,boolean)



setStylePrimaryName
public void setStylePrimaryName(String style)(Code)
Sets the object's primary style name and updates all dependent style names.
Parameters:
  style - the new primary style name
See Also:   UIObject.addStyleName(String)
See Also:   UIObject.removeStyleName(String)



setTitle
public void setTitle(String title)(Code)
Sets the title associated with this object. The title is the 'tool-tip' displayed to users when they hover over the object.
Parameters:
  title - the object's new title



setVisible
native public static void setVisible(Element elem, boolean visible)(Code)



setVisible
public void setVisible(boolean visible)(Code)
Sets whether this object is visible.
Parameters:
  visible - true to show the object, falseto hide it



setWidth
public void setWidth(String width)(Code)
Sets the object's width. This width does not include decorations such as border, margin, and padding.
Parameters:
  width - the object's new width, in CSS units (e.g. "10px", "1em")



sinkEvents
public void sinkEvents(int eventBitsToAdd)(Code)
Adds a set of events to be sunk by this object. Note that only Widget widgets may actually receive events, but can receive events from all objects contained within them.
Parameters:
  eventBitsToAdd - a bitfield representing the set of events to be addedto this element's event set
See Also:   com.google.gwt.user.client.Event



toString
public String toString()(Code)
This method is overridden so that any object can be viewed in the debugger as an HTML snippet. a string representation of the object



unsinkEvents
public void unsinkEvents(int eventBitsToRemove)(Code)
Removes a set of events from this object's event list.
Parameters:
  eventBitsToRemove - a bitfield representing the set of events to beremoved from this element's event set
See Also:   UIObject.sinkEvents
See Also:   com.google.gwt.user.client.Event



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.