I just cooked up a little action of my own that looks like this:
Code:
public class SwitchToViewCommand extends ApplicationWindowAwareCommand {
private ViewDescriptor viewDescriptor;
public ViewDescriptor getViewDescriptor () { return viewDescriptor; }
public void setViewDescriptor (final ViewDescriptor viewDescriptor) {
this.viewDescriptor = viewDescriptor;
setDefaultButton();
}
protected void doExecuteCommand () {
getApplicationWindow().getPage().showView(getViewDescriptor());
}
}
then in your commands-ctx.xml you can specify those right into the toolbar passing the view descriptors that you declare in your app context like this:
Code:
<bean id="toolBar"
class="org.springframework.richclient.command.CommandGroupFactoryBean">
<property name="members">
<list>
<bean class="SwitchToViewCommand">
<property name="viewDescriptor">
<ref bean="view1" />
</property>
</bean>
<bean class="SwitchToViewCommand">
<property name="viewDescriptor">
<ref bean="view2" />
</property>
</bean>
</list>
</property>
</bean>
I also played around with a toggle group, which makes sense in this situation, but I was not able to configure it to look the way I think it should (it should look exactly like Eclipse's perpective switch bar). I just could not figure out where I would tweak the platform to do what I want. Use of toggle group would be really cool here because then all the other buttons can be changed visually by the group controller.