pl.edu.agh.cast.data.ui.importer.wizard
Class ImportPage

java.lang.Object
  extended by org.eclipse.jface.dialogs.DialogPage
      extended by org.eclipse.jface.wizard.WizardPage
          extended by pl.edu.agh.cast.data.ui.importer.wizard.ImportPage
All Implemented Interfaces:
org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.wizard.IWizardPage

public class ImportPage
extends org.eclipse.jface.wizard.WizardPage

First page of the template import wizard, which serves for selection of all basic information that are required by the import process, such as selection of data to import, as well as the import template to use.

Author:
AGH CAST Team

Field Summary
protected  FileRawDataLogger importLogger
          Observer which logs import events to file.
protected  ImportPageComposite importPageComposite
          Main composite of the page.
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
Constructor Summary
ImportPage(String pageName)
          The default constructor.
 
Method Summary
protected  void addTemplate(Template template)
          Adds a specified template to the list of templates being displayed on the import page.
 boolean canFlipToNextPage()
          
 void createControl(org.eclipse.swt.widgets.Composite parent)
          
 void dispose()
          
 String getFilePath()
           
 org.eclipse.jface.wizard.IWizardPage getNextPage()
          
 org.eclipse.core.resources.IProject getProject()
           
 String getProjectName()
           
 Template getTemplate()
          Retrieves the template, which had been selected in the template tree viewer on the import page.
 TemplateGroup[] getTemplateGroups(boolean reload)
          Creates a default template group, sets it for all existing templates and returns the template group.
 boolean isComplete()
          Indicates if the page is completed which means all the fields are filled in correctly.
 boolean isCurrentWizardPage()
          Method is a delegate of a protected method WizardPage.isCurrentPage.
 TabularData loadPreview(String filePath, Template template)
          Loads a data preview by importing a given amount of rows (PREVIEW_ROWS_LIMIT) of a specified data file, with use of a specified template.
 void notifyDataChanged()
          Notifies when some data had changed and reacts accordingly to the current state of the import page.
 void setImportLogger(FileRawDataLogger logger)
           
 void setImportPageComposite(ImportPageComposite importPageComposite)
           
 void validateImporterType()
          Validates importer type, sets appropriate wizard status
 boolean validateImportFile()
          Validates import file, sets appropriate wizard status
 void validateImportPage()
          Validates project name, file path and if template is selected.
 void validateProjectName()
          Validates project name, sets appropriate wizard status
 void validateTemplate()
          Validates templates, sets appropriate wizard status
 boolean validImportFile(String filePath)
          Checks whether a specified import file is valid.
 boolean validProjectName(String projectName)
          Checks the validity of the specified project name.
 
Methods inherited from class org.eclipse.jface.wizard.WizardPage
getContainer, getDialogSettings, getImage, getName, getPreviousPage, getShell, getWizard, isCurrentPage, isPageComplete, setDescription, setErrorMessage, setImageDescriptor, setMessage, setPageComplete, setPreviousPage, setTitle, setWizard, toString
 
Methods inherited from class org.eclipse.jface.dialogs.DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getMessage, getMessageType, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, performHelp, setButtonLayoutData, setControl, setMessage, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
getControl, getDescription, getErrorMessage, getMessage, getTitle, performHelp, setVisible
 

Field Detail

importPageComposite

protected ImportPageComposite importPageComposite
Main composite of the page.


importLogger

protected FileRawDataLogger importLogger
Observer which logs import events to file.

Constructor Detail

ImportPage

public ImportPage(String pageName)
The default constructor.

Parameters:
pageName - name of the import page
Method Detail

getTemplateGroups

public TemplateGroup[] getTemplateGroups(boolean reload)
Creates a default template group, sets it for all existing templates and returns the template group. TODO: should retrieve all template groups.

Parameters:
reload - the flag indicating if the templates should be reloaded
Returns:
the template groups

validateImportPage

public void validateImportPage()
Validates project name, file path and if template is selected. Changes only page state and set if page is complete


validateProjectName

public void validateProjectName()
Validates project name, sets appropriate wizard status

Note: This method does invoke setPageComplete method and not change wizard state. To do this, call validateImportPage method


validateImportFile

public boolean validateImportFile()
Validates import file, sets appropriate wizard status

Note: This method does not invoke setPageComplete method and not set error state. To do this, call validateImportPage method.

Returns:
true if the import file is valid; false otherwise

validateTemplate

public void validateTemplate()
Validates templates, sets appropriate wizard status

Note: This method does not invoke setPageComplete method and not set error state. To do this, call validateImportPage method. It marks data changed, and import is required


validateImporterType

public void validateImporterType()
Validates importer type, sets appropriate wizard status

Note: This method does invoke setPageComplete method and not change wizard state. To do this, call validateImportPage method


validImportFile

public boolean validImportFile(String filePath)
Checks whether a specified import file is valid.

Parameters:
filePath - path to file that is to be validated.
Returns:
true is the specified file is valid; falce otherwise

loadPreview

public TabularData loadPreview(String filePath,
                               Template template)
Loads a data preview by importing a given amount of rows (PREVIEW_ROWS_LIMIT) of a specified data file, with use of a specified template.

Parameters:
filePath - the path to data file
template - the template
Returns:
the tabular data ready for preview

notifyDataChanged

public void notifyDataChanged()
Notifies when some data had changed and reacts accordingly to the current state of the import page.


isComplete

public boolean isComplete()
Indicates if the page is completed which means all the fields are filled in correctly.

Returns:
true if all fields are correct, false otherwise.

getProjectName

public String getProjectName()

getFilePath

public String getFilePath()

getTemplate

public Template getTemplate()
Retrieves the template, which had been selected in the template tree viewer on the import page.

Returns:
the selected template

getProject

public org.eclipse.core.resources.IProject getProject()

createControl

public void createControl(org.eclipse.swt.widgets.Composite parent)

See Also:
IDialogPage.createControl(org.eclipse.swt.widgets.Composite)

getNextPage

public org.eclipse.jface.wizard.IWizardPage getNextPage()

Specified by:
getNextPage in interface org.eclipse.jface.wizard.IWizardPage
Overrides:
getNextPage in class org.eclipse.jface.wizard.WizardPage
See Also:
WizardPage.getNextPage()

canFlipToNextPage

public boolean canFlipToNextPage()

Specified by:
canFlipToNextPage in interface org.eclipse.jface.wizard.IWizardPage
Overrides:
canFlipToNextPage in class org.eclipse.jface.wizard.WizardPage
See Also:
WizardPage.canFlipToNextPage()

dispose

public void dispose()

Specified by:
dispose in interface org.eclipse.jface.dialogs.IDialogPage
Overrides:
dispose in class org.eclipse.jface.dialogs.DialogPage
See Also:
DialogPage.dispose()

isCurrentWizardPage

public boolean isCurrentWizardPage()
Method is a delegate of a protected method WizardPage.isCurrentPage. Returns whether this page is the current one in the wizard's container.

Returns:
true if the page is active, and false otherwise

validProjectName

public boolean validProjectName(String projectName)
Checks the validity of the specified project name.

Parameters:
projectName - the name of the project
Returns:
true if valid; false otherwise

addTemplate

protected void addTemplate(Template template)
Adds a specified template to the list of templates being displayed on the import page.

Parameters:
template - the template to add

setImportPageComposite

public void setImportPageComposite(ImportPageComposite importPageComposite)

setImportLogger

public void setImportLogger(FileRawDataLogger logger)


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.