public final class TWaverUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.ClassLoader |
classLoader |
static int |
CLICK_COUNT_TO_START |
static ErrorHandler |
errorHandler |
Constructor and Description |
---|
TWaverUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
align(java.util.List elements,
int alignType) |
static void |
align(java.util.List elements,
java.lang.String alignType) |
static void |
animateCenterLocation(java.util.Map newCenterLocations)
Changes elements center location animately.
|
static void |
animateCenterLocation(java.util.Map newCenterLocations,
java.lang.Runnable runnable,
int step,
int sleep)
Changes elements center location animately.
|
static void |
animateDelete(TDataBox box,
java.util.List elements)
Deletes elements from data box animately.
|
static void |
animateDelete(TDataBox box,
java.util.List elements,
java.lang.Runnable runnable,
int step,
int sleep)
Deletes elements from data box animately.
|
static void |
animateLocation(java.util.Map newLocations)
Changes elements location animately.
|
static void |
animateLocation(java.util.Map newLocations,
java.lang.Runnable runnable,
int step,
int sleep)
Changes elements location animately.
|
static void |
animateMove(java.util.Iterator iterator,
double xOffset,
double yOffset)
Moves elements location with offset animately.
|
static void |
animateMove(java.util.Iterator iterator,
MovableFilter filter,
double xOffset,
double yOffset,
java.lang.Runnable runnable,
int step,
int sleep)
Moves elements location with offset animately.
|
static void |
animateMove(Node node,
double xOffset,
double yOffset,
java.lang.Runnable runnable)
Moves node location with offset animately.
|
static void |
animateResize(java.util.Map newBounds)
Resizes elements bounds animately.
|
static void |
animateResize(java.util.Map newBounds,
java.lang.Runnable runnable,
int step,
int sleep)
Resizes elements bounds animately.
|
static void |
appendImage(SVGContext context,
java.lang.StringBuffer sb,
java.lang.String url,
java.awt.Color color,
java.awt.Rectangle bounds,
float alpha)
Append image svg segment to the given stringbuffer.
|
static void |
centerWindow(java.awt.Component component)
Centers the given window to user screen.
|
static void |
clearImageIconCache()
Clears imageIcon Cache.
|
static void |
clearInvalidURLCache()
Clears invalid URL Cache.
|
static Element |
cloneElement(Element source,
boolean withElementId)
Clone the specified elemenet with all of the element's descendant
|
static int |
compare(java.lang.String source,
java.lang.String target)
Compares the source string to the target string according to the
collation rules for the collator with the twaver's locale.
|
static java.io.InputStream |
convertEncoding(java.io.InputStream in,
java.lang.String sourceEncoding,
java.lang.String destEncoding)
Convert encoding for the input stream from source encoding to dest encoding.
|
static javax.swing.ImageIcon |
createBallIcon(int width,
int height,
java.awt.Color lightColor,
java.awt.Color fillColor,
java.awt.Color outlineColor)
Create a circle shape icon
|
static java.beans.BeanInfo |
createBeanInfo(java.lang.Class elementClass,
java.util.List attributes)
Create a bean info by given element class type and a list of
attributes.
|
static java.awt.Cursor |
createCustomCursor(java.awt.Image cursorImage,
java.awt.Point hotSpot,
java.lang.String name)
Creates a customized cursor with the specifed image, hos spot and name.
|
static java.awt.BasicStroke |
createDashStroke(int width)
Creates a default dash stroke in the specified stroke width
|
static java.awt.Image |
createDisabledImage(java.awt.Image image)
Creates a disabled image from the given image object.
|
static javax.swing.ImageIcon |
createDisabledImage(java.lang.String url)
Creates a disabled image from the given url of image.
|
static javax.swing.ImageIcon |
createDistortedImage(java.awt.Image image,
double x0,
double y0,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Create a distorted image.
|
static java.awt.image.BufferedImage |
createDropShadow(java.awt.Image image,
int offset) |
static java.awt.image.BufferedImage |
createDropShadow(java.awt.Image image,
int offset,
java.awt.Color renderColor,
float shadowOpacity) |
static java.util.List |
createElementAttributes(java.lang.Class elementClass,
java.io.InputStream inputStream)
Creates a list of element attributes from the specified xml inputStream.
|
static javax.swing.JComboBox |
createEnumComboBox(java.lang.String enumTypeName,
boolean nullable,
java.lang.String alignment) |
static java.awt.Paint |
createGradientPaint(int gradientType,
java.awt.Rectangle bounds,
java.awt.Color gradientColor,
java.awt.Color fillColor) |
static java.awt.LayoutManager |
createHorizontalLayout(int gap)
Creates a horizontal LayoutManager instance.
|
static javax.swing.JPanel |
createHorizontalPanel(int gap)
Creates a panel with a horizontal LayoutManager.
|
static javax.swing.ImageIcon |
createIcon(int width,
int height,
java.awt.Color lightColor,
java.awt.Color fillColor,
java.awt.Color outlineColor,
int shapeType,
int gradientType)
Create an image icon by given information.
|
static javax.swing.JFileChooser |
createImageFileChooser()
Creates a JFileChooser object with file filters that
display image formats that supported by current JDK.
|
static java.lang.Object |
createNewInstance(java.lang.String className)
Create a new instance from the specified className,
the className is the fully qualified name of the desired class,
or is the fully qualified name with constructor params.
|
static java.beans.PropertyDescriptor |
createPropertyDescriptor(java.lang.Class elementClass,
ElementAttribute attribute)
Create property descriptor by given class type and attribute.
|
static javax.swing.ImageIcon |
createRectIcon(int width,
int height,
java.awt.Color lightColor,
java.awt.Color darkColor,
java.awt.Color outlineColor)
Create a rectangle shape icon by given information.
|
static javax.swing.ImageIcon |
createShadowImage(java.awt.Image image)
Creates shadow image
|
static javax.swing.ImageIcon |
createShadowImage(java.awt.Image image,
int fadeSpeed)
Creates shadow image
|
static java.awt.Shape |
createShape(int type,
java.awt.Rectangle bounds) |
static java.awt.BasicStroke |
createStroke(int width)
Create a stroke in specified width.
|
static java.awt.Paint |
createTexturePaint(java.lang.String textureType,
java.awt.Color color) |
static java.awt.LayoutManager |
createVerticalLayout(int gap)
Creates a vertical LayoutManager instance.
|
static javax.swing.JPanel |
createVerticalPanel(int gap)
Creates a panel with a vertical LayoutManager.
|
static byte[] |
decodeBase64Buffer(byte[] data)
Decodes the specified byte array
|
static java.util.List |
divideShape(java.awt.Shape shape,
int count) |
static boolean |
doLayout(java.util.Iterator elements,
int layoutType,
java.lang.Runnable runnable,
int xOffset,
int yOffset,
Generator elementSizeGenerator)
Calls this method to make given elements to do auto layout on the network canvas.
|
static void |
drawDashLine(java.awt.Graphics2D g,
java.awt.Point point1,
java.awt.Point point2,
double zoom)
Draw a dash line
|
static void |
drawDashRectangle(java.awt.Graphics2D g,
java.awt.Point point1,
java.awt.Point point2,
double zoom)
Draw a dash rectangle on graphics
|
static void |
drawDashRectangle(java.awt.Graphics2D g,
java.awt.Rectangle rect,
double zoom)
Draw a dash rectangle on graphics.
|
static void |
drawDashRound(java.awt.Graphics2D g,
java.awt.Point point1,
java.awt.Point point2,
double zoom)
Draw a dash round rectangle on the graphics.
|
static void |
drawDashShape(java.awt.Graphics2D g,
java.awt.Shape shape)
Draw shape in dash on graphics
|
static void |
drawShapeInAntialias(java.awt.Graphics g,
java.awt.Shape shape)
Draw a shape on the graphics in antialias mode
|
static void |
drawString(java.lang.String content,
java.awt.Graphics2D g2,
double x,
double y,
double angle)
Draw a string on graphics with given parameters.
|
static java.lang.String |
encodeBase64Buffer(byte[] data)
Encodes byte array into string.
|
static boolean |
exportImage(java.awt.Component component)
Exports component into image file.
|
static boolean |
exportImage(java.awt.Component component,
javax.swing.JFileChooser chooser)
Exports component into image file with the specified file chooser.
|
static boolean |
exportImage(java.awt.Component component,
java.io.OutputStream outputStream,
java.lang.String formatName,
double zoom,
java.awt.Rectangle logicalBounds)
Exports component into output stream with the specified image format, zoom factor and logical bounds.
|
static boolean |
exportImage(java.awt.Component component,
java.lang.String fileName,
java.lang.String formatName)
Exports component into image file with the specified file name and image format.
|
static boolean |
exportImage(java.awt.Component component,
java.lang.String fileName,
java.lang.String formatName,
double zoom,
java.awt.Rectangle logicalBounds)
Exports component into image file with the specified file name, image format, zoom factor and logical bounds.
|
static boolean |
exportToImageIcon(java.awt.Component component,
java.lang.String iconUrl,
java.lang.String formatName) |
static boolean |
exportToImageIcon(java.awt.Component component,
java.lang.String iconUrl,
java.lang.String formatName,
double zoom,
java.awt.Rectangle logicalBounds) |
static void |
fillShapeInAntialias(java.awt.Graphics g,
java.awt.Shape shape)
Fill a shape in antialias mode on the graphics.
|
static java.util.List |
filterMovingElements(java.util.Iterator iterator)
Filters out moving elements.
|
static java.lang.Class |
forName(java.lang.String className,
java.lang.String defaultPath)
Load class by given class name from given location.
|
static void |
fullScreen(java.awt.Window window)
Calls this method to enlarge given window to
the full screen size (not maximized).
|
static java.awt.Window |
getActiveWindow()
Gets current active window.
|
static java.util.List |
getAllBeanInfo(java.lang.Class elementClass)
Gets all bean info of the specified element class.
|
static java.util.Map |
getAllDeclaredMethod(java.lang.Class clazz)
Get all declared methods for a class.
|
static void |
getAllDescendant(Element element,
java.util.List list)
Get all descendant of the specified element
and insert all descendant into the specified list.
|
static double |
getAngle(java.awt.Point p1,
java.awt.Point p2)
Figure out the angle of two points.
|
static int |
getAnimateSleep()
Gets the default animate sleep interval.
|
static int |
getAnimateStep()
Gets the default animate step size.
|
static java.beans.BeanInfo |
getBeanInfo(java.lang.Class elementClass,
java.lang.String url)
Gets bean info of the specified element class
from the specified url of xml file.
|
static java.lang.reflect.Method |
getBocpReadMethod()
Gets the read method of business object's client property.
|
static java.lang.reflect.Method |
getBocpWriteMethod()
Gets the write method of business object's client property.
|
static java.util.List |
getBundledLinks(Node node1,
Node node2)
Gets bundled links between node1 and node2.
|
static byte[] |
getByteArrayFromImage(java.awt.Image image,
java.lang.String formatName)
Convert given image object to a byte array in
specified image format name.
|
static byte[] |
getByteArrayFromInputStream(java.io.InputStream in)
Convert input stream resource into a byte array.
|
static byte[] |
getByteArrayFromURL(java.lang.String url)
Convert url specified resource into a byte array.
|
static java.lang.String |
getClassNameWithoutPackage(java.lang.Class clazz)
Get a class name without package.
|
static java.lang.String |
getColorHexString(java.awt.Color c,
boolean isAlpha) |
static java.util.List |
getCopyElements()
Gets a list contains all copied elements.
|
static boolean |
getCurrentBlinkFlag()
Gets the current blinking flag.
|
static java.lang.String |
getCurrentLocalTime()
Gets current local time in string format.
|
static java.lang.String |
getDataBoxVersion()
Gets the default data box version string.
|
static java.lang.String |
getDataBoxVersion(java.lang.String xmlData)
Gets the version information of data box from xml data of topology.
|
static DataLoader |
getDataLoader()
Get TWaver data loader instance.
|
static double |
getDiagonalLength(java.awt.Rectangle rect)
Figure out the length of specified rectangle.
|
static double |
getDistance(double x1,
double y1,
double x2,
double y2) |
static double |
getDistance(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2) |
static java.util.List |
getElementsLogicalAt(TNetwork network,
int x,
int y) |
static java.util.List |
getElementsLogicalAt(TNetwork network,
int x,
int y,
boolean selectable) |
static TSubNetwork |
getElementSubNetwork(Element element)
Gets the subnetwork the element located.
|
static ExportValuesInterceptor |
getExportValuesInterceptor()
Gets the ExportValuesInterceptor object.
|
static java.awt.Font |
getFont(int style)
Gets TWaver default text font by given font style.
|
static java.awt.Font |
getFont(int style,
float size)
Gets TWaver default text font by given font style and font size.
|
static Generator |
getI18nGenerator()
Get i18n string generator for TWaver.
|
static javax.swing.Icon |
getIcon(java.lang.String url)
Gets an Icon object from TWaver image cache by a url.
|
static java.lang.Object |
getIdentifier(java.lang.Object object)
Create an ID for given object by TWaver ID factory.
|
static IdentifierFactory |
getIdentifierFactory()
Get the element ID generator.
|
static java.awt.Image |
getImage(java.lang.String url)
The same to getImageIcon method.
|
static javax.swing.ImageIcon |
getImageIcon(java.lang.String url)
Gets an image icon from TWaver image cache by an given url.
|
static javax.swing.ImageIcon |
getImageIcon(java.lang.String url,
boolean handleError)
Gets an image icon from TWaver image cache by an given url.
|
static javax.swing.ImageIcon |
getImageIcon(java.lang.String url,
java.awt.Color color)
Gets the dyed ImageIcon object by a given url and color.
|
static java.awt.Shape |
getImageShape(java.lang.String url)
Get the url specified image's opaque edge shape.
|
static java.lang.String |
getInformation() |
static java.io.InputStream |
getInputStream(java.lang.String url)
Create an input stream object by given url.
|
static java.io.InputStream |
getInputStream(java.lang.String url,
boolean handleError)
Create an input stream object by given url.
|
static double |
getLength(java.awt.Shape shape)
Gets the length of the shape.
|
static java.util.Locale |
getLocale()
Gets the current TWaver locale setting.
|
static int |
getPasteOffset()
Gets the offset for every pasted element.
|
static PixelFilter |
getPixelFilter() |
static java.lang.String |
getPropertyName(java.beans.PropertyChangeEvent e)
Digs out property name from the given property change event.
|
static java.awt.Color |
getRandomAlphaColor()
Create random color with a random alpha value
|
static boolean |
getRandomBool()
Get a random boolean value.
|
static java.lang.Boolean |
getRandomBoolean()
Create a random Boolean object
|
static java.awt.Color |
getRandomColor()
Create a random color.
|
static double |
getRandomDouble()
Create a random double number.
|
static float |
getRandomFloat()
Get a random float number.
|
static double |
getRandomGaussian()
Get random gaussion
|
static int |
getRandomInt(int max)
Create a random integer number.
|
static long |
getRandomLong()
Get a random long number.
|
static AlarmSeverity |
getRandomNonClearedSeverity()
Get a random alarm severity, not include
AlarmSeverity.CLEARED . |
static java.awt.Point |
getRandomPoint(int max) |
static AlarmSeverity |
getRandomSeverity()
Generate a random alarm severity.
|
static java.awt.Rectangle |
getRectangle(java.util.List points)
Gets a rectangle object that contains all points in the specified list.
|
static java.awt.Rectangle |
getRectangle(java.awt.Point p1,
java.awt.Point p2)
Get a rectangle between p1 and p2
|
static java.lang.Class |
getResourceAgent()
Gets resource agent class.
|
static java.lang.String |
getResourceAgentURL()
Get the url for resource agent
|
static java.lang.String |
getString(java.lang.String key)
Get a i18n translated string by a i18n key.
|
static java.awt.Rectangle |
getTextBounds(java.lang.String text,
java.awt.Font font)
Gets given text's bounds by given font.
|
static int |
getTextOffset(java.lang.String content,
java.awt.Font font,
java.awt.Graphics2D g2d)
Gets text offset on a graphics.
|
static java.awt.Dimension |
getTextSize(java.lang.String content,
java.awt.Font font,
java.awt.Graphics2D g2d)
Gets a string text dimension on a graphics.
|
static java.lang.String |
getTimeLocalString(java.util.Date date)
Gets given time string in local format.
|
static java.lang.String |
getVersionString()
Gets the string version information of twaver.
|
static java.awt.Window |
getWindowForComponent(java.awt.Component component)
Returns the specified component's window.
|
static XMLInterceptor |
getXMLInterceptor()
Gets the XMLInterceptor object.
|
static void |
handleError(java.lang.String errorMessage,
java.lang.Throwable exception)
This method is called when a error has been caught.
|
static void |
init(java.util.Locale locale,
java.lang.Class resourceAgent)
Initialize TWaver with given locale and resource agent.
|
static boolean |
isBundledLinksExpand(Node node1,
Node node2) |
static boolean |
isConnected(Node node1,
Node node2)
Check whether the two nodes is connected via link.
|
static boolean |
isEnableAutoScroll()
Check whether auto scroll is enabled now.
|
static boolean |
isGrayImageBeforeDyed()
Determines whether to gray image before dye it.
|
static boolean |
isImageIconCached(java.lang.String url)
Check whether image icon has been cached with the url.
|
static boolean |
isPermissionGIS() |
static boolean |
isPointOnLine(double px,
double py,
double x1,
double y1,
double x2,
double y2,
double width) |
static boolean |
isUpdateFollowerLocationWithHost() |
static boolean |
isXMLOutputting()
Checks whether TWaver is outputting databox to XML now.
|
static boolean |
isXMLParsing()
Checks whether TWaver is parsing a XML now.
|
static void |
iteratorComponent(java.awt.Component c,
ComponentCallbackHandler handler)
Iterates the specified component and its children recursively.
|
static void |
layoutElements(java.util.List elements,
java.awt.Shape shape)
Layout elements on specified shape with proportional spacing.
|
static void |
layoutElements(java.util.List elements,
java.awt.Shape shape,
boolean animate)
Layout elements on specified shape with proportional spacing.
|
static void |
layoutElements(java.util.List elements,
java.awt.Shape shape,
boolean animate,
java.lang.Runnable runnable)
Layout elements on specified shape with proportional spacing.
|
static void |
main(java.lang.String[] args)
Calls this to popup a message dialog to display TWaver version information.
|
static void |
moveElements(java.util.Iterator iterator,
MovableFilter filter,
double xOffset,
double yOffset)
Calls this method to move specified elements by given x offset and y offset.
|
static void |
native2ascii(java.lang.String fromFile,
java.lang.String toFile)
Convert a file from native to ascii format.
|
static java.lang.String |
outputXML(Element element,
boolean withElementId)
output the specified element with all of the element's descendant to xml string.
|
static void |
outputXML(java.lang.String fileName,
Element element,
boolean withElementId)
output the specified element and all of the element's descendant to xml file.
|
static void |
paintIcon(java.awt.Color lightColor,
java.awt.Color fillColor,
java.awt.Color outlineColor,
int shapeType,
int gradientType,
java.awt.Rectangle bounds,
java.awt.Graphics2D g2d)
Paint a icon with specified params.
|
static void |
registerBeanInfo(java.lang.Class elementClass,
java.beans.BeanInfo beanInfo)
Registers the specified element class with the specified bean info.
|
static void |
registerBeanInfo(java.lang.Class elementClass,
java.io.InputStream inputStream)
Registers the specified element class with the specified inputStream.
|
static void |
registerBeanInfo(java.lang.Class elementClass,
java.util.List attributes)
Registers the specified element class with the specified attributes list.
|
static void |
registerBeanInfo(java.lang.Class elementClass,
java.lang.String xmlURL)
Registers the specified element class with the specified xml url.
|
static void |
registerBeanInfoWithoutDefault(java.lang.Class elementClass)
Registers the specified element class to indicate that this type of element
class will not include the system default properties like: id, name, location,
etc.
|
static void |
registerImageIcon(java.lang.String url,
javax.swing.ImageIcon imageIcon)
Registers an image icon into TWaver cache with an specified url string.
|
static java.lang.String |
replace(java.lang.String inString,
java.lang.String oldPattern,
java.lang.String newPattern)
Replace all occurences of a substring within a string with
another string.
|
static void |
reverseBundledLinksExpand(Link link)
Reverse the expand status of the bundled links between
the specified link's from agent node and to agent node.
|
static void |
saveImageToFile(javax.swing.ImageIcon icon,
java.lang.String fileName,
java.lang.String format)
Saves the image data into the specified file at a specified format.
|
static void |
saveImageToFile(javax.swing.ImageIcon icon,
java.lang.String fileName,
java.lang.String format,
boolean cache)
Saves the image data into the specified file at a specified format.
|
static void |
setAnimateBlinkInterval(int interval)
Sets the minimal animate interval for blinking globally.
|
static void |
setAnimateGIFInterval(int interval)
Sets the minimal animate interval for gif globally.
|
static void |
setAnimateSleep(int animateSleep)
Sets the default animate sleep interval.
|
static void |
setAnimateStep(int animateStep)
Sets the default animate step size
|
static void |
setBocpReadMethod(java.lang.reflect.Method bocpReadMethod)
Sets the read method of business object's client property.
|
static void |
setBocpWriteMethod(java.lang.reflect.Method bocpWriteMethod)
Sets the write method of business object's client property.
|
static void |
setBundledLinksExpand(Node node1,
Node node2,
boolean isExpanded)
Set the expand status of the bundled links
between node1 and node2.
|
static void |
setCopyElements(java.util.List copyElements)
Sets a new list of elements as copied element.
|
static void |
setDataBoxVersion(java.lang.String dataBoxVersion)
Sets the default data box version string.
|
static void |
setDataLoader(DataLoader dataGenerator)
Set data loader for TWaver
|
static void |
setEnableAutoScroll(boolean enabled)
Whether enable mouse auto scroll navigator.
|
static void |
setEnableComponent(java.awt.Component c,
boolean enabled)
Enabling or disabling a Container and
enabling or disabling its children recursively.
|
static void |
setExportValuesInterceptor(ExportValuesInterceptor exportValuesInterceptor)
Sets a new ExportValuesInterceptor object.
|
static void |
setGrayImageBeforeDyed(boolean grayImageBeforeDyed)
Sets whether to gray image before dye it.
|
static void |
setHorizontalAlignment(java.awt.Component component,
java.lang.String alignment)
Sets the alignment of the component contents along the X axis.
|
static void |
setI18nGenerator(Generator generator)
Set the i18n string generator for TWaver.
|
static void |
setIdentifierFactory(IdentifierFactory newIdFactory)
Set the element ID factory.
|
static void |
setLocale(java.util.Locale locale)
Sets current locale for TWaver.
|
static void |
setLookAndFeelWithDefaultFont()
Sets all font value of Swing's UIManager with default font.
|
static void |
setLookAndFeelWithFont(java.awt.Font font)
Sets all font value of Swing's UIManager with specified font.
|
static void |
setNewCardToSlot(TDataBox box,
Slot slot,
Card newCard,
boolean adjustChildrenBounds)
Set a new card to the specified slot and box,
also remove the old card from the slot and box.
|
static void |
setPasteOffset(int pasteOffset)
Sets the offset for every pasted element.
|
static void |
setPixelFilter(PixelFilter pixelFilter) |
static void |
setResourceAgent(java.lang.Class resourceAgent)
Sets resource agent class, twaver will try find resource from the
agent class path first, if not found or the agent class is null
then twaver will try to find in predefined path in /resource/...
|
static void |
setResourceLocateInterceptor(ResourceLocateInterceptor interceptor)
Set resource locate interceptor for TWaver.
|
static void |
setUpdateFollowerLocationWithHost(boolean updateFollowerLocationWithHost) |
static void |
setXMLInterceptor(XMLInterceptor xmlInterceptor)
Sets a new XMLInterceptor object.
|
static javax.swing.JPopupMenu |
showPopupComponet(java.awt.Component popupComponent,
java.awt.Component parent,
java.awt.Point point)
Popup a component on parent component at given location.
|
static void |
stopTaskScheduler() |
static java.awt.BasicStroke |
stringToBasicStroke(java.lang.String strokeDescription)
Convert a string to a BasicStroke object
|
static java.lang.Boolean |
stringToBoolean(java.lang.String value)
convert String to Boolean
|
static java.awt.Color |
stringToColor(java.lang.String value)
convert a string to Color
|
static Direction |
stringToDirection(java.lang.String directionDescription)
Convert a string into a direction object.
|
static java.awt.Font |
stringToFont(java.lang.String value)
convert String to Font
|
static java.awt.Insets |
stringToInsets(java.lang.String insetsDescription)
Convert a string to Insets
|
static java.lang.Object |
stringToObject(java.lang.String value,
java.lang.Class clazz)
conver String to specified class value
|
static byte[] |
toByte(long value,
int size)
Converts long value to byte array.
|
static byte[] |
toByteByGZIP(java.lang.Object object)
serialize object to bytes by gzip.
|
static byte[] |
toBytes(java.lang.Object object)
Serialize an object into byte array.
|
static long |
toLong(byte[] buffer,
int size)
Converts byte array to long value
|
static java.lang.Object |
toObject(byte[] bytes)
Deserialize an object from a byte array.
|
static java.lang.Object |
toObjectByGZIP(byte[] bytes)
deserialize bytes to object by gzip
The ZIP format, which is record-based, is not really suitable for this job.
|
static void |
validateLicense(java.lang.String licenseLocation)
Validate TWaver license from sepcified license location.
|
static java.lang.Integer |
valueOf(int i)
Returns a Integer instance representing the specified
int value.
|
static java.lang.String |
wrapCDATA(java.lang.String text)
Wraps the given string text between "" and "]]>"
|
public static int CLICK_COUNT_TO_START
public static java.lang.ClassLoader classLoader
public static ErrorHandler errorHandler
public static boolean isUpdateFollowerLocationWithHost()
public static void setUpdateFollowerLocationWithHost(boolean updateFollowerLocationWithHost)
public static PixelFilter getPixelFilter()
public static void setPixelFilter(PixelFilter pixelFilter)
public static void handleError(java.lang.String errorMessage, java.lang.Throwable exception)
errorMessage
- A message about the error.exception
- The exception that was caught.errorHandler
public static java.util.List getCopyElements()
setCopyElements(List)
,
TDataBox.copySelection()
,
TDataBox.pasteElements(Element)
public static void setCopyElements(java.util.List copyElements)
copyElements
- a new list of elements as copied element.getCopyElements()
,
TDataBox.copySelection()
,
TDataBox.pasteElements(Element)
public static int getPasteOffset()
public static void setPasteOffset(int pasteOffset)
pasteOffset
- the offset for every pasted element.public static final java.lang.String getVersionString()
public static java.lang.Integer valueOf(int i)
i
- an int
value.public static java.lang.String wrapCDATA(java.lang.String text)
text
- the text to be wrapped.public static java.lang.String getDataBoxVersion(java.lang.String xmlData)
Notice that the version of data box is defferent from twaver.TWaverUtil#getVersionString()
xmlData
- the xml data of topology.TDataBox.getVersion()
public static boolean isXMLParsing()
public static boolean isXMLOutputting()
public static java.util.List getAllBeanInfo(java.lang.Class elementClass)
elementClass
- the element classpublic static java.beans.BeanInfo getBeanInfo(java.lang.Class elementClass, java.lang.String url)
elementClass
- the element classurl
- the url of the xml filepublic static void registerBeanInfoWithoutDefault(java.lang.Class elementClass)
elementClass
- the element classpublic static void registerBeanInfo(java.lang.Class elementClass, java.beans.BeanInfo beanInfo)
elementClass
- the element classbeanInfo
- a BeanInfo objects.public static void registerBeanInfo(java.lang.Class elementClass, java.util.List attributes)
elementClass
- the element classattributes
- a list of ElementAttribute objects.public static void registerBeanInfo(java.lang.Class elementClass, java.lang.String xmlURL)
elementClass
- the element classxmlURL
- the url of xml filepublic static void registerBeanInfo(java.lang.Class elementClass, java.io.InputStream inputStream)
elementClass
- the element classinputStream
- from which twaver can read xml data for element attributes.public static java.awt.Image createDisabledImage(java.awt.Image image)
image
- the given image object to be processedpublic static javax.swing.ImageIcon createDisabledImage(java.lang.String url)
url
- the given url of image.public static java.util.List createElementAttributes(java.lang.Class elementClass, java.io.InputStream inputStream)
elementClass
- the element classinputStream
- the xml input streampublic static void fullScreen(java.awt.Window window)
window
- the window to be enlarged.public static final void centerWindow(java.awt.Component component)
component
- a component contained in the window to be centered.public static final javax.swing.Icon getIcon(java.lang.String url)
url
- the url of image icon.public static void registerImageIcon(java.lang.String url, javax.swing.ImageIcon imageIcon)
url
- the icon urlimage
- icon to be registeredpublic static final javax.swing.ImageIcon getImageIcon(java.lang.String url)
url
- the icon urlpublic static final javax.swing.ImageIcon getImageIcon(java.lang.String url, boolean handleError)
url
- the icon urlhandleError
- whether or not to handle error if can not find image.public static java.awt.Image getImage(java.lang.String url)
url
- the icon urlgetImageIcon(java.lang.String)
public static javax.swing.ImageIcon getImageIcon(java.lang.String url, java.awt.Color color)
url
- the icon urlcolor
- the color used to dye the original image from url.public static void saveImageToFile(javax.swing.ImageIcon icon, java.lang.String fileName, java.lang.String format)
Notice the method will not cache the result, from more information to see #saveImageToFile(ImageIcon, String, String, boolean)
icon
- the image icon.fileName
- the name of the file to be created.format
- the image format to save.public static void saveImageToFile(javax.swing.ImageIcon icon, java.lang.String fileName, java.lang.String format, boolean cache)
icon
- the image icon.fileName
- the name of the file to be created.format
- the image format to save.cache
- True to remember the result, next to save to the save file name,
this method will do nothing.public static final TSubNetwork getElementSubNetwork(Element element)
element
- the element to be located.public static final java.lang.String getCurrentLocalTime()
public static final java.lang.String getTimeLocalString(java.util.Date date)
date
- the date to be translatepublic static java.util.Locale getLocale()
setLocale(Locale)
public static java.lang.Class getResourceAgent()
setResourceAgent(Class)
public static void init(java.util.Locale locale, java.lang.Class resourceAgent)
setLocale(locale); setResourceAgent(resourceAgent);Normally you should call this method in the initial time of your application. Calling this method is not a must.
locale
- the user localeresourceAgent
- the resource agent classpublic static void setLocale(java.util.Locale locale)
locale
- Locale new localepublic static void setResourceAgent(java.lang.Class resourceAgent)
resourceAgent
- new resource agent.getResourceAgent()
public static java.lang.String getString(java.lang.String key)
key
- String i18n keypublic static java.awt.Dimension getTextSize(java.lang.String content, java.awt.Font font, java.awt.Graphics2D g2d)
content
- string contentfont
- text fontg2d
- graphics displaying string textpublic static int getTextOffset(java.lang.String content, java.awt.Font font, java.awt.Graphics2D g2d)
content
- string contentfont
- text fontg2d
- graphics displaying string textpublic static java.awt.Font getFont(int style)
style
- int font stylepublic static java.awt.Font getFont(int style, float size)
style
- int font stylesize
- float font sizepublic static DataLoader getDataLoader()
public static void setDataLoader(DataLoader dataGenerator)
dataGenerator
- DataLoader new data loaderpublic static IdentifierFactory getIdentifierFactory()
public static void setIdentifierFactory(IdentifierFactory newIdFactory)
newIdFactory
- new IdentifierFactory instance. It can't be null.public static java.lang.Object getIdentifier(java.lang.Object object)
object
- Object object need to be identifiedpublic static java.io.InputStream getInputStream(java.lang.String url)
The syntax of URL
is defined by RFC 2396: Uniform
Resource Identifiers (URI): Generic Syntax, amended by RFC 2732: Format for
Literal IPv6 Addresses in URLs.
url
- String an url string describing the input streampublic static java.io.InputStream getInputStream(java.lang.String url, boolean handleError)
The syntax of URL
is defined by RFC 2396: Uniform
Resource Identifiers (URI): Generic Syntax, amended by RFC 2732: Format for
Literal IPv6 Addresses in URLs.
url
- String an url string describing the input streamwhether
- or not to handle errorpublic static byte[] toByte(long value, int size)
value
- the long value to be convertedsize
- the size of byte arraypublic static long toLong(byte[] buffer, int size)
buffer
- the byte array to be convertedsize
- the size of byte array to counted.public static byte[] getByteArrayFromImage(java.awt.Image image, java.lang.String formatName)
Image
- image objectformatName
- String image format name, such as "gif" or "png".public static byte[] getByteArrayFromURL(java.lang.String url)
url
- String url stringpublic static byte[] getByteArrayFromInputStream(java.io.InputStream in)
in
- the input stream resourcepublic static byte[] toBytes(java.lang.Object object) throws java.io.IOException
object
- Object object to be serializedjava.io.IOException
- any I/O error occurpublic static java.lang.Object toObject(byte[] bytes) throws java.io.IOException, java.lang.ClassNotFoundException
bytes
- byte[] serialized object bytejava.io.IOException
- any I/O error occurjava.lang.ClassNotFoundException
- if class type can not be found.public static byte[] toByteByGZIP(java.lang.Object object) throws java.io.IOException
object
- Object object need to be serializedjava.io.IOException
- any I/O error occurpublic static java.lang.Object toObjectByGZIP(byte[] bytes) throws java.io.IOException, java.lang.ClassNotFoundException
bytes
- byte[] ziped datajava.io.IOException
- any I/O error occurjava.lang.ClassNotFoundException
- if class type can not be foundpublic static java.lang.String getPropertyName(java.beans.PropertyChangeEvent e)
e
- a property change eventpublic static java.awt.BasicStroke stringToBasicStroke(java.lang.String strokeDescription)
value
- String a string desribing a stroke. For instance:
"width|pattern 2|5"public static java.awt.Insets stringToInsets(java.lang.String insetsDescription)
insetsDescription
- String an insets description, like "10|10|10|10"public static Direction stringToDirection(java.lang.String directionDescription)
directionDescription
- String a direction description like "vertical|horizontal"public static java.awt.Font stringToFont(java.lang.String value)
value
- 0|12 (style|size)public static java.awt.Color stringToColor(java.lang.String value)
value
- format like this:
180|180|180 180|180|180|darker 180|180|180|brighter 180|180|180|192
public static java.lang.Boolean stringToBoolean(java.lang.String value)
value
- a string need to convertpublic static java.lang.Object stringToObject(java.lang.String value, java.lang.Class clazz)
value
- a string need to convertclazz
- target class typepublic static void drawString(java.lang.String content, java.awt.Graphics2D g2, double x, double y, double angle)
content
- String text need to drawg2
- Graphics2D graphics objectx
- double x location of the texty
- double y location of the textangle
- double text rotate anglepublic static java.lang.Class forName(java.lang.String className, java.lang.String defaultPath)
className
- String class namedefaultPath
- String class locationpublic static java.lang.String getClassNameWithoutPackage(java.lang.Class clazz)
clazz
- Class a classpublic static java.lang.Object createNewInstance(java.lang.String className)
package com.servasoftware class Person{ public Person(String firstName, String lastName){ //... } } TWaverUtil.createNewInstance("com.servasoftware.Person@eric|lin");
className
- public static void native2ascii(java.lang.String fromFile, java.lang.String toFile) throws java.io.IOException
fromFile
- String source filetoFile
- String destination filejava.io.IOException
- if any I/O exception occurpublic static void setLookAndFeelWithDefaultFont()
public static void setLookAndFeelWithFont(java.awt.Font font)
font
- font objectpublic static final java.awt.Window getWindowForComponent(java.awt.Component component)
component
- Component the Component to check for a windowpublic static java.io.InputStream convertEncoding(java.io.InputStream in, java.lang.String sourceEncoding, java.lang.String destEncoding) throws java.io.IOException
in
- InputStream the input stream to be convertsourceEncoding
- String source encodingdestEncoding
- String dest encodingjava.io.IOException
- if any I/O exception occurpublic static java.util.Map getAllDeclaredMethod(java.lang.Class clazz)
clazz
- Class class need to checkpublic static java.lang.String getResourceAgentURL()
public static void setEnableAutoScroll(boolean enabled)
This is apply for all TWaver components (network, tree, table ...)
enabled
- boolean true to enable auto scroll, false otherwise.isEnableAutoScroll()
public static boolean isEnableAutoScroll()
setEnableAutoScroll(boolean)
public static java.awt.Window getActiveWindow()
public static javax.swing.JPopupMenu showPopupComponet(java.awt.Component popupComponent, java.awt.Component parent, java.awt.Point point)
popupComponent
- Component component to be popupparent
- Component parent componentpoint
- Point popup locationpublic static java.awt.BasicStroke createStroke(int width)
width
- int stroke widthpublic static java.awt.BasicStroke createDashStroke(int width)
width
- int stroke widthpublic static void outputXML(java.lang.String fileName, Element element, boolean withElementId) throws java.io.IOException
fileName
- file nameelement
- element objectwithElementId
- true with element id, false otherwisejava.io.IOException
- if any I/O error occurpublic static java.lang.String outputXML(Element element, boolean withElementId) throws java.io.IOException
element
- element objectwithElementId
- true if with element id, false otherwisejava.io.IOException
- if any I/O error occurpublic static Element cloneElement(Element source, boolean withElementId)
source
- source elementwithElementId
- true if with element id, false otherwisepublic static void setNewCardToSlot(TDataBox box, Slot slot, Card newCard, boolean adjustChildrenBounds)
box
- databoxslot
- the parent slot of all new cardsnewCard
- new cardadjustChildrenBounds
- true will adjust children card bounds, false otherwise.public static void setHorizontalAlignment(java.awt.Component component, java.lang.String alignment)
component
- Component the component need to alignalignment
- String One of the following constants defined in
SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING.public static void drawDashShape(java.awt.Graphics2D g, java.awt.Shape shape)
g
- Graphics2D graphics to be drawnshape
- Shape shape objectpublic static void drawDashLine(java.awt.Graphics2D g, java.awt.Point point1, java.awt.Point point2, double zoom)
g
- Graphics2D graphics objectpoint1
- Point line point 1point2
- Point line point 2zoom
- double zoom factorpublic static void drawDashRectangle(java.awt.Graphics2D g, java.awt.Point point1, java.awt.Point point2, double zoom)
g
- Graphics2D graphics to be drawn onpoint1
- Point rectangle left-top connerpoint2
- Point rectangle right-bottom connerzoom
- double zoom factorpublic static void drawDashRectangle(java.awt.Graphics2D g, java.awt.Rectangle rect, double zoom)
g
- Graphics2D graphics to be drawn onrect
- Rectangle rectangle to be drawnzoom
- double zoom factorpublic static void drawDashRound(java.awt.Graphics2D g, java.awt.Point point1, java.awt.Point point2, double zoom)
g
- Graphics2D graphics to be drawn onpoint1
- Point round rectangle left top connerpoint2
- Point round rectangle right bottom connerzoom
- double zoom factorpublic static double getDiagonalLength(java.awt.Rectangle rect)
rect
- Rectangle rectangle to be figured outpublic static double getAngle(java.awt.Point p1, java.awt.Point p2)
p1
- point 1p2
- point 2public static double getDistance(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
public static double getDistance(double x1, double y1, double x2, double y2)
public static java.awt.Rectangle getRectangle(java.awt.Point p1, java.awt.Point p2)
p1
- point 1p2
- point 2public static boolean isConnected(Node node1, Node node2)
node1
- Node node 1node2
- Node node 2public static java.util.List getBundledLinks(Node node1, Node node2)
node1
- node 1node2
- node 2public static void setBundledLinksExpand(Node node1, Node node2, boolean isExpanded)
node1
- node 1node2
- node 2isExpanded
- true expanded, false closedpublic static void reverseBundledLinksExpand(Link link)
link
- link to be checkisExpanded
- true expanded, false closedpublic static void getAllDescendant(Element element, java.util.List list)
element
- elementlist
- a list for all descendantpublic static java.beans.PropertyDescriptor createPropertyDescriptor(java.lang.Class elementClass, ElementAttribute attribute)
elementClass
- Class element class typeattribute
- ElementAttribute element attributepublic static java.beans.BeanInfo createBeanInfo(java.lang.Class elementClass, java.util.List attributes)
elementClass
- Class element class typeattributes
- List a list for all attributes.public static void paintIcon(java.awt.Color lightColor, java.awt.Color fillColor, java.awt.Color outlineColor, int shapeType, int gradientType, java.awt.Rectangle bounds, java.awt.Graphics2D g2d)
public static javax.swing.ImageIcon createBallIcon(int width, int height, java.awt.Color lightColor, java.awt.Color fillColor, java.awt.Color outlineColor)
width
- int circle widthheight
- int circle heightlightColor
- Color highlight colorfillColor
- Color fill coloroutlineColor
- Color outline colorpublic static javax.swing.ImageIcon createRectIcon(int width, int height, java.awt.Color lightColor, java.awt.Color darkColor, java.awt.Color outlineColor)
width
- int rectangle widthheight
- int rectangle heightlightColor
- Color light color for fill gradientdarkColor
- Color dark color for fill gradientoutlineColor
- Color outline outline colorpublic static javax.swing.ImageIcon createIcon(int width, int height, java.awt.Color lightColor, java.awt.Color fillColor, java.awt.Color outlineColor, int shapeType, int gradientType)
width
- int shape widthheight
- int shape heightlightColor
- Color gradient fill light colorfillColor
- Color fill coloroutlineColor
- Color outline colorshapeType
- int draw shape of the icongradientType
- int fill gradient typepublic static double getRandomDouble()
public static int getRandomInt(int max)
max
- int the bound on the random number to be returned. Must be positive.public static java.awt.Point getRandomPoint(int max)
public static java.awt.Color getRandomColor()
public static java.awt.Color getRandomAlphaColor()
public static java.lang.Boolean getRandomBoolean()
getRandomBool()
public static boolean getRandomBool()
getRandomBoolean()
public static float getRandomFloat()
public static long getRandomLong()
public static double getRandomGaussian()
public static AlarmSeverity getRandomSeverity()
public static AlarmSeverity getRandomNonClearedSeverity()
AlarmSeverity.CLEARED
.public static void setResourceLocateInterceptor(ResourceLocateInterceptor interceptor)
interceptor
- ResourceLocateInterceptor the
resource locate interceptor for TWaver.public static java.awt.Shape getImageShape(java.lang.String url)
url
- String image urlpublic static boolean isImageIconCached(java.lang.String url)
url
- String image url handlerpublic static void fillShapeInAntialias(java.awt.Graphics g, java.awt.Shape shape)
g
- Graphics graphics need to be drawnshape
- Shape shape to be fillpublic static void drawShapeInAntialias(java.awt.Graphics g, java.awt.Shape shape)
g
- Graphics graphics need to be drawnshape
- Shape shape to be drawpublic static java.lang.String replace(java.lang.String inString, java.lang.String oldPattern, java.lang.String newPattern)
inString
- String to examineoldPattern
- String to replacenewPattern
- String to insertpublic static Generator getI18nGenerator()
public static void setI18nGenerator(Generator generator)
generator
- Generator i18n string generator for TWaver.public static void validateLicense(java.lang.String licenseLocation)
"/license.dat" and "http://www.mycompany.com/license.dat" are all legal license locations.
The license must be validated with this method before TWaver is used. Otherwise, TWaver will be treated as a Evaluation License, watermark will be displayed on all TWaver components. Only if the license is validated as a Development License or a Runtime License, the watermark will be removed from all components.
If validation is success, license can be retrieved by
#getLicense, otherwise a RuntimeException
will be thrown.
If you have any questions about TWaver license, please contact TWaver sales representitive or send email to sales@servasoftware.com
licenseLocation
- String a location contains license.#getLicense
public static byte[] decodeBase64Buffer(byte[] data)
data
- the byte array to be decoded.public static java.lang.String encodeBase64Buffer(byte[] data)
data
- the byte array to be encoded.public static void setEnableComponent(java.awt.Component c, boolean enabled)
c
- the containerenabled
- determine enable or notpublic static void iteratorComponent(java.awt.Component c, ComponentCallbackHandler handler)
c
- the specified componenthandler
- the handler to be called while iteration.public static java.awt.LayoutManager createVerticalLayout(int gap)
gap
- the gap between components.public static java.awt.LayoutManager createHorizontalLayout(int gap)
gap
- the gap between components.public static javax.swing.JPanel createVerticalPanel(int gap)
gap
- the gap between components.public static javax.swing.JPanel createHorizontalPanel(int gap)
gap
- the gap between components.public static boolean getCurrentBlinkFlag()
public static void setAnimateBlinkInterval(int interval)
interval
- the minimal animate interval for blinking globally.TNetwork.setBlinkingRule(BlinkingRule)
,
TNetwork.setEnableAnimation(boolean)
public static void setAnimateGIFInterval(int interval)
interval
- the minimal animate interval for gif globally.TNetwork.setEnableAnimation(boolean)
public static boolean exportImage(java.awt.Component component)
component
- the component to be exported.public static boolean exportImage(java.awt.Component component, javax.swing.JFileChooser chooser)
component
- the component to be exported.chooser
- the file chooser.public static boolean exportImage(java.awt.Component component, java.lang.String fileName, java.lang.String formatName)
component
- the component to be exported.fileName
- the exported file name.formatName
- the image format name.public static boolean exportImage(java.awt.Component component, java.lang.String fileName, java.lang.String formatName, double zoom, java.awt.Rectangle logicalBounds)
component
- the component to be exported.fileName
- the exported file name.formatName
- the image format name.zoom
- the zoom factor.logicalBounds
- the logical bounds to be exported.public static boolean exportToImageIcon(java.awt.Component component, java.lang.String iconUrl, java.lang.String formatName)
public static boolean exportToImageIcon(java.awt.Component component, java.lang.String iconUrl, java.lang.String formatName, double zoom, java.awt.Rectangle logicalBounds)
public static boolean exportImage(java.awt.Component component, java.io.OutputStream outputStream, java.lang.String formatName, double zoom, java.awt.Rectangle logicalBounds)
component
- the component to be exported.outputStream
- the output stream to be exported to.formatName
- the image format name.zoom
- the zoom factor.logicalBounds
- the logical bounds to be exported.public static ExportValuesInterceptor getExportValuesInterceptor()
ExportValuesInterceptor
,
Element.copy()
public static void setExportValuesInterceptor(ExportValuesInterceptor exportValuesInterceptor)
exportValuesInterceptor
- a new ExportValuesInterceptor object.ExportValuesInterceptor
,
Element.copy()
public static java.awt.Cursor createCustomCursor(java.awt.Image cursorImage, java.awt.Point hotSpot, java.lang.String name)
cursorImage
- the cursor imagehotSpot
- the hot spotname
- the name of the cursorpublic static javax.swing.JFileChooser createImageFileChooser()
public static boolean doLayout(java.util.Iterator elements, int layoutType, java.lang.Runnable runnable, int xOffset, int yOffset, Generator elementSizeGenerator)
elements
- the given elements need to be layoutedtype
- the type of layout effect, Legal values are:
runnable
- the runnable will be called after layouted.xOffset
- the x offsetyOffset
- the y offsetelementSizeGenerator
- the element size generator is used to generate
the element size that will be counted when doing layout.public static int compare(java.lang.String source, java.lang.String target)
Collator.getInstance(java.util.Locale)
,
Collator.compare(java.lang.String, java.lang.String)
public static boolean isGrayImageBeforeDyed()
public static void setGrayImageBeforeDyed(boolean grayImageBeforeDyed)
grayImageBeforeDyed
- True to gray image before dye it, false otherwise.public static void main(java.lang.String[] args)
args
- getVersionString()
public static java.lang.reflect.Method getBocpReadMethod()
public static void setBocpReadMethod(java.lang.reflect.Method bocpReadMethod)
bocpReadMethod
- public static java.lang.reflect.Method getBocpWriteMethod()
public static void setBocpWriteMethod(java.lang.reflect.Method bocpWriteMethod)
bocpWriteMethod
- public static java.lang.String getDataBoxVersion()
TDataBox.getVersion()
public static void setDataBoxVersion(java.lang.String dataBoxVersion)
dataBoxVersion
- TDataBox.setVersion(String)
public static XMLInterceptor getXMLInterceptor()
XMLInterceptor
public static void setXMLInterceptor(XMLInterceptor xmlInterceptor)
xmlInterceptor
- a new XMLInterceptor object.XMLInterceptor
public static java.awt.Rectangle getRectangle(java.util.List points)
points
- a list contains all points.public static boolean isPermissionGIS()
public static java.util.List filterMovingElements(java.util.Iterator iterator)
iterator
- the element to be moved.public static void moveElements(java.util.Iterator iterator, MovableFilter filter, double xOffset, double yOffset)
iterator
- the iterator contains elements to be moved.filter
- the filter used to filte elements that don't need to be moved.xOffset
- the offset of x coordinateyOffset
- the offset of y coordinatepublic static void animateMove(Node node, double xOffset, double yOffset, java.lang.Runnable runnable)
node
- the node to be moved.xOffset
- the x offset.yOffset
- the y offset.runnable
- the runnable will be run after the node is finally moved.public static void animateMove(java.util.Iterator iterator, double xOffset, double yOffset)
iterator
- the elements to be moved.filter
- the movable filter.xOffset
- the x offset.yOffset
- the y offset.public static void animateMove(java.util.Iterator iterator, MovableFilter filter, double xOffset, double yOffset, java.lang.Runnable runnable, int step, int sleep)
iterator
- the elements to be moved.filter
- the movable filter.xOffset
- the x offset.yOffset
- the y offset.runnable
- the runnable will be run after the elements are finally moved.step
- the animate step sizesleep
- the animate sleep intervalpublic static void animateLocation(java.util.Map newLocations)
newLocations
- the map key is element, value is new location.public static void animateLocation(java.util.Map newLocations, java.lang.Runnable runnable, int step, int sleep)
newLocations
- the map key is element, value is new location.runnable
- the runnable will be run after the elements are finally moved.step
- the animate step sizesleep
- the animate sleep intervalpublic static void animateCenterLocation(java.util.Map newCenterLocations)
newCenterLocations
- the map key is element, value is new center location.public static void animateCenterLocation(java.util.Map newCenterLocations, java.lang.Runnable runnable, int step, int sleep)
newCenterLocations
- the map key is element, value is new center location.runnable
- the runnable will be run after the elements are finally moved.step
- the animate step sizesleep
- the animate sleep intervalpublic static void animateResize(java.util.Map newBounds)
newBounds
- the map key is element, value is new bounds.public static void animateResize(java.util.Map newBounds, java.lang.Runnable runnable, int step, int sleep)
newBounds
- the map key is element, value is new bounds.runnable
- the runnable will be run after the elements are finally resized.step
- the animate step sizesleep
- the animate sleep intervalpublic static void animateDelete(TDataBox box, java.util.List elements)
box
- the data box where the elements will be removed from.elements
- the elements to be removed.public static void animateDelete(TDataBox box, java.util.List elements, java.lang.Runnable runnable, int step, int sleep)
box
- the data box where the elements will be removed from.elements
- the elements to be removed.runnable
- the runnable will be run after the elements are finally removed.step
- the animate step sizesleep
- the animate sleep intervalpublic static int getAnimateStep()
public static void setAnimateStep(int animateStep)
animateStep
- the animate step sizepublic static int getAnimateSleep()
public static void setAnimateSleep(int animateSleep)
animateSleep
- the length of time to sleep in milliseconds.public static final void layoutElements(java.util.List elements, java.awt.Shape shape)
elements
- the elements to be layout.shape
- the layout shape.public static final void layoutElements(java.util.List elements, java.awt.Shape shape, boolean animate)
elements
- the elements to be layout.shape
- the layout shape.animate
- whether or not animate.public static final void layoutElements(java.util.List elements, java.awt.Shape shape, boolean animate, java.lang.Runnable runnable)
elements
- the elements to be layout.shape
- the layout shape.animate
- whether or not animate.runnable
- the runnable will be called after layouted.public static final void appendImage(SVGContext context, java.lang.StringBuffer sb, java.lang.String url, java.awt.Color color, java.awt.Rectangle bounds, float alpha)
public static java.awt.Rectangle getTextBounds(java.lang.String text, java.awt.Font font)
public static javax.swing.ImageIcon createShadowImage(java.awt.Image image)
public static javax.swing.ImageIcon createShadowImage(java.awt.Image image, int fadeSpeed)
public static java.awt.image.BufferedImage createDropShadow(java.awt.Image image, int offset)
public static java.awt.image.BufferedImage createDropShadow(java.awt.Image image, int offset, java.awt.Color renderColor, float shadowOpacity)
public static javax.swing.ImageIcon createDistortedImage(java.awt.Image image, double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3)
image
- the original imagex0
- the new position of the top left cornery0
- the new position of the top left cornerx1
- the new position of the top right cornery1
- the new position of the top right cornerx2
- the new position of the bottom right cornery2
- the new position of the bottom right cornerx3
- the new position of the bottom left cornery3
- the new position of the bottom left cornerpublic static void clearInvalidURLCache()
public static void clearImageIconCache()
public static double getLength(java.awt.Shape shape)
public static java.util.List divideShape(java.awt.Shape shape, int count)
public static java.lang.String getColorHexString(java.awt.Color c, boolean isAlpha)
public static java.awt.Shape createShape(int type, java.awt.Rectangle bounds)
public static javax.swing.JComboBox createEnumComboBox(java.lang.String enumTypeName, boolean nullable, java.lang.String alignment)
public static java.awt.Paint createTexturePaint(java.lang.String textureType, java.awt.Color color)
public static java.awt.Paint createGradientPaint(int gradientType, java.awt.Rectangle bounds, java.awt.Color gradientColor, java.awt.Color fillColor)
public static boolean isPointOnLine(double px, double py, double x1, double y1, double x2, double y2, double width)
public static java.lang.String getInformation()
public static void align(java.util.List elements, java.lang.String alignType)
elements
- list of ElementsalignType
- Values are:
public static void align(java.util.List elements, int alignType)
elements
- alignType
- Values are:
TWaverConst.ALIGN_TYPE_***
public static void stopTaskScheduler()
public static java.util.List getElementsLogicalAt(TNetwork network, int x, int y, boolean selectable)
public static java.util.List getElementsLogicalAt(TNetwork network, int x, int y)
Copyright © 2002 - 2010 Serva Software. All Rights Reserved.