|
Re: PlannerField in 6.0 [message #1745822 is a reply to message #1745738] |
Mon, 17 October 2016 22:27 |
Stefan Mutschler Messages: 26 Registered: June 2012 Location: Baden-Baden, Germany |
Junior Member |
|
|
After further investigation I still run into a problem. But in the meantime I am not sure if it is a problem of my understanding. More and more I believe it could also be a bug in 6.0.100.RC4.
With a planner field in a form like this
@Order(1000)
public class MainBox extends AbstractGroupBox {
@Order(101000)
public class TrainerPlannerField extends AbstractPlannerField<TrainerPlannerField.Planner, Long, Long> {
public class Planner extends AbstractPlanner<Long, Long> {
@Override
protected Set<Integer> getConfiguredAvailableDisplayModes() {
return CollectionUtility.hashSet(
IPlannerDisplayMode.MONTH,
IPlannerDisplayMode.YEAR);
}
@Override
protected int getConfiguredDisplayMode() {
return IPlannerDisplayMode.MONTH;
}
}
@Override
protected List<Resource<Long>> execLoadResources() {
List<Resource<Long>> rl = new ArrayList<Resource<Long>>();
Resource<Long> r = new Resource<Long>(1L, "Test Resource");
Activity<Long, Long> a = new Activity<Long, Long>(1L, 4711L);
a.setText("Test Activity");
Calendar start = Calendar.getInstance();
start.clear();
start.set(2016, 9, 24, 7, 0);
a.setBeginTime(start.getTime());
Calendar end = Calendar.getInstance();
end.clear();
end.set(2016, 9, 24, 9, 0);
a.setEndTime(end.getTime());
r.addActivity(a);
rl.add(r);
return rl;
}
@Override
protected int getConfiguredGridH() {
return 10;
}
@Override
protected boolean getConfiguredLabelVisible() {
return false;
}
}
}
I get an "internal UI error (code T6)" and the browser console (chrome) shows application-all-bb337778.min.js:9 Uncaught TypeError: Cannot read property 'children' of undefined at the following code line var scaleItemsLarge=this.planner.$timelineLarge.children(".scale-item") It seems that $timelineLarge is undefined at that time.
Any ideas on this? Do I have to add something to make this work?
[Updated on: Wed, 26 October 2016 18:15] Report message to a moderator
|
|
|
|
|
|
Re: PlannerField in 6.0 [message #1837828 is a reply to message #1746387] |
Mon, 08 February 2021 11:31 |
Mark Ashworth Messages: 40 Registered: January 2012 |
Member |
|
|
Good day,
I have followed the suggestions in this thread to get the PlannerField to work. If someone could indicate which children the error is referring to because it seems like it is meant to be the Actvities/Resources but I have added those in the execLoadResources and I am not sure what other field I am meant to declare as an inner class of Planner since I have tried the TableField when I saw the Swing PlannerField discussion but TableField also did not work.
@Order(1250)
public class ActivityPlannerField extends AbstractPlannerField<ActivityPlanner, Long, Long> {
@Override
protected boolean getConfiguredLabelVisible() {
return false;
}
@Override
protected int getConfiguredGridW() {
return FULL_WIDTH;
}
@Override
protected void execInitField() {
getPlanner().setDisplayMode(IPlannerDisplayMode.CALENDAR_WEEK);
loadResources();
}
@Override
protected List<Resource<Long>> execLoadResources() {
System.out.println("Planner load resources");
ProjectPlan projectPlan = BEANS.get(IPlanningService.class).retrieveProjectPlan(1L);
List<Resource<Long>> resources = new ArrayList<>();
try {
Resource<Long> resource = new Resource<>(1L, "DEV1");
for (ProjectActivity projectActivity : projectPlan.getActivities()) {
Activity<Long, Long> activity = new Activity<>(projectActivity.getProperties());
resource.addActivity(activity);
}
resources.add(resource);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Planner load resources " + resources.size());
return resources;
}
public class ActivityPlanner extends AbstractPlanner<Long, Long> {
@Override
protected Set<Integer> getConfiguredAvailableDisplayModes() {
return CollectionUtility.hashSet(
IPlannerDisplayMode.WEEK,
IPlannerDisplayMode.CALENDAR_WEEK,
IPlannerDisplayMode.MONTH);
}
@Override
protected boolean getConfiguredActivitySelectable() {
return true;
}
@Order(1000)
public class TestMenu extends AbstractMenu {
@Override
protected String getConfiguredText() {
return TEXTS.get("MyNlsKey");
}
@Override
protected Set<? extends IMenuType> getConfiguredMenuTypes() {
return CollectionUtility.hashSet();
}
@Override
protected void execAction() {
}
}
}
}
2021-02-06 11:35:18,441 INFO [qtp1179792105-34] org.eclipse.scout.rt.ui.html.json.JsonMessageRequestHandler.createUiSession(JsonMessageRequestHandler.java:362) - Created new UI session with ID 1:11vitsd36lao6kqrbs816a995aunna95tm05dd3oi3j1kcuqlguo in 1315.383300 ms [maxIdleTime=14400s, httpSession.maxInactiveInterval=3600s] - MDC[principal=USER, cid=kB5Kr2dG2DW/1]
Planner load resources
Planner load resources 1
2021-02-06 11:35:29,462 ERROR [qtp1179792105-31] org.eclipse.scout.rt.ui.html.json.JsonMessageRequestHandler.handleLogRequest(JsonMessageRequestHandler.java:254) - JavaScript exception occured while processing event pageChanged for adapter Outline[id=12, modelClass=com.github.markash.micro.client.work.WorkOutline, parentId=1]
Cannot read property 'children' of undefined
at PlannerLayout._minWidth (webpack:///node_modules/@eclipse-scout/core/src/planner/PlannerLayout.js:142:0)
at PlannerLayout._updateMinWidth (webpack:///node_modules/@eclipse-scout/core/src/planner/PlannerLayout.js:76:0)
at PlannerLayout.layout (webpack:///node_modules/@eclipse-scout/core/src/planner/PlannerLayout.js:65:0)
at HtmlComponent.validateLayout (webpack:///node_modules/@eclipse-scout/core/src/layout/HtmlComponent.js:143:0)
at HtmlComponent.setBounds (webpack:///node_modules/@eclipse-scout/core/src/layout/HtmlComponent.js:461:0)
at FormFieldLayout.layout (webpack:///node_modules/@eclipse-scout/core/src/form/fields/FormFieldLayout.js:143:0)
at HtmlComponent.validateLayout (webpack:///node_modules/@eclipse-scout/core/src/layout/HtmlComponent.js:143:0)
at HtmlComponent.setBounds (webpack:///node_modules/@eclipse-scout/core/src/layout/HtmlComponent.js:461:0)
at LogicalGridLayout._layout (webpack:///node_modules/@eclipse-scout/core/src/layout/logicalgrid/LogicalGridLayout.js:192:0)
at LogicalGridLayout.layout (webpack:///node_modules/@eclipse-scout/core/src/layout/logicalgrid/LogicalGridLayout.js:125:0) - MDC[principal=USER, httpUri=log, uiSession=1:11vitsd36lao6kqrbs816a995aunna95tm05dd3oi3j1kcuqlguo, cid=UX9KC9zS5xx/4]
2021-02-06 11:35:36,266 ERROR [qtp1179792105-34] org.eclipse.scout.rt.ui.html.json.JsonMessageRequestHandler.handleLogRequest(JsonMessageRequestHandler.java:254) - JavaScript exception occured
Cannot read property 'children' of undefined
at PlannerLayout._minWidth (webpack:///node_modules/@eclipse-scout/core/src/planner/PlannerLayout.js:142:0)
at PlannerLayout._updateMinWidth (webpack:///node_modules/@eclipse-scout/core/src/planner/PlannerLayout.js:76:0)
at PlannerLayout.layout (webpack:///node_modules/@eclipse-scout/core/src/planner/PlannerLayout.js:65:0)
at HtmlComponent.validateLayout (webpack:///node_modules/@eclipse-scout/core/src/layout/HtmlComponent.js:143:0)
at HtmlComponent.setBounds (webpack:///node_modules/@eclipse-scout/core/src/layout/HtmlComponent.js:461:0)
at FormFieldLayout.layout (webpack:///node_modules/@eclipse-scout/core/src/form/fields/FormFieldLayout.js:143:0)
at HtmlComponent.validateLayout (webpack:///node_modules/@eclipse-scout/core/src/layout/HtmlComponent.js:143:0)
at HtmlComponent.setBounds (webpack:///node_modules/@eclipse-scout/core/src/layout/HtmlComponent.js:461:0)
at LogicalGridLayout._layout (webpack:///node_modules/@eclipse-scout/core/src/layout/logicalgrid/LogicalGridLayout.js:192:0)
at LogicalGridLayout.layout (webpack:///node_modules/@eclipse-scout/core/src/layout/logicalgrid/LogicalGridLayout.js:125:0) - MDC[principal=USER
Thank you for your assistance.
Kind regards,
Mark Ashworth
|
|
|
Re: PlannerField in 6.0 [message #1837856 is a reply to message #1837828] |
Mon, 08 February 2021 17:13 |
|
Your code looks alright, no need to mix tables and planners. The "children" mentioned in the error message are releated to DOM elements in the browser.
Unfortunately, the implementation seems to be quite picky about the correct property values. In your case, the property "viewRange" is not initialized, which the planner doesn't like. Apparently the viewRange would be automatically calculated when you set the display mode. Unfortunately, CALENDAR_WEEK is already the default value, so this calculation is not triggered. The easiest fix would therefore be to initialize the display mode to some other value first.
@Override
protected void execInitField() {
getPlanner().setDisplayMode(0); // <--
getPlanner().setDisplayMode(IPlannerDisplayMode.CALENDAR_WEEK);
loadResources();
}
I'm not an expert on the Planner widget, but this seems to do the trick. If someone knows of a better way, please let us know.
Regards,
Beat
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08263 seconds