2014년 12월 7일 일요일

Setters and Getters methods not showing up in Blocks Mode

I think this must be a silly question, but I've trying to create a new component, and none of the setters or getters are populated in the "Blocks" mode. When you click on the module, you see all the blocks representing the @SimpleProperty, but the last field is blank on all of them. 

I can copy say Notifier.java, rename to NotifierNew.java, and strip out all the methods except the @SimpleProperty, and then in Blocks mode the methods names are still available..... BUT if I create a new file, almost identical in structure, but code up some new methods for setter and getters, they are blank in the Design Mode. 

Is there something I'm missing in the formatting?  Is it tab/case/space sensitive somehow?  I've read the "How to Add a Component" and nothing stands out as missing?   Any thoughts on where to debug next? 



I believe this is an issue with the internationalisation code. Search for the class YaVersion.java and you will find some comments about how to add the missing pieces for new methods.
It's a rather messy way to do things and needs improving, but I believe it will fix your issue.



Awesome!  This was driving me nuts, a very important piece of info (you should paste this into the online manual for adding components). 

So the conclusions is that if you are creating a new @SimpleProperty that has never been used before, you need to go into OdeMessages.java and the TranslationComponentProperty.java files to add the String in order to display them. 

I can now see my Properties in Blocks mode, on to debugging the real internal code now..


// Note added after internationalization (8/25/2014)
// If you add any properties, events or methods to a component you *must*:
// Add an entry for each new property/event/method into
// OdeMessages.java iff a property with that name doesn't already
// exist (so if you are adding a property that has the same name as
// another property in a different component, you don't do it a
// second time). To add the "Foo" property you would add:
// @defaultMessage("Foo")
// @description(""
// String FooProperties();
// You then have to add a mapping to
// TranslationComponentProperties.java (or ..Methods or ..Events
// etc).
// If you edit the description of a component (but not yet a
// property,method or event of that component) you must also find and
// update the description in OdeMessages.java

댓글 없음:

댓글 쓰기