|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.kiml.LayoutDataService
public class LayoutDataService
Singleton class for access to the KIML layout data. This class is used globally to retrieve data
for automatic layout through KIML. The class cannot be instantiated directly, but only through a
subclass that calls createLayoutServices()
. The subclass is then responsible to add
appropriate data to the nested registry instance. Multiple instances of subclasses can register
themselves by calling createLayoutServices(subInstance)
, where subInstance is the
instance of the subclass, but only one instance per subclass is allowed. Registering another
instance will overwrite the prior instance. The different instances are identified by class name
and the currently used instance can be determined by calling getMode()
. You can switch
between the different instances by calling setMode(final String mode)
where mode
is one of the predefined Strings ECLIPSEDATASERVICE, REMOTEDATASERVICE or SERVICEDATASERVICE. The
SERVICEDATASERVICE mode is intended to be used only by the KWebS server so using it inside the
KIELER modeling environment will introduce undefined behavior.
Nested Class Summary | |
---|---|
class |
LayoutDataService.Registry
Class used to register the layout services. |
Field Summary | |
---|---|
static String |
DIAGRAM_TYPE_GENERAL
identifier of the 'general' diagram type, which applies to all diagrams. |
static String |
ECLIPSEDATASERVICE
Mode constant for local data service instance. |
static String |
REMOTEDATASERVICE
Mode constant for remote data service instance. |
static String |
SERVICEDATASERVICE
Mode constant for server data service instance. |
Constructor Summary | |
---|---|
protected |
LayoutDataService()
The default constructor is hidden to prevent others from instantiating this class. |
Method Summary | ||
---|---|---|
protected static void |
addService(LayoutDataService subInstance)
Registers a layout data service instance created by a specific subclass and assigns it an instance of the registry. |
|
Collection<LayoutAlgorithmData> |
getAlgorithmData()
Returns a data collection for all registered layout algorithms. |
|
LayoutAlgorithmData |
getAlgorithmData(String id)
Returns the layout algorithm data associated with the given identifier. |
|
LayoutAlgorithmData |
getAlgorithmDataBySuffix(String suffix)
Returns a layout algorithm data that has the given suffix in its identifier. |
|
String |
getCategoryName(String id)
Returns the name of the given category. |
|
static LayoutDataService |
getInstance()
Returns the layout data service instance belonging to the currently selected mode. |
|
static
|
getInstanceOf(String type)
Returns the instance of a layout data service specified by it's fully qualified class name. |
|
static String |
getMode()
Returns the current operation mode of the layout data service. |
|
Collection<LayoutOptionData<?>> |
getOptionData()
Returns a data collection for all registered layout options. |
|
List<LayoutOptionData<?>> |
getOptionData(LayoutAlgorithmData algorithmData,
LayoutOptionData.Target targetType)
Returns a list of layout options that are suitable for the given layout algorithm and layout option target. |
|
LayoutOptionData<?> |
getOptionData(String id)
Returns the layout option data associated with the given identifier. |
|
LayoutOptionData<?> |
getOptionDataBySuffix(String suffix)
Returns a layout option data that has the given suffix in its identifier. |
|
static LayoutDataService.Registry |
getRegistry()
Returns the instance of the registry class associated with the current layout data service. |
|
Collection<LayoutTypeData> |
getTypeData()
Returns a list of layout type identifiers and names. |
|
LayoutTypeData |
getTypeData(String id)
Returns the data instance of the layout type with given identifier. |
|
LayoutTypeData |
getTypeDataBySuffix(String suffix)
Returns a layout type data that has the given suffix in its identifier. |
|
static void |
removeService(LayoutDataService subInstance)
Removes a layout data service instance. |
|
static void |
setMode(String mode)
Sets the mode to mode where mode has to be an element of
LayoutDataService.ECLIPSEDATASERVICE , LayoutDataService.REMOTEDATASERVICE or
LayoutDataService.SERVERDATASERVICE . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DIAGRAM_TYPE_GENERAL
public static final String ECLIPSEDATASERVICE
public static final String REMOTEDATASERVICE
public static final String SERVICEDATASERVICE
Constructor Detail |
---|
protected LayoutDataService()
Method Detail |
---|
protected static void addService(LayoutDataService subInstance)
subInstance
- an instance created by a subclasspublic static void removeService(LayoutDataService subInstance)
subInstance
- the sub instance to be removed
IllegalArgumentException
- if the instance belonging to the currently selected mode is to be removed or the
sub instance is not supportedpublic static String getMode()
LayoutDataService.ECLIPSEDATASERVICE
, LayoutDataService.REMOTEDATASERVICE
or
LayoutDataService.SERVERDATASERVICE
or null
if no layout data service has
been registered yet.
null
public static void setMode(String mode)
mode
where mode
has to be an element of
LayoutDataService.ECLIPSEDATASERVICE
, LayoutDataService.REMOTEDATASERVICE
or
LayoutDataService.SERVERDATASERVICE
.
mode
- the mode to be set
IllegalArgumentException
- if the given mode is not valid or the according layout data service has not been
registered yetpublic static LayoutDataService getInstance()
public static <T extends LayoutDataService> T getInstanceOf(String type)
T
- type of the returned instancetype
- fully qualified class name of the data service instance
null
if no such instance has been registered or
the given type is not valid specifier.public static final LayoutDataService.Registry getRegistry()
null
if either no layout data service has been
registered yet or it has been removedpublic final LayoutAlgorithmData getAlgorithmData(String id)
id
- layout algorithm identifier
null
if there is no algorithm
with the given identifierpublic final Collection<LayoutAlgorithmData> getAlgorithmData()
public final LayoutAlgorithmData getAlgorithmDataBySuffix(String suffix)
suffix
- a layout algorithm identifier suffix
public final LayoutOptionData<?> getOptionData(String id)
id
- layout option identifier
null
if there is no option with the
given identifierpublic final Collection<LayoutOptionData<?>> getOptionData()
public final LayoutOptionData<?> getOptionDataBySuffix(String suffix)
suffix
- a layout option identifier suffix
public final List<LayoutOptionData<?>> getOptionData(LayoutAlgorithmData algorithmData, LayoutOptionData.Target targetType)
algorithmData
- layout algorithm datatargetType
- type of layout option target
public final LayoutTypeData getTypeData(String id)
id
- identifier of the type
null
if the layout type
is not registeredpublic final Collection<LayoutTypeData> getTypeData()
public final LayoutTypeData getTypeDataBySuffix(String suffix)
suffix
- a layout type identifier suffix
public final String getCategoryName(String id)
id
- identifier of the category
null
if there is no category with the
given identifier
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |