edu.usc.cse.desi.editor
Class DESITabularPage

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.EditorPart
          extended byedu.usc.cse.desi.editor.AbstractPage
              extended byedu.usc.cse.desi.editor.DESITabularPage
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.IEditorPart, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2

public class DESITabularPage
extends AbstractPage

This is the tabular page of the DeSi Editor. It is responsible for setting up and displaying the SWT widgets that make up the tabular view as well as connecting those widges to changes in the model.

Author:
nbeckman Started on Jul 16, 2004

Field Summary
private  java.util.LinkedHashMap myAlgosAndResults
           
private  java.util.List myCalculators
           
private  InputData myInputData
           
private  org.eclipse.swt.widgets.Composite myMainComposite
           
private  DESIViewModel myOldModel
           
private  org.eclipse.jface.viewers.ListViewer myResultsList
           
private  java.util.List myTableViewers
           
 
Fields inherited from class edu.usc.cse.desi.editor.AbstractPage
 
Fields inherited from class org.eclipse.ui.part.EditorPart
 
Fields inherited from class org.eclipse.ui.part.WorkbenchPart
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
DESITabularPage(DESIEditor top_level_editor)
           
 
Method Summary
private  void createAlgoSection(org.eclipse.swt.widgets.Composite parent)
           
private  void createCollocTable(org.eclipse.swt.widgets.Composite parent)
          This method will create the co-location table which will be presented in the the constraints section.
private  void createComponentsEvtSizeTable(org.eclipse.swt.widgets.Composite parent)
          This method will create a TableViewer for the component table that shows component event sizes.
private  void createComponentsTable(org.eclipse.swt.widgets.Composite parent)
          This method creates a TableViewer for the components table and adds it to the given parent SWT Widget.
private  void createConstraintsSection(org.eclipse.swt.widgets.Composite parent)
          This method will create the constraints section.
private  void createDeploymentTable(org.eclipse.swt.widgets.Composite parent)
          Create a table of component deployments.
private  void createHostBWTable(org.eclipse.swt.widgets.Composite parent)
          This method creates the table that shows the bandwisth of the links between the hosts.
private  void createHostTable(org.eclipse.swt.widgets.Composite parent)
          This method will create the Hosts Table.
private  void createInputSection(org.eclipse.swt.widgets.Composite parent)
          This method will create the input section, all the widgets needed for specifying and randomly generating new Systems and Deployments.
private  void createLocTable(org.eclipse.swt.widgets.Composite parent)
          This is the method that creates the location constraints table.
private  void createLogicalLinkPropertyTable(org.eclipse.swt.widgets.Composite parent, java.lang.String prop_name)
          Create a table that will display the given property of logical links.
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
          This method is overridden, to make each page special.
private  void createPhysicalLinkPropertyTable(org.eclipse.swt.widgets.Composite parent, java.lang.String prop_name)
          Create a table that will display the given property of physical links.
private  void createResultsSection(org.eclipse.swt.widgets.Composite parent)
          This method creates the section of the tabular page where the results are displayed.
private  void createTabbedSection(org.eclipse.swt.widgets.Composite parent)
          There is a section of the tabular view that contains tabbed pages that give the current status of the system.
private  void generate()
          This method is called when someone hits the generate button.
 java.lang.String getPageName()
          What is the readable name of this page?
private  void initializeAlgos()
          This method will initialize the algorithms that can be run.
private  void layoutView(org.eclipse.swt.widgets.Composite parent)
          This method will, once the main grid layout is setup, will add all the pieces of the view to it.
 void modelChanged(DESIViewModel old_model, DESIViewModel new_model)
          When the model changes, we need to keep a copy of the old model in case we decide to go back to it.
protected  void registerEditPartViewer(org.eclipse.gef.EditPartViewer viewer)
          If this page has an viewer, it must be registered with the Editor and the edit domain.
private  void runAlgo(java.lang.String algo_name)
          This method will run the algorithm whose name is passed in.
private  void runSamsAlgo()
           
 void setFocus()
          Call set focus on our graphical viewer.
private  void undoButtonPressed()
          This method will be called when the Undo button is hit.
 
Methods inherited from class edu.usc.cse.desi.editor.AbstractPage
doSave, doSaveAs, getCommandStack, getModel, getMyEditDomain, getMyEditor, gotoMarker, init, isDirty, isSaveAsAllowed, switchedTo
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, dispose, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, dispose, getSite, getTitle, getTitleImage, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

myMainComposite

private org.eclipse.swt.widgets.Composite myMainComposite

myOldModel

private DESIViewModel myOldModel

myInputData

private InputData myInputData

myTableViewers

private java.util.List myTableViewers

myCalculators

private java.util.List myCalculators

myResultsList

private org.eclipse.jface.viewers.ListViewer myResultsList

myAlgosAndResults

private java.util.LinkedHashMap myAlgosAndResults
Constructor Detail

DESITabularPage

public DESITabularPage(DESIEditor top_level_editor)
Parameters:
top_level_editor -
Method Detail

initializeAlgos

private void initializeAlgos()
This method will initialize the algorithms that can be run. It will appropriately fill the myAlgosAndResults Hash.


createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Description copied from class: AbstractPage
This method is overridden, to make each page special.

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Specified by:
createPartControl in class AbstractPage

layoutView

private void layoutView(org.eclipse.swt.widgets.Composite parent)
This method will, once the main grid layout is setup, will add all the pieces of the view to it. This nees to be a method separate from createPartControl because sometimes, like on a model switch, we may just want to re-layout everything.

Parameters:
parent -

createAlgoSection

private void createAlgoSection(org.eclipse.swt.widgets.Composite parent)

createConstraintsSection

private void createConstraintsSection(org.eclipse.swt.widgets.Composite parent)
This method will create the constraints section. This includes all the widgets necessary for fixing a component to a host, preventing it and for collocating or prenting components from collocating. For the first time, this entire section ISN'T being taken from old DESI code, so I'm kinda winging it here.

Parameters:
parent -

createInputSection

private void createInputSection(org.eclipse.swt.widgets.Composite parent)
This method will create the input section, all the widgets needed for specifying and randomly generating new Systems and Deployments. Almost all of the widgets in this method, with the exception of the availability meter, do not need to be updated with the system. That's sort of the reason why everything's just plopped down in this one method. This method has now become extra special because the properties will be read from the dynamic property holder to create the widgets.

Parameters:
parent - Composite - The parent SWT widget of this section.

createResultsSection

private void createResultsSection(org.eclipse.swt.widgets.Composite parent)
This method creates the section of the tabular page where the results are displayed. Of course now the results aren't really displayed there but instead the selection widget which allows you to go back to all the old algorithm results.

Parameters:
parent - Composite - The parent SWT widget of this section.

createTabbedSection

private void createTabbedSection(org.eclipse.swt.widgets.Composite parent)
There is a section of the tabular view that contains tabbed pages that give the current status of the system. This private method will set up that entire section.

Parameters:
parent -

generate

private void generate()
This method is called when someone hits the generate button. It runs a new generator passing it the input data and property initer.


createCollocTable

private void createCollocTable(org.eclipse.swt.widgets.Composite parent)
This method will create the co-location table which will be presented in the the constraints section.

Parameters:
parent -

createLocTable

private void createLocTable(org.eclipse.swt.widgets.Composite parent)
This is the method that creates the location constraints table. It first creates its JFace TableViewer and then it has to set up the table by adding our custom label and content providers. This table will display location constraints for components and it will put them inside the parent SWT component.

Parameters:
parent -

createHostTable

private void createHostTable(org.eclipse.swt.widgets.Composite parent)
This method will create the Hosts Table. If it needs to be in a group or a tabbed group, this is determined by the Composite that is passed in. In this method, we create a Table and a JFace table on top. Then we give it the appropriate Content and Label providers so that the model and changes to it will be handled correctly.

Parameters:
parent - Composite - The parent SWT Widget of this table.

createDeploymentTable

private void createDeploymentTable(org.eclipse.swt.widgets.Composite parent)
Create a table of component deployments.

Parameters:
parent -

createLogicalLinkPropertyTable

private void createLogicalLinkPropertyTable(org.eclipse.swt.widgets.Composite parent,
                                            java.lang.String prop_name)
Create a table that will display the given property of logical links.

Parameters:
parent - Composite - The SWT parent widget of this table.
prop_name - String - The name of the property of logical links this table will display.

createPhysicalLinkPropertyTable

private void createPhysicalLinkPropertyTable(org.eclipse.swt.widgets.Composite parent,
                                             java.lang.String prop_name)
Create a table that will display the given property of physical links.

Parameters:
parent - Composite - The SWT parent widget of this table.
prop_name - String - The name of the property of Physical Links to display.

createHostBWTable

private void createHostBWTable(org.eclipse.swt.widgets.Composite parent)
This method creates the table that shows the bandwisth of the links between the hosts. It needs to be passed a parameter which will be the parent SWT widget of the table.

Parameters:
parent - Composite - The parent SWT widget of this table.

createComponentsTable

private void createComponentsTable(org.eclipse.swt.widgets.Composite parent)
This method creates a TableViewer for the components table and adds it to the given parent SWT Widget. The components table shows all the properties of a component.

Parameters:
parent - Composite - The parent SWT widget of this table.

createComponentsEvtSizeTable

private void createComponentsEvtSizeTable(org.eclipse.swt.widgets.Composite parent)
This method will create a TableViewer for the component table that shows component event sizes. It will add this table to the given parent widget.

Parameters:
parent - Composite - The parent SWT widget of this table.

getPageName

public java.lang.String getPageName()
Description copied from class: AbstractPage
What is the readable name of this page?

Specified by:
getPageName in class AbstractPage
Returns:
String

registerEditPartViewer

protected void registerEditPartViewer(org.eclipse.gef.EditPartViewer viewer)
Description copied from class: AbstractPage
If this page has an viewer, it must be registered with the Editor and the edit domain.

Specified by:
registerEditPartViewer in class AbstractPage
Parameters:
viewer - EditPartViewer

setFocus

public void setFocus()
Description copied from class: AbstractPage
Call set focus on our graphical viewer. (This really only applies to the graphical viewer, as far as I can tell.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart
Specified by:
setFocus in class AbstractPage

modelChanged

public void modelChanged(DESIViewModel old_model,
                         DESIViewModel new_model)
When the model changes, we need to keep a copy of the old model in case we decide to go back to it. I overrode this method:

Specified by:
modelChanged in class AbstractPage
Parameters:
new_model - DESIViewModel - The new model.
old_model - DESIViewModel - The old model.
See Also:
AbstractPage.modelChanged(edu.usc.cse.desi.model.view.DESIViewModel, edu.usc.cse.desi.model.view.DESIViewModel)

undoButtonPressed

private void undoButtonPressed()
This method will be called when the Undo button is hit. It has a very simple function. If the member field myOldModel is not null, it will set it as the model.


runSamsAlgo

private void runSamsAlgo()

runAlgo

private void runAlgo(java.lang.String algo_name)
This method will run the algorithm whose name is passed in. This method is meant to be added to the selection listener on various algorithm buttons.

Parameters:
algo_name - String - The name of the algorithm that should be run.