|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component net.xoetrope.awt.XMetaContent
public class XMetaContent
This component renders XML based content. A simple set of tags for layout and formatting are used. Styles can be used to control attributes such as fonts and colors
For example the following taken from the Xui Zoo sample application shows some formatted paragraphs of text:
Congratulations!
You have just been appointed general manager of the XUI Zoo.
Unfortunately your predescessor wasted most of his time struggling with his Java code. To keep the zoo in business you must buy some new animals quickly. You need to buy 100 animals, including Monkies, Elephants and to get new visitors to the zoo you need to have at least one amazing Unicorn.
Monkies are common enough and only cost 0.05 $XML, Elephants on the other hand are big animals and cost a full 1.00 $XML. And the most rare Unicorns cost the princely sum of 5.00 $XML
Please fill in your order quantities below.
The tag supported by this class are listed below and play a similar role to their html equivalents:
The tags can be nested as you would do whith HTML.
Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected static java.util.Hashtable |
methodTable A table of the method names needed for rendereing each style |
protected XTranslator |
translator |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
XMetaContent() Constructs anew XMetaContent component |
Method Summary | |
---|---|
protected void |
fillMethodTable() Initialises the lookup hash table of handlers for the content. |
java.lang.String |
getContent() Get the meta content's name . |
int |
getContentHeight() Get the calculated height of the content. |
java.awt.Dimension |
getPreferredSize() Get the preferred display size for the component |
java.lang.String |
getSource() Get the source of the current content |
void |
paint(java.awt.Graphics g) Renders the component |
protected boolean |
renderItem(java.awt.Graphics g, XmlElement child, int method) Renders an individual item/tag |
protected void |
renderText(java.awt.Graphics g, java.lang.String text) Renders text content |
void |
setContent(java.lang.String newContent) Set the meta content to a simple string value |
void |
setContent(java.lang.String xmlSrc, XmlElement src) Set the meta content. |
void |
setFileName(java.lang.String fileName) Set the meta content to the content of an xml file |
void |
setPadding(int pad) Sets the padding or indent for the content |
void |
setStyle(java.lang.String style) Set the current style. |
void |
update(java.awt.Graphics g) Performs the actual rendering |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected XTranslator translator
protected static java.util.Hashtable methodTable
Constructor Detail |
---|
public XMetaContent()
Method Detail |
---|
protected void fillMethodTable()
public void setFileName(java.lang.String fileName)
fileName
- the new contentpublic void setContent(java.lang.String xmlSrc, XmlElement src)
setContent
in interface XMetaContentHolder
xmlSrc
- the location from which the xml was obtainedsrc
- the input xmlpublic void setContent(java.lang.String newContent)
newContent
- the new content to displaypublic void setStyle(java.lang.String style)
setStyle
in interface XStyleComponent
style
- the style namepublic java.lang.String getContent()
public java.lang.String getSource()
public void paint(java.awt.Graphics g)
paint
in class java.awt.Component
g
- the graphics contextpublic void update(java.awt.Graphics g)
update
in class java.awt.Component
g
- the graphics contentpublic java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Component
public void setPadding(int pad)
pad
- the amount of padding with which to surround the contentprotected boolean renderItem(java.awt.Graphics g, XmlElement child, int method)
g
- the graphics contextchild
- the xml element being renderedmethod
- the element nameprotected void renderText(java.awt.Graphics g, java.lang.String text)
g
- the graphcis contexttext
- the text contentpublic int getContentHeight()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |