public class Viewer
extends javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
APPLICATION_TITLE
The application's title.
|
private javax.swing.JCheckBox |
automatic
It is the item "Automatic" of the menu "Edit".
|
private boolean |
automaticMode
Indicates whether the automatic mode for recovering the image quality
is or not set.
|
(package private) javax.swing.JButton |
backwardButton
Backward button in the tool bar.
|
private java.awt.image.BufferedImage |
bufImage |
private javax.swing.JMenuItem |
closeImage
It is the item "Close image" of the menu "File"
|
private javax.swing.JMenuItem |
closeSessionItem
It is the item "New Session" of the menu "File".
|
private javax.swing.JList |
componentList
This object is used to select the components of the image in the
controlPane . |
private int[] |
components
Contains the indixes of the image component which are being displayed.
|
private static int |
CONTROL_PANE_WIDTH
Width of the control pane.
|
private javax.swing.JButton |
controlAcceptButton
It is the accept button of the
controlPane . |
private javax.swing.JPanel |
controlPane
This panel is used to place the application controls (sliders, spinners,
thumbnail, ...) and it is the left side of the
splitPane . |
private javax.swing.JButton |
controlUndoButton
It is the undo button of the
controlPane . |
private static int |
DEFAULT_HEIGHT
Default height of the viewer.
|
private static int |
DEFAULT_WIDTH
Default width of the viewer.
|
private DisplayPane |
displayPane
This pane is used to display the image.
|
private javax.swing.JMenuItem |
exit
It is the item "Exit" of the menu "File" and it exits from the
application.
|
private float[] |
fImagePixels |
(package private) javax.swing.JButton |
forwardButton
Forward button in the tool bar.
|
private javax.swing.JMenuItem |
frameSizeDownMenuItem
It is the item "Frame size down" of the menu "Tools".
|
private javax.swing.JMenuItem |
frameSizeUpMenuItem
It is the item "Frame size up" of the menu "Tools".
|
private ImageData |
imageData
This object contains the image that is being displayed in the
displayPane . |
private boolean |
imageEqualization |
private javax.swing.JMenuItem |
imageParameters
It is the item "Image parameters" of the menu "Tools".
|
private int |
indexOfURL |
private javax.swing.JPanel |
jFrameContentPane
It is the root pane of the application.
|
private Client |
jpipClient
This object is a JPIP client that will be used to get images from the
server and to decompress them.
|
private int |
layer
Is the highest achieved layer of the displayed image.
|
private javax.swing.JMenuItem |
layerDownMenuItem
It is the item "Layer up" of the menu "Tools".
|
private SliderAndSpinnerPanel |
layerPanel
This object is used to control the layer slider and its associated
spinner in the
controlPane . |
private javax.swing.JMenuItem |
layerUpMenuItem
It is the item "Layer up" of the menu "Tools".
|
(package private) javax.swing.DefaultListModel |
listModel
It is the list model of the
componentList . |
private javax.swing.JMenuItem |
loadCache
Is the item "Load cache" of the menu "File" and it allows to load the
content of a client cache from a file.
|
private javax.swing.JMenuItem |
loadSessionItem
It is the item "New Session" of the menu "File".
|
private javax.swing.JMenuItem |
lookAndFeel
It is the item "Look and Feel" of the menu "Edit".
|
private static int |
MAX_NUMBER_LAST_REQUEST
Is the maximum number of the last request that will be saved to allow
the backward.
|
private MemoryMonitorBar |
memoryMonitorBar
This object is used to monitor the memory consumption as a progress bar
in the status bar.
|
private javax.swing.JMenuBar |
menuBar
Menu bar for the menu options.
|
private NewSessionDialog |
newSessionDialog |
private javax.swing.JMenuItem |
newSessionItem
It is the item "New Session" of the menu "File".
|
private javax.swing.JMenuItem |
openImage
It is the item "Open Image" of the menu "File" and it opens a local
image.
|
private OpenImageDialog |
openImageDialog
This object creates a frame where the user can write the image to be
loaded.
|
private javax.swing.JMenuItem |
openSessionItem
It is the item "New Session" of the menu "File".
|
private int |
port
It is the port number of the server.
|
private javax.swing.JMenuItem |
preferences
It is the item "Preferences" of the menu "Edit".
|
private int |
proxyPort
Is the port of the proxy.
|
private java.lang.String |
proxyServer
Is the name of the proxy server, if it is used.
|
private int |
quality
Is the quality, in percentage, of the displayed image.
|
private SliderAndSpinnerPanel |
qualityPanel
This object is used to control the quality level slider and its
associated spinner in the
controlPane . |
private javax.swing.JMenuItem |
removeSessionItem
It is the item "New Session" of the menu "File".
|
private int |
resolutionLevel
Is the image resolution level that is being displayed.
|
private SliderAndSpinnerPanel |
resolutionLevelPanel
This object is used to control the resolution level slider and its
associated spinner in the
controlPane . |
private javax.swing.JMenuItem |
saveAs
It is the item "Save as" of the menu "File" and it allows to save the
actual image.
|
private javax.swing.JMenuItem |
saveCache
Is the item "Save cache" of the menu "File" and it allows to save the
content of the client cache.
|
private java.lang.String |
server
Contains the server name where the image are get from.
|
private java.lang.String |
sessionID |
private SpeedAndTargetMonitor |
speedAndTargetMonitor
This object is used to monitor the speed of the transmission and amount
of recieved bytes in the status bar.
|
private javax.swing.JSplitPane |
splitPane
This pane will contain the
controlPane on the left side and the
displayPane on the right side. |
private javax.swing.JPanel |
statusBar
This panel is used to display applications' status information.
|
private StatusText |
statusText
This object represent the status text of the status bar.
|
private java.lang.String |
target
It is the resource name (an image).
|
private ImageData |
thumbnailData
This object contains the thumbnail image to be displayed on the
thumbnailDisplay . |
private ThumbnailDisplay |
thumbnailDisplay
This object contains a thumbnail of the image which is being displayed
in the
displayPane . |
private java.lang.String |
thumbnailSessionID |
private javax.swing.JToolBar |
toolBar
Tool bar where the buttons will be placed.
|
private java.lang.String |
url
Contains the url that has been put in the
URLTextField by the
user, or the latest requested URL to be displayed in the
URLTextField . |
private java.util.ArrayList<java.lang.String> |
urls |
private javax.swing.JTextField |
URLTextField
Is a text field that is placed in the tool bar and it is used for input
an URL.
|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
Viewer()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
automaticDisplay()
This method performs an automatic recovering of the image.
|
private void |
changeLookAndFeel()
Changes the look and feel.
|
private void |
changePreferences()
Changes the the jpip client preferences.
|
private void |
closeImage()
Close the connection with the jpip client;
|
private void |
closeSession()
Close the jpip client session.
|
private void |
createAndShowGUI()
Creates and shows the graphical user interface.
|
private javax.swing.JButton |
createButton(javax.swing.Icon icon,
java.lang.String toolTipText,
int width,
int height)
Creates a button with a fixes dimensions.
|
private javax.swing.JPanel |
createComponentPane(int panelWidth)
Creates the component pane.
|
private javax.swing.JPanel |
createControlButtons()
Creates the control buttons panel of the control panel.
|
private javax.swing.JPanel |
createControlPane()
Creates the control pane, where the sliders and spinners will be
located.
|
private javax.swing.JPanel |
createDisplayPane()
Creates de display pane.
|
private javax.swing.JPanel |
createJFrameContentPane(int width,
int height)
Creates the principal content pane.
|
private javax.swing.JMenuBar |
createMenuBar(int width,
int height)
This method creates the menu bar
|
private void |
createNewSession() |
private javax.swing.JSplitPane |
createSplitPane()
Creates the split pane.
|
private javax.swing.JPanel |
createStatusAndProgressBar()
Creates the status text and the progress bar.
|
private javax.swing.JToolBar |
createToolBar(int width,
int height)
Creates the tool bar.
|
private void |
displayThumbnail()
Displays a thumbnail of the main image.
|
private void |
exit()
Closes the CADI Viewer application.
|
long |
getDownloadedBytes()
Definition in
Client.getDownloadedBytes() . |
boolean |
getImage(int[] components,
int[] fsiz,
int[] roff,
int[] rsiz,
int layer,
int quality)
Get the image at component, resolution level, layer, and quality required
by the user.
|
boolean |
getImage(int[] components,
int resolutionLevel,
int[] roff,
int[] rsiz,
int layer,
int quality)
Get the image at component, resolution level, layer, and quality required
by the user.
|
private void |
getImage(java.lang.String url)
Gets an image from a URL.
|
float |
getSpeed()
Definition in
Client.getSpeed() . |
private java.awt.image.BufferedImage |
imageSamplesToBufferedImage(float[][][] imageSamplesFloat)
This method converts from a three dimensional
array representation to a bufferered image representation.
|
private java.awt.image.BufferedImage |
imageSamplesToBufferedImageThumbnail(float[][][] imageSamplesFloatThumbnail,
int[] precision)
This method converts from a three dimensional array representation to a
bufferered image representation.
|
private void |
loadCache()
Loads a cache from a file.
|
private void |
openImage()
Opens the Open Image Dialog window and get the specifies image and
properties.
|
void |
rePaintImage()
This method forces the repainting of the displayed image.
|
private void |
resetSlidersAndSpinners()
Resets the sliders and spinners with the new image values.
|
private void |
saveCache()
Save the client cache in a file.
|
private void |
saveImage()
Save the image samples in a file.
|
private void |
setThresholdsAndColorMaps()
This method sets visible thresholds and changes colormap
of the displayed image.
|
private void |
showImageParameters()
Show the image parameters for image which is being showed.
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private static final java.lang.String APPLICATION_TITLE
private static final int DEFAULT_HEIGHT
private static final int DEFAULT_WIDTH
DEFAULT_HEIGHT
to have a good aspect.private static final int CONTROL_PANE_WIDTH
private static final int MAX_NUMBER_LAST_REQUEST
private javax.swing.JPanel jFrameContentPane
private javax.swing.JMenuBar menuBar
private javax.swing.JToolBar toolBar
private javax.swing.JSplitPane splitPane
controlPane
on the left side and the
displayPane
on the right side. The width of the left size is
fixed (see CONTROL_PANE_WIDTH
) and it cannot be changed.private DisplayPane displayPane
private javax.swing.JPanel statusBar
statusText
,
speedAndTargetMonitor
,
memoryMonitorBar
private javax.swing.JPanel controlPane
splitPane
.javax.swing.JButton backwardButton
javax.swing.JButton forwardButton
private javax.swing.JTextField URLTextField
private javax.swing.JList componentList
controlPane
.javax.swing.DefaultListModel listModel
componentList
.private SliderAndSpinnerPanel resolutionLevelPanel
controlPane
.private SliderAndSpinnerPanel layerPanel
controlPane
.private SliderAndSpinnerPanel qualityPanel
controlPane
.private javax.swing.JButton controlAcceptButton
controlPane
.private javax.swing.JButton controlUndoButton
controlPane
.private ThumbnailDisplay thumbnailDisplay
displayPane
.private ImageData thumbnailData
thumbnailDisplay
.private javax.swing.JMenuItem newSessionItem
newSessionDialog
where information about a new session is
required.private javax.swing.JMenuItem openSessionItem
newSessionDialog
where information about a new session is
required.private javax.swing.JMenuItem closeSessionItem
newSessionDialog
where information about a new session is
required.private javax.swing.JMenuItem loadSessionItem
newSessionDialog
where information about a new session is
required.private javax.swing.JMenuItem removeSessionItem
newSessionDialog
where information about a new session is
required.private javax.swing.JMenuItem openImage
private javax.swing.JMenuItem closeImage
private javax.swing.JMenuItem saveAs
private javax.swing.JMenuItem saveCache
private javax.swing.JMenuItem loadCache
private javax.swing.JMenuItem exit
private javax.swing.JMenuItem preferences
private javax.swing.JMenuItem lookAndFeel
private javax.swing.JCheckBox automatic
private javax.swing.JMenuItem imageParameters
showImageParameters()
) where the image data will be shown.private javax.swing.JMenuItem frameSizeUpMenuItem
private javax.swing.JMenuItem frameSizeDownMenuItem
private javax.swing.JMenuItem layerUpMenuItem
private javax.swing.JMenuItem layerDownMenuItem
private StatusText statusText
private SpeedAndTargetMonitor speedAndTargetMonitor
private MemoryMonitorBar memoryMonitorBar
private java.lang.String sessionID
private java.lang.String thumbnailSessionID
private java.lang.String server
private int port
server
private java.lang.String proxyServer
private int proxyPort
server
private java.lang.String target
private Client jpipClient
private java.lang.String url
URLTextField
by the
user, or the latest requested URL to be displayed in the
URLTextField
.private java.util.ArrayList<java.lang.String> urls
private int indexOfURL
private int[] components
private int resolutionLevel
private int layer
private int quality
private ImageData imageData
displayPane
.private java.awt.image.BufferedImage bufImage
private float[] fImagePixels
private NewSessionDialog newSessionDialog
private OpenImageDialog openImageDialog
private boolean automaticMode
automatic
private boolean imageEqualization
public boolean getImage(int[] components, int[] fsiz, int[] roff, int[] rsiz, int layer, int quality)
If an error is produced while image is recovering, a error message is shown.
components
- definition in components
fsiz
- definition in ViewWindowField.fsiz
roff
- definition in ViewWindowField.roff
rsiz
- definition in ViewWindowField.rsiz
layer
- definition in ViewWindowField.layers
quality
- JPIPResponseFields.quality
true
if there is no error fetching the image.
Otherwise, returns
false
.public boolean getImage(int[] components, int resolutionLevel, int[] roff, int[] rsiz, int layer, int quality)
If an error is produced while image is recovering, a error message is shown.
components
- definition in components
resolutionLevel
- definition in resolutionLevel
roff
- definition in ViewWindowField.roff
rsiz
- definition in ViewWindowField.rsiz
layer
- definition in ViewWindowField.layers
quality
- JPIPResponseFields.quality
true
if there is no error fetching the image.
Otherwise, returns
false
.public float getSpeed()
Client.getSpeed()
.public long getDownloadedBytes()
Client.getDownloadedBytes()
.private void createAndShowGUI()
private javax.swing.JMenuBar createMenuBar(int width, int height)
private javax.swing.JPanel createJFrameContentPane(int width, int height)
private javax.swing.JToolBar createToolBar(int width, int height)
private javax.swing.JButton createButton(javax.swing.Icon icon, java.lang.String toolTipText, int width, int height)
icon
- the button's icontoolTipText
- the text to display in the tool tip.width
- width of the buttonheight
- height of the buttonprivate javax.swing.JSplitPane createSplitPane()
private javax.swing.JPanel createControlPane()
private javax.swing.JPanel createDisplayPane()
private javax.swing.JPanel createStatusAndProgressBar()
private javax.swing.JPanel createComponentPane(int panelWidth)
createControlPane()
private javax.swing.JPanel createControlButtons()
createControlPane()
private void createNewSession()
private void openImage()
private void automaticDisplay()
private void closeImage()
private void closeSession()
private void showImageParameters()
private void exit()
private void resetSlidersAndSpinners()
private void saveImage()
private void saveCache()
private void loadCache()
private void getImage(java.lang.String url)
URLTextField
.url
- the URL to locate theprivate void displayThumbnail()
private void changePreferences()
private void changeLookAndFeel()
private void setThresholdsAndColorMaps()
public void rePaintImage()
private java.awt.image.BufferedImage imageSamplesToBufferedImage(float[][][] imageSamplesFloat)
imageSamplesFloat
- a three-dimensional array with the image
samplesprivate java.awt.image.BufferedImage imageSamplesToBufferedImageThumbnail(float[][][] imageSamplesFloatThumbnail, int[] precision)
imageSamplesFloatThumbnail
- a three-dimensional array with the
image samplesprecision
- an one-dimensional array with the precision (bit-depth)
for each image component.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)