Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have to integrate with Roo generated architecture so that you can still benefit from Roo scaffolding.</p> <p>Roo generated code hides most of behavior in <code>_Roo_Gwt</code> classes and it is because <a href="http://static.springsource.org/spring-roo/reference/html-single/#d4e2222" rel="nofollow noreferrer">GWT doesn’t currently support ITDs</a>. So changes have to be made in derived classes by overriding methods from <code>_Roo_Gwt</code> class.</p> <p>To navigate application use Places, ActivityMapper and ActivitiManager (you can find good read on @Thomas Broyer <a href="http://tbroyer.posterous.com/" rel="nofollow noreferrer">posterous</a> and <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html" rel="nofollow noreferrer">GWT help</a>).</p> <p>If you take a look in <code>ScaffoldDesktopShell.ui.xml</code> - page is devided in three main areas. <img src="https://i.stack.imgur.com/zLL09.png" alt="Roo Scaffolded Desktop Shell areas"> <code>ApplicationMasterActivities</code> class is responsible for master area.</p> <pre><code>masterActivityManager.setDisplay(shell.getMasterPanel()); </code></pre> <p><code>proxyListPlacePicker</code> in <code>ScaffoldDesktopApp.init()</code> generates place change event with apropriate <code>ProxyListPlace</code>.</p> <pre><code>public void onValueChange(ValueChangeEvent&lt;ProxyListPlace&gt; event) { placeController.goTo(event.getValue()); } </code></pre> <p><code>ApplicationMasterActivities</code> class creates appropriate Activity in Master area by checking <code>EntityProxy</code> type contained in <code>ProxyListPlace</code> object.</p> <pre><code>public Activity getActivity(Place place) { if (!(place instanceof ProxyListPlace)) { return null; } ProxyListPlace listPlace = (ProxyListPlace) place; return new ApplicationEntityTypesProcessor&lt;Activity&gt;() { @Override public void handlePet(PetProxy isNull) { setResult(new PetListActivity(requests, ScaffoldApp.isMobile() ? PetMobileListView.instance() : PetListView.instance(), placeController)); } @Override public void handleOwner(OwnerProxy isNull) { setResult(new OwnerListActivity(requests, ScaffoldApp.isMobile() ? OwnerMobileListView.instance() : OwnerListView.instance(), placeController)); } }.process(listPlace.getProxyClass()); } </code></pre> <p>Navigation is created by listing all EntityProxy's in <code>ScaffoldApp</code> class</p> <pre><code>protected HashSet&lt;ProxyListPlace&gt; getTopPlaces() { Set&lt;Class&lt;? extends EntityProxy&gt;&gt; types = ApplicationEntityTypesProcessor.getAll(); HashSet&lt;ProxyListPlace&gt; rtn = new HashSet&lt;ProxyListPlace&gt;(types.size()); for (Class&lt;? extends EntityProxy&gt; type : types) { rtn.add(new ProxyListPlace(type)); } return rtn; } </code></pre> <p>To output meaningfull name in navigation menu they are rendered using <code>ApplicationListPlaceRenderer</code></p> <pre><code>public String render(ProxyListPlace object) { return new ApplicationEntityTypesProcessor&lt;String&gt;() { @Override public void handlePet(PetProxy isNull) { setResult("Pets"); } @Override public void handleOwner(OwnerProxy isNull) { setResult("Owners"); } }.process(object.getProxyClass()); } </code></pre> <p>So you have to create new Activity. public class SomeActivity extends Composite implements Activity{</p> <pre><code>private static SomeActivityUiBinder uiBinder = GWT .create(SomeActivityUiBinder.class); interface SomeActivityUiBinder extends UiBinder&lt;Widget, SomeActivity&gt; { } private AcceptsOneWidget display; public SomeActivity() { initWidget(uiBinder.createAndBindUi(this)); } @Override public String mayStop() { return null; } @Override public void onCancel() { onStop(); } @Override public void onStop() { this.display.setWidget(null); } @Override public void start(AcceptsOneWidget panel, EventBus eventBus) { this.display = panel; this.display.setWidget(this); } } &lt;!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&gt; &lt;ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"&gt; &lt;g:HTMLPanel&gt; Hello world! &lt;/g:HTMLPanel&gt; &lt;/ui:UiBinder&gt; </code></pre> <p>Create appropriate EntityProxy. It is only to obey <code>ProxyListPlace</code> mechanism.</p> <pre><code>public interface SomeEntityProxy extends EntityProxy { } </code></pre> <p>Create SomeActivity in A</p> <pre><code>@Override public Activity getActivity(Place place) { if (!(place instanceof ProxyListPlace)) { return null; } Activity activity = super.getActivity(place); if (activity == null) { ProxyListPlace listPlace = (ProxyListPlace) place; if (SomeEntityProxy.class.equals(listPlace.getProxyClass())) { activity = new SomeActivity(); } } return activity; } </code></pre> <p>Add place to navigation in <code>ScaffoldApp</code> or override getTopPlaces in derived class.</p> <pre><code>rtn.add(new ProxyListPlace(SomeEntityProxy.class)); </code></pre> <p>Set correct menu rendering text in <code>ApplicationListPlaceRenderer</code></p> <pre><code>@Override public String render(ProxyListPlace object) { String label = super.render(object); if(label == null) { if (SomeEntityProxy.class.equals(object.getProxyClass())) { label = "Some activity"; } } return label; } </code></pre> <p><a href="https://github.com/abele/newactivity" rel="nofollow noreferrer">Code in GitHub</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload