de.cau.cs.kieler.kex.controller
Class ExampleManager

java.lang.Object
  extended by de.cau.cs.kieler.kex.controller.ExampleManager

public final class ExampleManager
extends Object

This class manages the import and export in kex. It represents the bridge from kex.ui to kex code.

Rating red

Method Summary
 void export(Map<ExampleElement,Object> properties)
          Exports a given example.
 void generateProject(IPath resourcePath)
          Checks if an project is accessible.
static ExampleManager get()
          Singleton call of ExampleManager.
 List<Category> getCategories()
          Creates a resultlist with categories of collectors.
 InputStream getEmptyPic()
          Loads a default picture.
 Example getExample(SourceType type, String exampleId)
          searches the examplepool of a source for a special example.
 Map<String,Example> getExamples()
          Adds all examples of a the collectors to the result map.
 List<String> importExample(IPath destination, Example example, boolean checkDuplicate)
          Validates the import and imports the given example.
 List<String> importExamples(IPath selectedResource, List<Example> selectedExamples, boolean checkDuplicate)
          This method calls an validate and uses the ExampleImport to import examples.
 void load(boolean forceLoad)
          Loads examples, if not loaded before.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static ExampleManager get()
Singleton call of ExampleManager.

Returns:
ExampleManager

load

public void load(boolean forceLoad)
Loads examples, if not loaded before.

Parameters:
forceLoad - , set this parameter to force loading of examples

getExample

public Example getExample(SourceType type,
                          String exampleId)
searches the examplepool of a source for a special example.

Parameters:
type - , SourceType
exampleId - , String
Returns:
Example

getExamples

public Map<String,Example> getExamples()
Adds all examples of a the collectors to the result map.

Returns:
Map with String as key and Example as value.

getCategories

public List<Category> getCategories()
Creates a resultlist with categories of collectors.

Returns:
List of String.

importExamples

public List<String> importExamples(IPath selectedResource,
                                   List<Example> selectedExamples,
                                   boolean checkDuplicate)
                            throws Exception
This method calls an validate and uses the ExampleImport to import examples.

Parameters:
selectedResource - , IPath
selectedExamples - , List of Example
checkDuplicate - , boolean
Returns:
List of String
Throws:
Exception - if anything goes wrong.

importExample

public List<String> importExample(IPath destination,
                                  Example example,
                                  boolean checkDuplicate)
                           throws Exception
Validates the import and imports the given example.

Parameters:
destination - path to import the example to.
example - the example to import.
checkDuplicate - whether to check for import duplicates or not.
Returns:
list of resources to open.
Throws:
Exception - if anything goes wrong.

export

public void export(Map<ExampleElement,Object> properties)
Exports a given example. Created and deleted categories will managed, too.

Parameters:
properties - , Map with ExampleElement as key and Object as value.

getEmptyPic

public InputStream getEmptyPic()
Loads a default picture.

Returns:
InputStream

generateProject

public void generateProject(IPath resourcePath)
Checks if an project is accessible. If not, checks if exists, if not a new project with first segment of resourcePath becomes create. Then the project becomes open.

Parameters:
resourcePath - , IPath of import location.