Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » PlannerField in 6.0
PlannerField in 6.0 [message #1745738] Sun, 16 October 2016 20:27 Go to next message
Stefan Mutschler is currently offline Stefan MutschlerFriend
Messages: 24
Registered: June 2012
Location: Baden-Baden, Germany
Junior Member
Hi,

back on a Scout project again I would like to use the PlannerField in conjunction with Scout 6.0. I never used the planner before and the best information I have found is a gist created about two years ago. Helpful and clearifying the general concept - but nevertheless I got stuck (or perhaps confused) in the actual implementation. Can anybody point me to the right direction with a short example or some code hints.

Thanks in advance

Stefan
Re: PlannerField in 6.0 [message #1745822 is a reply to message #1745738] Mon, 17 October 2016 22:27 Go to previous messageGo to next message
Stefan Mutschler is currently offline Stefan MutschlerFriend
Messages: 24
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 #1746315 is a reply to message #1745822] Wed, 26 October 2016 18:18 Go to previous messageGo to next message
Stefan Mutschler is currently offline Stefan MutschlerFriend
Messages: 24
Registered: June 2012
Location: Baden-Baden, Germany
Junior Member
Hmmm... do I have bad luck? Does anyone face the same phenomenon?
If I am the only one I believe something is wrong with my test code.
No hints for me?
Re: PlannerField in 6.0 [message #1746380 is a reply to message #1746315] Thu, 27 October 2016 20:35 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1243
Registered: October 2011
Senior Member
Sorry for the delay, we were busy at the EclipseCon Europe (and the days before that preparing the event). I have the same error with the code snippet you have provided... I have compared it with some code I have developed a long time ago.

The error disappears when I set the display mode of the planner during field initialization. I have also added "loadResources()" to load the data.

@Order(101000)
public class TrainerPlannerField extends AbstractPlannerField<TrainerPlannerField.Planner, Long, Long> {
	
	@Override
	protected void execInitField() {
		getPlanner().setDisplayMode(ICalendarDisplayMode.WEEK);
		loadResources();
	}

	//... rest of the implementation


The planner field probably deserves some documentation and some updated example, because the field is not easy to use.

Related discussion (old topic):
Swing PlannerField

----
I will be offline until the middle of next week.
Re: PlannerField in 6.0 [message #1746387 is a reply to message #1746380] Thu, 27 October 2016 23:29 Go to previous message
Stefan Mutschler is currently offline Stefan MutschlerFriend
Messages: 24
Registered: June 2012
Location: Baden-Baden, Germany
Junior Member
Thanks for the reply! EclipseCon of course... that wasn't on my mind any more. Hope it was a successful conference for you.

I just tried your suggestion and it worked. But as soon as I tried to switch to ICalendarDisplayMode.MONTH in execInitField() (since I wanted only to offer display mode 'month' and 'year') the problem occurred again. Playing around with some permutations I figured out that after having removed my override of getConfiguredDisplayMode() everything works fine.

A sample and some docs would be great but so far I am glad that I can go on with my implementation.

Thanks a lot for your help!
Previous Topic:server's session and UI's session
Next Topic:Security issue on Websphere
Goto Forum:
  


Current Time: Mon Oct 23 06:15:38 GMT 2017

Powered by FUDForum. Page generated in 0.01678 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software