org.w3c.jwput.gui
Class JWGUI

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.w3c.jwput.gui.JWGUI
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, JWOptions, JWUI, java.awt.MenuContainer, java.io.Serializable

public class JWGUI
extends javax.swing.JPanel
implements JWUI, JWOptions

Winie's Graphical User Interface

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  javax.swing.JPanel cards
           
protected  java.io.OutputStream errlog
           
static java.lang.String ERRLOG_FILE
           
protected  java.io.File errlogfile
           
static javax.swing.Icon errorIcon
           
static java.lang.String FILE_HISTORY_FILE
           
static java.lang.String FILE_HISTORY_P
           
protected  History fileHistory
           
protected  javax.swing.JFrame frame
           
protected  boolean hidepopups
           
static int HISTORY_SIZE
           
protected  JWGet jwget
           
static java.lang.String JWGET_P
           
static java.util.Properties jwprops
           
protected  JWPut jwput
           
static java.lang.String JWPUT_P
           
static java.lang.String JWUI_P
           
protected  java.awt.CardLayout layout
           
static java.lang.String LOG_FILE
           
protected  LogDialog logD
           
protected  java.io.File logfile
           
static javax.swing.Icon messageIcon
           
protected  java.io.OutputStream outlog
           
protected  PasswordDialog pdialog
           
protected  JWPreferences prefs
           
protected  boolean progressbar
           
protected  java.util.Hashtable props
           
static javax.swing.Icon questionIcon
           
protected  boolean showlogs
           
protected  StatusBar status
           
static java.lang.String SYNCH_FILE
           
static java.lang.String SYNCH_FILE_URL_P
           
protected  SynchFileURL synchfileurl
           
static java.lang.String URL_HISTORY_FILE
           
static java.lang.String URL_HISTORY_P
           
protected  History urlHistory
           
protected  boolean userhidepopups
           
static javax.swing.Icon winieIcon
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface org.w3c.jwput.JWUI
ABORT_OPTION, APPROVE_OPTION, CANCEL_OPTION, ERROR_OPTION
 
Fields inherited from interface org.w3c.jwput.JWOptions
ACCEPT_LANGUAGE_P, BACKUP_P, DEF_TRIES, ETAGS_DB, FALSE_P, HEADER_PREFIX, HIDE_POPUPS_P, HOMEDIR_P, LOAD_DIR_P, MIME_PREFIX, MIMEDEF_P, OVERWRITE_P, PASSWORD_P, PROGRESS_BAR_P, PROMPT_P, PROXY_HOST_P, PROXY_PORT_P, PROXY_SET_P, PUT_CVS_P, QUIET_P, REC_P, SAVE_DIR_P, SOCKS_HOST_P, SOCKS_PORT_P, TRIES_P, TRUE_P, USER_AGENT_P, USER_P, VERBOSE_P, WPUTDIR, WPUTRC
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JWGUI(javax.swing.JFrame frame)
          Constructor
 
Method Summary
 int ask(java.lang.String[] message, java.lang.String[] question)
          Ask a question to the user.
 boolean askQuestion(java.lang.String question)
          Ask a question to the user.
 boolean askQuestion(java.lang.String[] message, java.lang.String question)
          Ask a question to the user.
 boolean askQuestion(java.lang.String[] message, java.lang.String[] question)
          Ask a question to the user.
 boolean askQuestion(java.lang.String message, java.lang.String question)
          Ask a question to the user.
protected  void build(java.util.Hashtable props)
           
 void displayError(java.lang.String msg)
          Display an error message
 void displayError(java.lang.String[] msg, java.lang.String title)
          Display a error message (on several lines)
 void displayError(java.lang.String msg, java.lang.String title)
          Display an error message
protected  void displayLog(java.lang.String log)
           
protected  void displayLog(java.lang.String[] log)
           
 void displayMessage(java.lang.String msg)
          Display a message
 void displayMessage(java.lang.String[] msg, java.lang.String title)
          Display a message (on several lines)
 void displayMessage(java.lang.String[] msg, java.lang.String title, javax.swing.Icon icon)
          Display a message (on several lines)
 void displayMessage(java.lang.String msg, java.lang.String title)
          Display a message
 void errlog(java.lang.String log)
          Log an error
protected  void exit()
           
 java.lang.String[] getAuthentication(java.lang.String realm, java.lang.String message, boolean firstime)
          Get a username and a password
protected  javax.swing.JComponent getDeleteComponent(java.util.Hashtable props)
           
 java.io.OutputStream getErrlogStream()
          Get a Stream on the errlog.
protected  javax.swing.Icon getErrorIcon()
           
 java.lang.String getFile(java.lang.String title, java.lang.String message)
          Get a File from the user.
 java.lang.String getFile(java.lang.String title, java.lang.String[] message)
          Get a File from the user.
protected  javax.swing.Icon getIcon(java.lang.String name)
           
 java.util.Properties getJWProperties()
          Get the default user properties
protected  javax.swing.JComponent getLoadComponent(java.util.Hashtable props)
           
 java.io.OutputStream getLogStream()
          Get a Stream on the log.
protected  javax.swing.JMenuBar getMenuBar()
          Get the MenuBar.
 java.io.InputStream getMonitoredInputStream(java.io.InputStream in, java.lang.String message, int length)
          Get a monitored inputstream
protected  javax.swing.Icon getMsgIcon()
           
protected  java.util.Hashtable getProperties()
           
protected  javax.swing.Icon getQuestionIcon()
           
protected  javax.swing.JComponent getSaveComponent(java.util.Hashtable props)
           
protected  StatusBar getStatusBar()
           
 java.lang.String getString(java.lang.String message)
          Get a String from the user.
 java.lang.String getString(java.lang.String[] message)
          Get a String from the user.
protected  java.util.Properties getUserProperties()
           
protected  javax.swing.Icon getWinieIcon()
           
 void hidelogs()
          Hide the log to the User (and still write in the log stream)
 void hidePopups()
          No message popup
protected  void initialize()
           
 void log(java.lang.String log)
          Log a string
protected  void log(java.lang.String[] log)
           
static void main(java.lang.String[] args)
          Main
protected  void savePreferences(java.util.Properties prefs)
           
 void setCursor(int cursor)
          Set The Cursor.
 void setStatus(java.lang.String stat)
           
 void showlogs()
          Show the log to the User (and still write in the log stream)
 void showPopups()
          Display message popups
protected  void showPreferences()
           
protected  boolean showProgressBar()
           
protected  void switchUploadDownload()
           
 void sync()
          Flush the logs (log and errlog)
static void unBoldSpecificFonts()
           
 void updateProperties(java.util.Properties props)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

URL_HISTORY_P

public static final java.lang.String URL_HISTORY_P

FILE_HISTORY_P

public static final java.lang.String FILE_HISTORY_P

SYNCH_FILE_URL_P

public static final java.lang.String SYNCH_FILE_URL_P

JWPUT_P

public static final java.lang.String JWPUT_P

JWGET_P

public static final java.lang.String JWGET_P

JWUI_P

public static final java.lang.String JWUI_P

URL_HISTORY_FILE

public static final java.lang.String URL_HISTORY_FILE

FILE_HISTORY_FILE

public static final java.lang.String FILE_HISTORY_FILE

SYNCH_FILE

public static final java.lang.String SYNCH_FILE

LOG_FILE

public static final java.lang.String LOG_FILE

ERRLOG_FILE

public static final java.lang.String ERRLOG_FILE

HISTORY_SIZE

public static final int HISTORY_SIZE

jwprops

public static java.util.Properties jwprops

winieIcon

public static javax.swing.Icon winieIcon

messageIcon

public static javax.swing.Icon messageIcon

errorIcon

public static javax.swing.Icon errorIcon

questionIcon

public static javax.swing.Icon questionIcon

jwput

protected JWPut jwput

jwget

protected JWGet jwget

urlHistory

protected History urlHistory

fileHistory

protected History fileHistory

synchfileurl

protected SynchFileURL synchfileurl

props

protected java.util.Hashtable props

layout

protected java.awt.CardLayout layout

frame

protected javax.swing.JFrame frame

cards

protected javax.swing.JPanel cards

pdialog

protected PasswordDialog pdialog

prefs

protected JWPreferences prefs

logD

protected LogDialog logD

status

protected StatusBar status

outlog

protected java.io.OutputStream outlog

errlog

protected java.io.OutputStream errlog

logfile

protected java.io.File logfile

errlogfile

protected java.io.File errlogfile

showlogs

protected boolean showlogs

hidepopups

protected boolean hidepopups

userhidepopups

protected boolean userhidepopups

progressbar

protected boolean progressbar
Constructor Detail

JWGUI

public JWGUI(javax.swing.JFrame frame)
Constructor
Parameters:
the - parent JFrame
Method Detail

unBoldSpecificFonts

public static void unBoldSpecificFonts()

setCursor

public void setCursor(int cursor)
Set The Cursor.
Parameters:
cursor - The Cursor type

initialize

protected void initialize()

updateProperties

public void updateProperties(java.util.Properties props)

getProperties

protected java.util.Hashtable getProperties()

getJWProperties

public java.util.Properties getJWProperties()
Get the default user properties
Returns:
a Property set

hidePopups

public void hidePopups()
Description copied from interface: JWUI
No message popup
Specified by:
hidePopups in interface JWUI

showPopups

public void showPopups()
Description copied from interface: JWUI
Display message popups
Specified by:
showPopups in interface JWUI

showlogs

public void showlogs()
Show the log to the User (and still write in the log stream)
Specified by:
showlogs in interface JWUI

hidelogs

public void hidelogs()
Hide the log to the User (and still write in the log stream)
Specified by:
hidelogs in interface JWUI

build

protected void build(java.util.Hashtable props)

getStatusBar

protected StatusBar getStatusBar()

switchUploadDownload

protected void switchUploadDownload()

getWinieIcon

protected javax.swing.Icon getWinieIcon()

getMsgIcon

protected javax.swing.Icon getMsgIcon()

getErrorIcon

protected javax.swing.Icon getErrorIcon()

getQuestionIcon

protected javax.swing.Icon getQuestionIcon()

getIcon

protected javax.swing.Icon getIcon(java.lang.String name)

getDeleteComponent

protected javax.swing.JComponent getDeleteComponent(java.util.Hashtable props)

getLoadComponent

protected javax.swing.JComponent getLoadComponent(java.util.Hashtable props)

getSaveComponent

protected javax.swing.JComponent getSaveComponent(java.util.Hashtable props)

getMenuBar

protected javax.swing.JMenuBar getMenuBar()
Get the MenuBar.
Returns:
a JMenuBar instance.

getUserProperties

protected java.util.Properties getUserProperties()

exit

protected void exit()

showPreferences

protected void showPreferences()

savePreferences

protected void savePreferences(java.util.Properties prefs)

getAuthentication

public java.lang.String[] getAuthentication(java.lang.String realm,
                                            java.lang.String message,
                                            boolean firstime)
Get a username and a password
Specified by:
getAuthentication in interface JWUI
Parameters:
firstime - is is the first time we ask for a password?
Returns:
a String array containing { user, password }

getString

public java.lang.String getString(java.lang.String message)
Get a String from the user.
Specified by:
getString in interface JWUI
Parameters:
message - the message to display
Returns:
a String instance

getString

public java.lang.String getString(java.lang.String[] message)
Get a String from the user.
Specified by:
getString in interface JWUI
Parameters:
message - the message to display
Returns:
a String instance

getFile

public java.lang.String getFile(java.lang.String title,
                                java.lang.String message)
Get a File from the user.
Specified by:
getFile in interface JWUI
Parameters:
message - the message to display
Returns:
a String instance

getFile

public java.lang.String getFile(java.lang.String title,
                                java.lang.String[] message)
Get a File from the user.
Specified by:
getFile in interface JWUI
Parameters:
message - the message to display
Returns:
a String instance

askQuestion

public boolean askQuestion(java.lang.String question)
Ask a question to the user.
Specified by:
askQuestion in interface JWUI
Parameters:
question - the Question return a boolean (true = yes, false = no)

askQuestion

public boolean askQuestion(java.lang.String message,
                           java.lang.String question)
Ask a question to the user.
Specified by:
askQuestion in interface JWUI
Parameters:
message - a message to display before the question
question - the Question return a boolean (true = yes, false = no)

askQuestion

public boolean askQuestion(java.lang.String[] message,
                           java.lang.String question)
Ask a question to the user.
Parameters:
question - the Question
message - a message to display before the question (several lines)
Returns:
a boolean (true = yes, false = no)

askQuestion

public boolean askQuestion(java.lang.String[] message,
                           java.lang.String[] question)
Ask a question to the user.
Specified by:
askQuestion in interface JWUI
Parameters:
question - the Question (several lines)
message - a message to display before the question (several lines)
Returns:
a boolean (true = yes, false = no)

ask

public int ask(java.lang.String[] message,
               java.lang.String[] question)
Ask a question to the user.
Specified by:
ask in interface JWUI
Parameters:
question - the Question (several lines)
message - a message to display before the question (several lines)
Returns:
APPROVE_OPTION, CANCEL_OPTION, ABORT_OPTION

displayError

public void displayError(java.lang.String msg)
Display an error message
Specified by:
displayError in interface JWUI
Parameters:
msg - the error message

displayError

public void displayError(java.lang.String msg,
                         java.lang.String title)
Display an error message
Specified by:
displayError in interface JWUI
Parameters:
msg - the error message

displayError

public void displayError(java.lang.String[] msg,
                         java.lang.String title)
Display a error message (on several lines)
Specified by:
displayError in interface JWUI
Parameters:
msg - the message

displayMessage

public void displayMessage(java.lang.String msg)
Display a message
Specified by:
displayMessage in interface JWUI
Parameters:
msg - the message

displayMessage

public void displayMessage(java.lang.String msg,
                           java.lang.String title)
Display a message
Specified by:
displayMessage in interface JWUI
Parameters:
msg - the message
title - the dialog title

displayMessage

public void displayMessage(java.lang.String[] msg,
                           java.lang.String title)
Display a message (on several lines)
Specified by:
displayMessage in interface JWUI
Parameters:
msg - the message
title - the dialog title

displayMessage

public void displayMessage(java.lang.String[] msg,
                           java.lang.String title,
                           javax.swing.Icon icon)
Display a message (on several lines)
Parameters:
msg - the message
title - the dialog title
icon - the Icon to display

setStatus

public void setStatus(java.lang.String stat)
Specified by:
setStatus in interface JWUI

displayLog

protected void displayLog(java.lang.String[] log)

displayLog

protected void displayLog(java.lang.String log)

log

protected void log(java.lang.String[] log)

log

public void log(java.lang.String log)
Log a string
Specified by:
log in interface JWUI
Parameters:
the - String to log

errlog

public void errlog(java.lang.String log)
Log an error
Specified by:
errlog in interface JWUI
Parameters:
the - String to log

sync

public void sync()
Flush the logs (log and errlog)
Specified by:
sync in interface JWUI

getLogStream

public java.io.OutputStream getLogStream()
Get a Stream on the log.
Specified by:
getLogStream in interface JWUI
Returns:
an OutputStream

getErrlogStream

public java.io.OutputStream getErrlogStream()
Get a Stream on the errlog.
Specified by:
getErrlogStream in interface JWUI
Returns:
an OutputStream

showProgressBar

protected boolean showProgressBar()

getMonitoredInputStream

public java.io.InputStream getMonitoredInputStream(java.io.InputStream in,
                                                   java.lang.String message,
                                                   int length)
Get a monitored inputstream
Specified by:
getMonitoredInputStream in interface JWUI
Parameters:
in - the inputstream to monitor
message - the message to display during monitoring
length - the number of byte to be read
Returns:
the monitored inputstream

main

public static void main(java.lang.String[] args)
Main