com.sun.electric.tool.user
Class UserInterfaceMain

java.lang.Object
  extended by com.sun.electric.tool.Client
      extended by com.sun.electric.tool.AbstractUserInterface
          extended by com.sun.electric.tool.user.UserInterfaceMain
All Implemented Interfaces:
UserInterface

public class UserInterfaceMain
extends AbstractUserInterface

Class to build the UserInterface for the main GUI version of the user interface.


Nested Class Summary
static class UserInterfaceMain.Mode
          Describe the windowing mode.
 
Nested classes/interfaces inherited from class com.sun.electric.tool.Client
Client.OS, Client.ServerEvent
 
Field Summary
protected static Progress progress
          The progress during input.
 
Constructor Summary
UserInterfaceMain(java.util.List<java.lang.String> argsList, UserInterfaceMain.Mode mode, boolean showSplash)
           
 
Method Summary
static void addDatabaseChangeListener(DatabaseChangeListener l)
          Add a DatabaseChangeListener.
 void addEvent(Client.ServerEvent serverEvent)
           
 void adjustReferencePoint(Cell theCell, double cX, double cY)
          Method to adjust reference point in WindowFrame containing the cell
 void alignToGrid(java.awt.geom.Point2D pt)
          Method to align a database coordinate with the current grid.
 int askForChoice(java.lang.String message, java.lang.String title, java.lang.String[] choices, java.lang.String defaultChoice)
          Method to ask for a choice among possibilities.
 java.lang.String askForInput(java.lang.Object message, java.lang.String title, java.lang.String def)
          Method to ask for a line of text.
 void beep()
           
 boolean confirmMessage(java.lang.Object message)
          Method to show a message and ask for confirmation.
protected  void dispatchServerEvent(Client.ServerEvent serverEvent)
           
 EditWindow_ displayCell(Cell cell)
          Method to request that a Cell be displayed in a new window.
 void exportPrefs()
          Method to export the preferences to an XML file.
 void finishInitialization()
          Method is called when initialization was finished.
static void fireDatabaseChangeEvent(DatabaseChangeEvent e)
          Fire DatabaseChangeEvent to DatabaseChangeListeners.
 Cell getCurrentCell()
          Method to return the current Cell in the current Library.
 Cell getCurrentCell(Library lib)
          Method to get the current Cell in a given Library.
 EditWindow_ getCurrentEditWindow_()
          Method to return the current "EditWindow_" object.
 int getDefaultTextSize()
          Method to return the height of default text (in points).
 double getGridAlignment()
          Method to get the current grid alignment.
 java.lang.String getProgressNote()
          Method to get text message in the progress dialog.
static boolean getRedoEnabled()
          Method to tell whether redo can be done.
static boolean getUndoEnabled()
          Method to tell whether undo can be done.
 void importPrefs()
          Method to import the preferences from an XML file.
 void initializeInitJob(Job job, java.lang.Object mode)
           
 void loadComponentMenuForTechnology()
          Method to request the refresh of palette and layers tabs according to the new technology selected
 Cell needCurrentCell()
          Method to demand the current Cell.
 EditWindow_ needCurrentEditWindow_()
          Method to demand the current "EditWindow_" object.
static void removeDatabaseChangeListener(DatabaseChangeListener l)
          Remove a DatabaseChangeListener.
 void repaintAllEditWindows()
          Method to request that all windows be redisplayed.
 java.lang.String reportLog(ErrorLogger.MessageLog log, boolean showhigh, Geometric[] gPair)
          Method to return the error message associated with the current error.
 void restoreHighlights(int highlightsId)
          Restore state of highlights by its ID.
 void restoreSavedBindings(boolean initialCall)
           
 int saveHighlights()
          Save current state of highlights and return its ID.
 void setCurrentCell(Library lib, Cell curCell)
          Method to set the current Cell in a Library.
 void setProgressNote(java.lang.String message)
          Method to set a text message in the progress dialog.
 void setProgressValue(long pct)
          Method to update the progress bar
 void showErrorMessage(java.lang.Object message, java.lang.String title)
          Method to show an error message.
 void showInformationMessage(java.lang.Object message, java.lang.String title)
          Method to show an informational message.
 void showSnapshot(Snapshot newSnapshot, boolean undoRedo)
          Show new database snapshot.
 void showUndoRedoStatus(boolean newUndoEnabled, boolean newRedoEnabled)
          Show status of undo/redo buttons
 void startProgressDialog(java.lang.String msg, java.lang.String filePath)
          Method to start the display of a progress dialog.
 void stopProgressDialog()
          Method to stop the progress bar
 void termLogging(ErrorLogger log, boolean explain, boolean terminate)
           
 void updateIncrementalDRCErrors(Cell cell, java.util.List<ErrorLogger.MessageLog> newErrors, java.util.List<ErrorLogger.MessageLog> delErrors)
           
 void updateNetworkErrors(Cell cell, java.util.List<ErrorLogger.MessageLog> errors)
           
 
Methods inherited from class com.sun.electric.tool.Client
getOperatingSystem, isOSMac, isOSWindows
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

progress

protected static Progress progress
The progress during input.

Constructor Detail

UserInterfaceMain

public UserInterfaceMain(java.util.List<java.lang.String> argsList,
                         UserInterfaceMain.Mode mode,
                         boolean showSplash)
Method Detail

dispatchServerEvent

protected void dispatchServerEvent(Client.ServerEvent serverEvent)
                            throws java.lang.Exception
Throws:
java.lang.Exception

addEvent

public void addEvent(Client.ServerEvent serverEvent)
Overrides:
addEvent in class AbstractUserInterface

initializeInitJob

public void initializeInitJob(Job job,
                              java.lang.Object mode)
Overrides:
initializeInitJob in class AbstractUserInterface

finishInitialization

public void finishInitialization()
Method is called when initialization was finished.

Overrides:
finishInitialization in class AbstractUserInterface

getCurrentEditWindow_

public EditWindow_ getCurrentEditWindow_()
Description copied from interface: UserInterface
Method to return the current "EditWindow_" object.

Returns:
the current "EditWindow_" object (null if none).

needCurrentEditWindow_

public EditWindow_ needCurrentEditWindow_()
Description copied from interface: UserInterface
Method to demand the current "EditWindow_" object. If none exists, an error message is displayed.

Returns:
the current "EditWindow_" object (null if none).

getCurrentCell

public Cell getCurrentCell()
Description copied from interface: UserInterface
Method to return the current Cell in the current Library.

Returns:
the current Cell (null if none).

getCurrentCell

public Cell getCurrentCell(Library lib)
Method to get the current Cell in a given Library.

Parameters:
lib - the library to query.
Returns:
the current Cell in the Library.

setCurrentCell

public void setCurrentCell(Library lib,
                           Cell curCell)
Method to set the current Cell in a Library.

Parameters:
lib - the library in which to set a current cell.
curCell - the new current Cell in the Library (can be null).

needCurrentCell

public Cell needCurrentCell()
Description copied from interface: UserInterface
Method to demand the current Cell. If none exists, an error message is displayed.

Returns:
the current Cell (null if none).

adjustReferencePoint

public void adjustReferencePoint(Cell theCell,
                                 double cX,
                                 double cY)
Method to adjust reference point in WindowFrame containing the cell


repaintAllEditWindows

public void repaintAllEditWindows()
Description copied from interface: UserInterface
Method to request that all windows be redisplayed.


loadComponentMenuForTechnology

public void loadComponentMenuForTechnology()
Description copied from interface: UserInterface
Method to request the refresh of palette and layers tabs according to the new technology selected


alignToGrid

public void alignToGrid(java.awt.geom.Point2D pt)
Description copied from interface: UserInterface
Method to align a database coordinate with the current grid.

Parameters:
pt - the database coordinate. It's value is adjusted.

getGridAlignment

public double getGridAlignment()
Description copied from interface: UserInterface
Method to get the current grid alignment.

Returns:
the current grid alignment.

getDefaultTextSize

public int getDefaultTextSize()
Description copied from interface: UserInterface
Method to return the height of default text (in points).

Returns:
the height of default text (in points).

displayCell

public EditWindow_ displayCell(Cell cell)
Description copied from interface: UserInterface
Method to request that a Cell be displayed in a new window.

Parameters:
cell - the Cell to be displayed.
Returns:
the EditWindow_ object created to show the Cell.

termLogging

public void termLogging(ErrorLogger log,
                        boolean explain,
                        boolean terminate)

updateNetworkErrors

public void updateNetworkErrors(Cell cell,
                                java.util.List<ErrorLogger.MessageLog> errors)
Overrides:
updateNetworkErrors in class AbstractUserInterface

updateIncrementalDRCErrors

public void updateIncrementalDRCErrors(Cell cell,
                                       java.util.List<ErrorLogger.MessageLog> newErrors,
                                       java.util.List<ErrorLogger.MessageLog> delErrors)
Overrides:
updateIncrementalDRCErrors in class AbstractUserInterface

reportLog

public java.lang.String reportLog(ErrorLogger.MessageLog log,
                                  boolean showhigh,
                                  Geometric[] gPair)
Method to return the error message associated with the current error. Highlights associated graphics if "showhigh" is nonzero. Fills "g1" and "g2" with associated geometry modules (if nonzero).


showErrorMessage

public void showErrorMessage(java.lang.Object message,
                             java.lang.String title)
Method to show an error message.

Parameters:
message - the error message to show.
title - the title of a dialog with the error message.

showInformationMessage

public void showInformationMessage(java.lang.Object message,
                                   java.lang.String title)
Method to show an informational message.

Parameters:
message - the message to show.
title - the title of a dialog with the message.

confirmMessage

public boolean confirmMessage(java.lang.Object message)
Method to show a message and ask for confirmation.

Parameters:
message - the message to show.
Returns:
true if "yes" was selected, false if "no" was selected.

askForChoice

public int askForChoice(java.lang.String message,
                        java.lang.String title,
                        java.lang.String[] choices,
                        java.lang.String defaultChoice)
Method to ask for a choice among possibilities.

Parameters:
message - the message to show.
title - the title of the dialog with the query.
choices - an array of choices to present, each in a button.
defaultChoice - the default choice.
Returns:
the index into the choices array that was selected.

askForInput

public java.lang.String askForInput(java.lang.Object message,
                                    java.lang.String title,
                                    java.lang.String def)
Method to ask for a line of text.

Parameters:
message - the prompt message.
title - the title of a dialog with the message.
def - the default response.
Returns:
the string (null if cancelled).

importPrefs

public void importPrefs()
Method to import the preferences from an XML file. Prompts the user and reads the file.


exportPrefs

public void exportPrefs()
Method to export the preferences to an XML file. Prompts the user and writes the file.


restoreSavedBindings

public void restoreSavedBindings(boolean initialCall)
Overrides:
restoreSavedBindings in class AbstractUserInterface

saveHighlights

public int saveHighlights()
Save current state of highlights and return its ID.

Overrides:
saveHighlights in class AbstractUserInterface

restoreHighlights

public void restoreHighlights(int highlightsId)
Restore state of highlights by its ID.

Overrides:
restoreHighlights in class AbstractUserInterface
Parameters:
highlightsId - id of saved highlights.

showUndoRedoStatus

public void showUndoRedoStatus(boolean newUndoEnabled,
                               boolean newRedoEnabled)
Show status of undo/redo buttons

Overrides:
showUndoRedoStatus in class AbstractUserInterface
Parameters:
newUndoEnabled - new status of undo button.
newRedoEnabled - new status of redo button.

showSnapshot

public void showSnapshot(Snapshot newSnapshot,
                         boolean undoRedo)
Show new database snapshot.

Overrides:
showSnapshot in class AbstractUserInterface
Parameters:
newSnapshot - new snapshot.

beep

public void beep()
Overrides:
beep in class AbstractUserInterface

getUndoEnabled

public static boolean getUndoEnabled()
Method to tell whether undo can be done. This is used by the tool bar to determine whether the undo button should be available.

Returns:
true if undo can be done.

getRedoEnabled

public static boolean getRedoEnabled()
Method to tell whether redo can be done. This is used by the tool bar to determine whether the undo button should be available.

Returns:
true if redo can be done.

addDatabaseChangeListener

public static void addDatabaseChangeListener(DatabaseChangeListener l)
Add a DatabaseChangeListener. It will be notified when state of the database changes.

Parameters:
l - the listener

removeDatabaseChangeListener

public static void removeDatabaseChangeListener(DatabaseChangeListener l)
Remove a DatabaseChangeListener.


fireDatabaseChangeEvent

public static void fireDatabaseChangeEvent(DatabaseChangeEvent e)
Fire DatabaseChangeEvent to DatabaseChangeListeners.

Parameters:
e - DatabaseChangeEvent.

startProgressDialog

public void startProgressDialog(java.lang.String msg,
                                java.lang.String filePath)
Method to start the display of a progress dialog.

Parameters:
msg - the message to show in the progress dialog.
filePath - the file being read (null if not reading a file).

stopProgressDialog

public void stopProgressDialog()
Method to stop the progress bar


setProgressValue

public void setProgressValue(long pct)
Method to update the progress bar

Parameters:
pct - the percentage done (from 0 to 100).

setProgressNote

public void setProgressNote(java.lang.String message)
Method to set a text message in the progress dialog.

Parameters:
message - the new progress message.

getProgressNote

public java.lang.String getProgressNote()
Method to get text message in the progress dialog.

Returns:
text message in the progress dialog.