com.ephox.editlive.common
Class CustomImageView

java.lang.Object
  extended by javax.swing.text.View
      extended by com.ephox.editlive.java2.editor.views.EphoxView
          extended by com.ephox.editlive.java2.editor.image.EphoxImageView
              extended by com.ephox.editlive.common.CustomImageView
All Implemented Interfaces:
com.ephox.editlive.java2.editor.views.AnnotatableView, com.ephox.editlive.java2.editor.views.CursorChangeView, com.ephox.editlive.java2.editor.views.floating.FloatableView, com.ephox.editlive.util.core.Ferret, SwingConstants

public class CustomImageView
extends com.ephox.editlive.java2.editor.image.EphoxImageView

A basis for creating views based on an image. The base implementation will provide standard image functionality, and work the same as an img tag. This is the publicly supported API for creating image based views.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ephox.editlive.java2.editor.image.EphoxImageView
com.ephox.editlive.java2.editor.image.EphoxImageView.ImageHandler
 
Field Summary
 
Fields inherited from class com.ephox.editlive.java2.editor.image.EphoxImageView
broadcaster, CORNER_LENGTH, DEFAULT_HEIGHT, DEFAULT_WIDTH, failed, height, HEIGHT_FLAG, image, imgLoaded, LINK_FLAG, LOADING_FLAG, RELOAD_FLAG, RELOAD_IMAGE_FLAG, state, SYNC_LOAD_FLAG, width, WIDTH_FLAG
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
CustomImageView(Element elem)
           
CustomImageView(Element elem, boolean enableResizer)
           
 
Method Summary
 URL getImageURL()
          Get the url for the image.
 float getMaximumSpan(int axis)
           
 float getMinimumSpan(int axis)
           
 float getPreferredSpan(int axis)
           
 void paint(Graphics g, Shape a)
          Paint the view.
 void preferenceChanged(View child, boolean width, boolean height)
           
 void setPropertiesFromAttributes()
          Used to keep a cached version of attributes.
 
Methods inherited from class com.ephox.editlive.java2.editor.image.EphoxImageView
changedUpdate, createBackgroundPainter, createBorderPainter, createResizer, getAlignment, getAltText, getAttributes, getBrokenImage, getCurrentAllocation, getCursorFor, getCursorForView, getImage, getIntAttr, getLoadingImageIcon, getNextVisualPositionFrom, getNextVisualPositionFromWhenNorthOrSouth, getNoImageIcon, getPendingImage, getStyleSheet, getToolTipText, getView, getViewAnnotationManager, isCacheValid, isFloated, isOnLeft, loadImage, paintImage, resetCurrentAllocation, safePreferenceChanged, setCropSelection, setParent, setSize, setViewAnnotationManager, updateAnnotationManager, updateImageSize
 
Methods inherited from class com.ephox.editlive.java2.editor.views.EphoxView
modelToView, viewToModel
 
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, forwardUpdate, forwardUpdateToView, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getParent, getResizeWeight, getStartOffset, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, insertUpdate, isVisible, modelToView, modelToView, remove, removeAll, removeUpdate, replace, updateChildren, updateLayout, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomImageView

public CustomImageView(Element elem)

CustomImageView

public CustomImageView(Element elem,
                       boolean enableResizer)
Method Detail

getImageURL

public URL getImageURL()
Get the url for the image. This hook makes it possible to have a custom tag that sources an image from an attribute other than "src" it's attributes. The URL returned by this will be downloaded and used to paint the image.

Overrides:
getImageURL in class com.ephox.editlive.java2.editor.image.EphoxImageView

paint

public void paint(Graphics g,
                  Shape a)
Paint the view.

Overrides:
paint in class com.ephox.editlive.java2.editor.image.EphoxImageView
See Also:
View.paint(Graphics, Shape)

setPropertiesFromAttributes

public void setPropertiesFromAttributes()
Used to keep a cached version of attributes. This method will be called whenever the attributes on the view are changed.

Overrides:
setPropertiesFromAttributes in class com.ephox.editlive.java2.editor.image.EphoxImageView

getMaximumSpan

public float getMaximumSpan(int axis)
Overrides:
getMaximumSpan in class View
See Also:
View.getMaximumSpan(int)

getMinimumSpan

public float getMinimumSpan(int axis)
Overrides:
getMinimumSpan in class View
See Also:
View.getMinimumSpan(int)

getPreferredSpan

public float getPreferredSpan(int axis)
Overrides:
getPreferredSpan in class com.ephox.editlive.java2.editor.image.EphoxImageView
See Also:
View.getPreferredSpan(int)

preferenceChanged

public void preferenceChanged(View child,
                              boolean width,
                              boolean height)
Overrides:
preferenceChanged in class View
See Also:
View.preferenceChanged(View, boolean, boolean)

Copyright (c) 2005-2012 Ephox Pty Ltd. All rights reserved.