Hello Konstantin,
I encountered the same problem like you. My solution uses the Reflection API to add a MFWorkplaceTopic to its MFWorkplaceInfo. The MFWorkplaceInfo class contains a protected method called addTopic(MFWorkplaceTopic topic).
The topic has been created using a dummy MFWorkplaceInfo object.
That has to work until there is a change in the Application Designer API
Iām working with
private boolean zeichneWareneingangsMenu(MFWorkplaceInfo infoItem) {
MFWorkplaceInfo tempItem = new MFWorkplaceInfo();
MFWorkplaceTopic tempTopic = = new MFWorkplaceTopic(
"Wareneingang", tempItem);
...
addTopicToInfo(infoItem, tempTopic);
...
}
protected void addTopicToInfo(MFWorkplaceInfo info, MFWorkplaceTopic topic) {
/* check if the topic contains any subelements or do something similar */
if (topic.getTree().getRowCount()==0) return;
/* else add the topic to the MFWorkplaceInfo */
Class cinfo = info.getClass();
Class[] parameterTypes = new Class[] {MFWorkplaceTopic.class};
Method getMethod = null;
try {
getMethod = cinfo.getDeclaredMethod("addTopic", parameterTypes);
} catch (SecurityException e) {
logger.info("WorkplaceHelper.SecurityException()"+e.getMessage());
} catch (NoSuchMethodException e) {
logger.info("WorkplaceHelper.NoSuchMethodException()"+e.getMessage());
}
logger.info("WorkplaceHelper.getMethod()"+getMethod);
Object[] objects = new Object[] {topic};
try {
getMethod.setAccessible(true);
getMethod.invoke(info,objects);
} catch (IllegalArgumentException e) {
logger.info("WorkplaceHelper.IllegalArgumentException()");
} catch (IllegalAccessException e) {
logger.info("WorkplaceHelper.IllegalAccessException()"+e.getMessage());
} catch (InvocationTargetException e) {
logger.info("WorkplaceHelper.InvocationTargetException()");
}
}
Best regards
Kai L