Skip to Content
0
Former Member
Mar 04, 2004 at 12:06 PM

Compile-time check identification of view elements

30 Views

Hi all,

i've posted this as a reply to another post already, i post it again here.

I think, it would be a good idea to generate an (maybe inner) interface class for each view controller which could be used to identify the view elements, which where created at design time (of course this is not possible for the elements added at runtime). This would increase the maintainability of code significantly.

For example, if i create a view "WorkView" which contains a button "ExitButton" and a checkbox "AdvancedSearch", the framework could generate an interface "IViewElementsWorkView" or inner interface "IPrivateWorkView.IViewElements", containing something like:

public final static String EXIT_BUTTON_ID = "ExitButton";

public final static String ADVANCED_SEARCH_ID = "AdvancedSearch";

...

Then, in the wdDoModifyView method, i could do something like:

if (firstTime) {

IWDButton exitButton = (IWDButton) view.getElement(IViewElementsWorkView.EXIT_BUTTON_ID);

IWDCheckBox advSearch = (IWDCheckBox) view.getElement(IViewElementsWorkView.ADVANCED_SEARCH_ID );

}

The compiler will then be able to check, if a view element has been removed or renamed, just like it's possible using the component's messages by the IMessageXXX class. This would be helpful regardless the fact, that the view elements could have been removed or destroyed at runtime.

Best regards,

Stefan