|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel java.applet.Applet javax.swing.JApplet de.caff.dxf.applet.DxfApplet
public class DxfApplet
Running a DXF viewer as an applet. The Applet is able to run in two different modes:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JApplet |
---|
javax.swing.JApplet.AccessibleJApplet |
Nested classes/interfaces inherited from class java.applet.Applet |
---|
java.applet.Applet.AccessibleApplet |
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static java.lang.String |
BT_DISPLAY_FRAME
I18n key for button to show frame. |
static java.lang.String |
DEFAULT_GUI_DESCR
The default GUI description used if none is given. |
static java.lang.String |
ERR_APP_CONFIG_IO
I18n key for i/o error while reading configuration. |
static java.lang.String |
ERR_APP_CONFIG_PARSER
I18n key for SAX parser configuration error. |
static java.lang.String |
ERR_APP_PARSE_READ
I18n key for SAX parser error. |
static java.lang.String |
ERR_NO_SAVE_FORMAT
I18n key for error when saving in unsupported format. |
static java.lang.String |
ERR_RESTRICT_NO_SAVE
I18n kex for error message when trying to save in an restricted environment. |
static double |
FLAT_EPSILON
Epsilon to determine if a file is considered flat. |
static java.lang.String |
FULLNAME
The default name of the applet. |
static java.lang.String |
MAILTO
The default mailto address. |
static java.lang.String |
MI_CLOSE_WINDOW
I18n key for menu action close window. |
static java.lang.String |
PARAM_ADDITIONAL_FONTDIR
Additional font dir. |
static java.lang.String |
PARAM_APPLET_INPAGE
Applet parameter for boolean value whether applet should run inpage. |
static java.lang.String |
PARAM_APPLET_STATE_CALLBACK
Applet state callback. |
static java.lang.String |
PARAM_COOKIES
Cookies to set for any requests to the server. |
static java.lang.String |
PARAM_DEFAULT_BIGFONT
Default bigfont. |
static java.lang.String |
PARAM_DEFAULT_CODEPAGE
Default codepage. |
static java.lang.String |
PARAM_DEFAULT_FONT
Default font. |
static java.lang.String |
PARAM_DXF_FILE
Applet parameter for dxf file(s) to display. |
static java.lang.String |
PARAM_FRAME_HEIGHT
Applet parameter for frame height (only when framed). |
static java.lang.String |
PARAM_FRAME_WIDTH
Applet parameter for frame width (only when framed). |
static java.lang.String |
PARAM_GUI_DESCR
Applet parameter for GUI description file. |
static java.lang.String |
PARAM_LOAD_BACKGROUND
Load DXF file in background? |
static java.lang.String |
PARAM_MODEL_UNIT_LENGTH
Unit length of the model (necessary for scaled printing). |
static java.lang.String |
PARAM_PRINT_FONT
Applet parameter for the font used for showing the file name when printing the view. |
static java.lang.String |
PARAM_PRINT_MODE
Applet parameter defining the printing mode. |
static java.lang.String |
PARAM_PRINT_TO_SCALE
Deprecated. Use PARAM_PRINT_MODE instead |
static java.lang.String |
PARAM_PRINT_VIEW
Applet parameter for printing the view instead of the complete applet. |
static java.lang.String |
PARAM_PRINTER_POINT_SIZE
Parameter for printer point size. |
static java.lang.String |
REVISION
The SVN revision of this file. |
static java.lang.String |
VERSION
The version number of the applet. |
Fields inherited from class javax.swing.JApplet |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface de.caff.dxf.swing.ViewerConstantsSwing |
---|
APP_NAME, DEFAULT_BACKGROUND_COLOR, DEFAULT_MANIPULATOR_COLOR, PROGRESS_CONV_COLOR, PROGRESS_READ_COLOR, PROGRESS_WRITE_COLOR, WEBSITE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DxfApplet()
Constructor. |
Method Summary | |
---|---|
boolean |
canGoBackward()
Is it possible to go a step backward in history? |
boolean |
canGoForward()
Is it possible to go a step forward in history? |
void |
closeFrame()
Hides the frame if it is shown. |
void |
copyViewToClipboard()
Copy the current view as a bitmap image to the system clipboard. |
void |
destroy()
Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated. |
void |
doSave(java.lang.String path,
java.lang.String format)
Save the image in the given format to the given location. |
java.lang.String |
getAppletInfo()
Returns information about this applet. |
SimpleAppletState |
getAppletState()
Get the current applet state. |
int |
getCurrentMatchIndex()
Get the number of matches for the current search text. |
java.awt.Frame |
getDialogParentFrame()
Get a frame to be used as a dialog parent for the write dialog. |
protected java.net.URL |
getGuiDescriptionURL(java.lang.String defaultDescr)
Get the URL describing the GUI. |
java.io.File |
getLastSaveDir()
Get the last dir where something was saved. |
java.lang.String[] |
getLayerNames()
Get the names of the layers in the current model. |
PhysicalLength |
getModelUnit()
Get the currently used model unit. |
int |
getNumberOfSearchMatches()
Get the number of matches for the current search text. |
java.lang.String[][] |
getParameterInfo()
Returns information about the parameters that are understood by this applet. |
java.util.prefs.Preferences |
getPreferences()
Get the preferences access object. |
PrintMode |
getPrintMode()
Get the current print mode. |
java.awt.Color |
getProgressReadColor()
Get the color for the progress bar during file read. |
ProgressShower |
getProgressShower()
Get the progress shower used for progress display. |
java.awt.Color |
getProgressWriteColor()
Get the color for the progress bar during file write. |
java.lang.String |
getSearchText()
Get the current search text. |
TemporaryPainter |
getTemporaryPainter()
Get a temporary painter which draws the current model. |
double |
getViewAspectRatio()
Get the aspect ration of the view. |
void |
goBackward()
Go a step backward in history if possible. |
void |
goForward()
Go a step forward in history if possible. |
void |
init()
Called by the browser or applet viewer to inform this applet that it has been loaded into the system. |
boolean |
isLayerVisible(java.lang.String layerName)
Is a given layer visible? |
void |
loadDxfFile(java.lang.String location)
Load a DXF file into the applet. |
void |
loadDxfFile(java.lang.String location,
boolean addToCurrent)
Load a DXF file into the applet. |
void |
print(java.awt.Graphics g)
Prints the container. |
void |
printAll(java.awt.Graphics g)
|
void |
printComponents(java.awt.Graphics g)
|
void |
printView()
Print the current view. |
void |
resetView()
Reset the view to initial state. |
void |
saveView(java.lang.String format)
Save the current view in a given format. |
int |
searchNext()
Perform a search. |
void |
setLayerVisible(java.lang.String layerName,
boolean visible)
Set the visibility of a given layer. |
void |
setModelUnit(PhysicalLength modelUnit)
Set the currently used model unit. |
void |
setPrintMode(PrintMode printMode)
Set the current print mode. |
void |
setProgressReadColor(java.awt.Color progressReadColor)
Set the color for the progress bar during file read. |
void |
setProgressWriteColor(java.awt.Color progressWriteColor)
Set the color for the progress bar during file write. |
int |
setSearchSettings(boolean backward,
boolean caseSensitive,
boolean matchWords)
Set various settings for searching. |
int |
setSearchText(java.lang.String text)
Set the search text. |
void |
showError(java.lang.String msg)
Show an error dialog. |
void |
showError(java.lang.Throwable x)
Show an error for an exception. |
void |
showFrame()
Shows the frame if it was hidden. |
Methods inherited from class javax.swing.JApplet |
---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
Methods inherited from class java.applet.Applet |
---|
getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop |
Methods inherited from class java.awt.Panel |
---|
addNotify |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
public static final java.lang.String REVISION
public static final java.lang.String FULLNAME
public static final java.lang.String MAILTO
public static final java.lang.String PARAM_APPLET_INPAGE
public static final java.lang.String PARAM_DXF_FILE
public static final java.lang.String PARAM_FRAME_WIDTH
public static final java.lang.String PARAM_FRAME_HEIGHT
public static final java.lang.String PARAM_GUI_DESCR
public static final java.lang.String PARAM_PRINT_VIEW
public static final java.lang.String PARAM_PRINT_FONT
@Deprecated public static final java.lang.String PARAM_PRINT_TO_SCALE
PARAM_PRINT_MODE
insteadPARAM_PRINT_VIEW
is set to true
).
public static final java.lang.String PARAM_PRINT_MODE
public static final java.lang.String PARAM_MODEL_UNIT_LENGTH
public static final java.lang.String PARAM_PRINTER_POINT_SIZE
public static final java.lang.String PARAM_DEFAULT_CODEPAGE
public static final java.lang.String PARAM_DEFAULT_FONT
public static final java.lang.String PARAM_DEFAULT_BIGFONT
public static final java.lang.String PARAM_ADDITIONAL_FONTDIR
public static final java.lang.String PARAM_LOAD_BACKGROUND
public static final java.lang.String PARAM_COOKIES
public static final java.lang.String PARAM_APPLET_STATE_CALLBACK
public static final java.lang.String DEFAULT_GUI_DESCR
public static final double FLAT_EPSILON
public static final java.lang.String BT_DISPLAY_FRAME
public static final java.lang.String ERR_APP_PARSE_READ
public static final java.lang.String ERR_APP_CONFIG_PARSER
public static final java.lang.String ERR_APP_CONFIG_IO
public static final java.lang.String ERR_RESTRICT_NO_SAVE
public static final java.lang.String ERR_NO_SAVE_FORMAT
public static final java.lang.String MI_CLOSE_WINDOW
Constructor Detail |
---|
public DxfApplet()
Method Detail |
---|
protected java.net.URL getGuiDescriptionURL(java.lang.String defaultDescr)
defaultDescr
- default description to be used if no GUI description is set by user
null
if there is no GUI description.public void init()
start
method is
called.
A subclass of Applet
should override this method if
it has initialization to perform. For example, an applet with
threads would use the init
method to create the
threads and the destroy
method to kill them.
The implementation of this method provided by the
Applet
class does nothing.
init
in class java.applet.Applet
Applet.destroy()
,
Applet.start()
,
Applet.stop()
public java.awt.Color getProgressReadColor()
public void setProgressReadColor(java.awt.Color progressReadColor)
progressReadColor
- file read progress colorpublic java.awt.Color getProgressWriteColor()
public void setProgressWriteColor(java.awt.Color progressWriteColor)
progressWriteColor
- file write progress colorpublic void loadDxfFile(java.lang.String location)
location
- URL to the file, absolute or relative to document base.public void loadDxfFile(java.lang.String location, boolean addToCurrent)
location
- URL to the file, absolute or relative to document baseaddToCurrent
- add the new model to the current model instead of replacing it?
This is currently only supported in framed mode.public PrintMode getPrintMode()
public void setPrintMode(PrintMode printMode)
printMode
- print modepublic PhysicalLength getModelUnit()
public void setModelUnit(PhysicalLength modelUnit)
modelUnit
- model unitpublic void destroy()
stop
method
will always be called before destroy
.
A subclass of Applet
should override this method if
it has any operation that it wants to perform before it is
destroyed. For example, an applet with threads would use the
init
method to create the threads and the
destroy
method to kill them.
The implementation of this method provided by the
Applet
class does nothing.
destroy
in class java.applet.Applet
Applet.init()
,
Applet.start()
,
Applet.stop()
public void showError(java.lang.Throwable x)
x
- exceptionpublic void showError(java.lang.String msg)
msg
- error messagepublic void printAll(java.awt.Graphics g)
printAll
in class java.awt.Component
public void printComponents(java.awt.Graphics g)
printComponents
in class java.awt.Container
public void print(java.awt.Graphics g)
print
in class java.awt.Container
g
- the specified Graphics windowComponent.update(java.awt.Graphics)
public void printView()
public void copyViewToClipboard()
public void doSave(java.lang.String path, java.lang.String format) throws java.io.IOException
doSave
in interface ImageSaveHelper
path
- the path of the file where to savedformat
- the format in which to write
java.io.IOException
- on errors during outputpublic java.io.File getLastSaveDir()
getLastSaveDir
in interface ImageSaveHelper
null
for defaultpublic java.awt.Frame getDialogParentFrame()
getDialogParentFrame
in interface ImageSaveHelper
getDialogParentFrame
in interface VectorSaveHelper
public TemporaryPainter getTemporaryPainter()
getTemporaryPainter
in interface VectorSaveHelper
public java.util.prefs.Preferences getPreferences()
getPreferences
in interface VectorSaveHelper
public double getViewAspectRatio()
getViewAspectRatio
in interface VectorSaveHelper
public ProgressShower getProgressShower()
getProgressShower
in interface VectorSaveHelper
null
if there is no progress displaypublic void closeFrame()
showFrame()
public void showFrame()
closeFrame()
public void resetView()
public void goForward()
public void goBackward()
public boolean canGoForward()
public boolean canGoBackward()
public java.lang.String[] getLayerNames()
public boolean isLayerVisible(java.lang.String layerName)
layerName
- layer name
true
: the layer is visiblefalse
: the layer is invisiblepublic void setLayerVisible(java.lang.String layerName, boolean visible)
layerName
- layer namevisible
- true
: set the layer visiblefalse
: set the layer invisiblepublic void saveView(java.lang.String format)
format
- format shortcut for saving, at least
gif, jpg, pdf, ps
and svgpublic SimpleAppletState getAppletState()
public int setSearchText(java.lang.String text)
applet state
is SimpleAppletState.Displaying
.
text
- text to search for
-1
: no search action foundpublic java.lang.String getSearchText()
applet state
is SimpleAppletState.Displaying
.
null
if there is no search actionpublic int setSearchSettings(boolean backward, boolean caseSensitive, boolean matchWords)
applet state
is SimpleAppletState.Displaying
.
backward
- search backward?caseSensitive
- search case sensitive?matchWords
- search only whole words?
-1
: no search action foundpublic int searchNext()
applet state
is SimpleAppletState.Displaying
.
1
to total number of matches) if there is any
match at all, 0
if there are no matches, and -1
if
there is no search actionpublic int getNumberOfSearchMatches()
applet state
is SimpleAppletState.Displaying
.
-1
if there is no search action definedpublic int getCurrentMatchIndex()
applet state
is SimpleAppletState.Displaying
.
1
to total number of matches) if there is any
match at all, 0
if there are no matches, and -1
if
there is no search actionpublic java.lang.String getAppletInfo()
String
containing information
about the author, version, and copyright of the applet.
The implementation of this method provided by the
Applet
class returns null
.
getAppletInfo
in class java.applet.Applet
public java.lang.String[][] getParameterInfo()
Strings
describing these parameters.
Each element of the array should be a set of three
Strings
containing the name, the type, and a
description. For example:
The implementation of this method provided by theString pinfo[][] = { {"fps", "1-10", "frames per second"}, {"repeat", "boolean", "repeat image loop"}, {"imgs", "url", "images directory"} };
Applet
class returns null
.
getParameterInfo
in class java.applet.Applet
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |