org.gcube.portlets.widgets.guidedtour.resources
Class GuidedTourResourceGenerator

java.lang.Object
  extended by com.google.gwt.resources.ext.AbstractResourceGenerator
      extended by org.gcube.portlets.widgets.guidedtour.resources.GuidedTourResourceGenerator
All Implemented Interfaces:
com.google.gwt.resources.ext.ResourceGenerator, com.google.gwt.resources.ext.SupportsGeneratorResultCaching

public class GuidedTourResourceGenerator
extends com.google.gwt.resources.ext.AbstractResourceGenerator
implements com.google.gwt.resources.ext.SupportsGeneratorResultCaching

The QuickTourResource generator.

Author:
"Federico De Faveri defaveri@isti.cnr.it"

Field Summary
protected  Unmarshaller unmarshaller
           
 
Fields inherited from class com.google.gwt.resources.ext.AbstractResourceGenerator
STRIP_COMMENTS
 
Constructor Summary
GuidedTourResourceGenerator()
           
 
Method Summary
protected  String calculateTemplateClassName(Step step)
          Calculate the template class name using provided step information.
 String createAssignment(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.resources.ext.ResourceContext context, com.google.gwt.core.ext.typeinfo.JMethod method)
          
protected  void generateGetLanguageMethod(com.google.gwt.user.rebind.SourceWriter sw, Set<TourLanguage> foundLanguages)
          Generates the getLanguage method for the resource.
protected  void generateGetStepsMethod(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.user.rebind.SourceWriter sw, GuidedTour mainConfiguration, List<GuidedTour> languageConfigurations)
          Generates the code for steps instantiation.
protected  void generateTourPropertiesMethod(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.user.rebind.SourceWriter sw, GuidedTour mainConfiguration)
          Generates the code for the tour properties getter.
protected  Unmarshaller getUnmarshaller()
          Lazy initializator for the unmarshaller.
protected  String guessTemplateClassName(Step step)
          Guesses the template class name from the step informations.
protected  GuidedTour loadConfiguration(com.google.gwt.core.ext.TreeLogger logger, URL configurationFile, TourLanguage language)
          Load the configuration from the specified url.
 
Methods inherited from class com.google.gwt.resources.ext.AbstractResourceGenerator
createFields, finish, init, prepare
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unmarshaller

protected Unmarshaller unmarshaller
Constructor Detail

GuidedTourResourceGenerator

public GuidedTourResourceGenerator()
Method Detail

createAssignment

public String createAssignment(com.google.gwt.core.ext.TreeLogger logger,
                               com.google.gwt.resources.ext.ResourceContext context,
                               com.google.gwt.core.ext.typeinfo.JMethod method)
                        throws com.google.gwt.core.ext.UnableToCompleteException

Specified by:
createAssignment in interface com.google.gwt.resources.ext.ResourceGenerator
Specified by:
createAssignment in class com.google.gwt.resources.ext.AbstractResourceGenerator
Throws:
com.google.gwt.core.ext.UnableToCompleteException

generateTourPropertiesMethod

protected void generateTourPropertiesMethod(com.google.gwt.core.ext.TreeLogger logger,
                                            com.google.gwt.user.rebind.SourceWriter sw,
                                            GuidedTour mainConfiguration)
                                     throws com.google.gwt.core.ext.UnableToCompleteException
Generates the code for the tour properties getter.

Parameters:
logger - the generator logger.
sw - the source writer.
mainConfiguration - the main configuration resource.
Throws:
com.google.gwt.core.ext.UnableToCompleteException - if an error occurs during the methods creation

generateGetLanguageMethod

protected void generateGetLanguageMethod(com.google.gwt.user.rebind.SourceWriter sw,
                                         Set<TourLanguage> foundLanguages)
Generates the getLanguage method for the resource.

Parameters:
sw - the source writer
foundLanguages - the list of found languages

generateGetStepsMethod

protected void generateGetStepsMethod(com.google.gwt.core.ext.TreeLogger logger,
                                      com.google.gwt.user.rebind.SourceWriter sw,
                                      GuidedTour mainConfiguration,
                                      List<GuidedTour> languageConfigurations)
                               throws com.google.gwt.core.ext.UnableToCompleteException
Generates the code for steps instantiation.

Parameters:
logger - the generator logger.
sw - the source writer
mainConfiguration - the main configuration resource for the quick tour.
languageConfigurations - the language specific configuration for the quick tour.
Throws:
com.google.gwt.core.ext.UnableToCompleteException

calculateTemplateClassName

protected String calculateTemplateClassName(Step step)
                                     throws Exception
Calculate the template class name using provided step information.

Parameters:
step - the step to analyze.
Returns:
the class name.
Throws:
Exception - if something go wrong in the calculation.

guessTemplateClassName

protected String guessTemplateClassName(Step step)
                                 throws Exception
Guesses the template class name from the step informations.

Parameters:
step - the step to analyze.
Returns:
the guessed class name.
Throws:
Exception - if something go wrong during the guessing phase.

loadConfiguration

protected GuidedTour loadConfiguration(com.google.gwt.core.ext.TreeLogger logger,
                                       URL configurationFile,
                                       TourLanguage language)
                                throws com.google.gwt.core.ext.UnableToCompleteException
Load the configuration from the specified url.

Parameters:
logger - the generator logger.
configurationFile - the configuration file url.
language - the configuration language.
Returns:
the loaded configuration.
Throws:
com.google.gwt.core.ext.UnableToCompleteException

getUnmarshaller

protected Unmarshaller getUnmarshaller()
                                throws JAXBException
Lazy initializator for the unmarshaller.

Returns:
Throws:
JAXBException


Copyright © 2014. All Rights Reserved.