swingwtx.swing.editorpanes
Class PlatformBrowserEditorPane

java.lang.Object
  extended byswingwt.awt.Component
      extended byswingwt.awt.Container
          extended byswingwtx.swing.JComponent
              extended byswingwtx.swing.text.JTextComponent
                  extended byswingwtx.swing.editorpanes.PlatformBrowserEditorPane
All Implemented Interfaces:
EditorPane, ImageObserver, MenuContainer

public class PlatformBrowserEditorPane
extends JTextComponent
implements EditorPane

Implementation of a JEditorPane based on a platform component. Under GTK2, the platform component is Mozilla - you can safely remove this class from the build if you want to remove the dependency on Mozilla.


Nested Class Summary
 
Nested classes inherited from class swingwtx.swing.text.JTextComponent
JTextComponent.TextEventHandler
 
Nested classes inherited from class swingwtx.swing.JComponent
JComponent.InternalFrameSelectionListener
 
Field Summary
protected  Document doc
           
protected  java.util.Vector hyperListeners
           
protected  org.eclipse.swt.browser.Browser ppeer
           
protected  java.net.URL pUrl
           
protected  Color selectionColor
           
 
Fields inherited from class swingwtx.swing.text.JTextComponent
caret, iRetVal, pCols, pEditable, pRows, pText, pWordWrap, retVal, selEnd, selStart, view
 
Fields inherited from class swingwtx.swing.JComponent
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, opaque, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap
 
Fields inherited from class swingwt.awt.Container
composite, comps, containerListeners, layout, queuedValidateRequest
 
Fields inherited from class swingwt.awt.Component
actionCommand, actionListeners, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListeners, componentName, consumeAvailableHeight, consumeAvailableWidth, focusable, focusListeners, graphicsConfig, inputMethodListeners, isUserSetFont, keyListeners, layoutModifier, LEFT_ALIGNMENT, LOCK, mouseListeners, mouseMotionListeners, mouseWheelListeners, parent, pBackground, pCursor, pDoubleBuffered, peer, pEnabled, pFont, pForeground, pLayoutData, pLocation, pMaxSize, pMinSize, pPrefSize, pSize, pToolTipText, pVisible, RIGHT_ALIGNMENT, swingWTDefaultActionEventAdapter, swingWTEventAdapter, TOP_ALIGNMENT
 
Fields inherited from interface swingwt.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PlatformBrowserEditorPane()
           
 
Method Summary
 void addHyperlinkListener(HyperlinkListener l)
           
 Dimension calculatePreferredSize()
          Override in subclasses to return the preferred size for a given (non-realised) component.
 int getCaretPosition()
           
 java.lang.String getContentType()
           
 Document getDocument()
           
 EditorKit getEditorKit()
           
 JComponent getJComponent()
           
 Color getSelectionColor()
           
 int getSelectionEnd()
           
 int getSelectionStart()
           
 org.eclipse.swt.widgets.Control getSWTPeer()
          Returns the SWT peer
 java.lang.String getText()
           
 boolean isEditable()
           
protected  void processHyperlinkEvent(java.lang.String location, HyperlinkEvent.EventType eventType)
           
protected  void registerHyperLinkEvents()
          Maps Swing HyperLinkListener events to SWT equivalents for browsers.
 void removeHyperlinkListener(HyperlinkListener l)
           
 void setCaretPosition(int pos)
           
 void setContentType(java.lang.String contentType)
           
 void setDocument(Document newdoc)
           
 void setEditable(boolean b)
           
 void setEditorKit(EditorKit k)
           
 void setPage(java.lang.String url)
           
 void setPage(java.net.URL url)
           
 void setSelectionColor(Color color)
          NOT IMPLEMENTED - Has no meaning in native plaf
 void setSwingWTParent(Container parent)
          Once a parent component receives an "add" call for a child, this being the child, this should be called to tell us to instantiate the peer and load in any cached properties.
 void setText(java.lang.String text)
           
 
Methods inherited from class swingwtx.swing.text.JTextComponent
addInputMethodListener, copy, cut, getCaret, paste, replaceSelection, select, selectAll, setCaret, setSelectedTextColor, setSelectionEnd, setSelectionStart
 
Methods inherited from class swingwtx.swing.JComponent
add, add, add, add, add, addPropertyChangeListener, addPropertyChangeListener, checkInternalFrameChild, dispose, getAccessibleContext, getActionMap, getAutoscrolls, getBorder, getClientProperty, getInputMap, getInsets, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isValidateRoot, paint, paintBackground, paintChildren, paintComponent, paintImmediately, paintImmediately, putClientProperty, remove, remove, removePropertyChangeListener, removePropertyChangeListener, repaint, revalidate, scrollRectToVisible, setActionMap, setAutoscrolls, setBorder, setDoubleBuffered, setInputMap, setMargin, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled
 
Methods inherited from class swingwt.awt.Container
addComponentToLayout, addContainerListener, debug_showContainmentTree, doAdd, doLayout, getComponent, getComponentCount, getComponentOrientation, getComponents, getComposite, getLayout, getMaximumSize, getMinimumSize, getParent, getPreferredSize, invalidate, minimumSize, preferredSize, processContainerEvent, processEvent, queuedValidate, removeAll, removeComponentFromCache, removeContainerListener, setLayout, setLayoutImpl, validate
 
Methods inherited from class swingwt.awt.Component
add, addActionListener, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, componentOnlyDispose, computePreferredSize, contains, contains, createImage, createListenerArrayFromVector, createVolatileImage, dispatchEvent, getActionCommand, getAlignmentX, getAlignmentY, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getListeners, getLocation, getLocationOnScreen, getName, getPeer, getPeerSize, getSize, getSize, getToolkit, getToolTipText, getTreeLock, getWidth, getX, getY, grabFocus, hasFocus, hasSetFont, hide, imageUpdate, inside, isEnabled, isFocusable, isMinimumSizeSet, isShowing, isVisible, processActionEvent, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, processTraverseEvent, registerActionEvents, registerComponentEvents, registerEvents, registerExtendedModifyEvents, registerFocusEvents, registerKeyEvents, registerModifyEvents, registerMouseEvents, registerPaintEvents, registerTraversalEvents, remove, removeActionListener, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, repaint, repaint, repaint, requestFocus, setActionCommand, setAlignmentX, setAlignmentY, setBackground, setBounds, setBounds, setCachedProperties, setComponentOrientation, setComponentRemoved, setCursor, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setHeight, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setToolTipText, setVisible, setWidth, show, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

protected Document doc

hyperListeners

protected java.util.Vector hyperListeners

selectionColor

protected Color selectionColor

pUrl

protected java.net.URL pUrl

ppeer

protected org.eclipse.swt.browser.Browser ppeer
Constructor Detail

PlatformBrowserEditorPane

public PlatformBrowserEditorPane()
Method Detail

addHyperlinkListener

public void addHyperlinkListener(HyperlinkListener l)
Specified by:
addHyperlinkListener in interface EditorPane

calculatePreferredSize

public Dimension calculatePreferredSize()
Description copied from class: Component
Override in subclasses to return the preferred size for a given (non-realised) component. Note that you should use setSize() to whatever this routine returns once called to prevent inconsistency with null layout managers. Also note that this is different from the computePreferredSize() method, which is used for calculating the preferredSize of a realised component (this one is for unrealised components)

Specified by:
calculatePreferredSize in interface EditorPane
Overrides:
calculatePreferredSize in class Component

getCaretPosition

public int getCaretPosition()
Specified by:
getCaretPosition in interface EditorPane
Overrides:
getCaretPosition in class JTextComponent

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in interface EditorPane

getDocument

public Document getDocument()
Specified by:
getDocument in interface EditorPane
Overrides:
getDocument in class JTextComponent

getEditorKit

public EditorKit getEditorKit()
Specified by:
getEditorKit in interface EditorPane

getJComponent

public JComponent getJComponent()
Specified by:
getJComponent in interface EditorPane

getSelectionColor

public Color getSelectionColor()
Specified by:
getSelectionColor in interface EditorPane

getSelectionEnd

public int getSelectionEnd()
Specified by:
getSelectionEnd in interface EditorPane
Overrides:
getSelectionEnd in class JTextComponent

getSelectionStart

public int getSelectionStart()
Specified by:
getSelectionStart in interface EditorPane
Overrides:
getSelectionStart in class JTextComponent

getText

public java.lang.String getText()
Specified by:
getText in interface EditorPane
Overrides:
getText in class JTextComponent

isEditable

public boolean isEditable()
Specified by:
isEditable in interface EditorPane
Overrides:
isEditable in class JTextComponent

removeHyperlinkListener

public void removeHyperlinkListener(HyperlinkListener l)
Specified by:
removeHyperlinkListener in interface EditorPane

setCaretPosition

public void setCaretPosition(int pos)
Specified by:
setCaretPosition in interface EditorPane
Overrides:
setCaretPosition in class JTextComponent

setContentType

public void setContentType(java.lang.String contentType)
Specified by:
setContentType in interface EditorPane

setDocument

public void setDocument(Document newdoc)
Specified by:
setDocument in interface EditorPane
Overrides:
setDocument in class JTextComponent

setEditable

public void setEditable(boolean b)
Specified by:
setEditable in interface EditorPane
Overrides:
setEditable in class JTextComponent

setEditorKit

public void setEditorKit(EditorKit k)
Specified by:
setEditorKit in interface EditorPane

setPage

public void setPage(java.net.URL url)
             throws java.io.IOException
Specified by:
setPage in interface EditorPane
Throws:
java.io.IOException

setPage

public void setPage(java.lang.String url)
             throws java.io.IOException
Specified by:
setPage in interface EditorPane
Throws:
java.io.IOException

setSelectionColor

public void setSelectionColor(Color color)
Description copied from class: JTextComponent
NOT IMPLEMENTED - Has no meaning in native plaf

Specified by:
setSelectionColor in interface EditorPane
Overrides:
setSelectionColor in class JTextComponent

setSwingWTParent

public void setSwingWTParent(Container parent)
                      throws java.lang.Exception
Description copied from class: JTextComponent
Once a parent component receives an "add" call for a child, this being the child, this should be called to tell us to instantiate the peer and load in any cached properties.

Specified by:
setSwingWTParent in interface EditorPane
Overrides:
setSwingWTParent in class JTextComponent
Throws:
java.lang.Exception

setText

public void setText(java.lang.String text)
Specified by:
setText in interface EditorPane
Overrides:
setText in class JTextComponent

registerHyperLinkEvents

protected void registerHyperLinkEvents()
Maps Swing HyperLinkListener events to SWT equivalents for browsers.


processHyperlinkEvent

protected void processHyperlinkEvent(java.lang.String location,
                                     HyperlinkEvent.EventType eventType)

getSWTPeer

public org.eclipse.swt.widgets.Control getSWTPeer()
Description copied from class: Component
Returns the SWT peer

Specified by:
getSWTPeer in interface EditorPane
Overrides:
getSWTPeer in class Component