Announcement Announcement Module
Collapse
No announcement yet.
difference between form and view Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • difference between form and view

    Hi,

    a little background - in the last swing app I wrote (which was a *long* time ago) I attached a mouse listener to a JTree so that nodes were selected on a right-click, to mimic windows select-before-popup behaviour.

    After tinkering with RCP for a while I thought I'd try to implement the same behaviour as an interceptor (as an excercise to get to grips with RCP) in the petclinic - ensuring that *any* JTree in the app would get the desired behaviour.

    Alas, it would seem that the views in petclinic aren't plumbed in so that FormComponentInterceptors can be hooked up.

    This leaves me a bit confused now about the differences and relationships of views and forms.

    Is there anyone with an understanding of how this all fits together that would be willing to educate me?

    Thanks,
    Trevor

  • #2
    Trevor,

    a FormComponentInterceptor is resposible for postprocessing components created for a specific FormModel not postprocessing of components in general. We don't currently provide any kind of plugable interceptor functionality for the general case though it would be a nice feature to add.

    Ollie

    Comment


    • #3
      Trevor,

      the folowing class could be uses a general component interceptor. You'll need to provide your own implmentation of the postProcessComponent(JComponent comp) method:

      Code:
      public abstract class ComponentInterceptor implements AWTEventListener {
      	
      	public ComponentInterceptor() {
      		Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.CONTAINER_EVENT_MASK);
      	}
      	
      	public abstract void postProcessComponent(JComponent comp);
      	
      	public void eventDispatched(AWTEvent e) {
      		if (e.getSource() instanceof JComponent) {
      			JComponent comp = (JComponent) e.getSource();
      			if (comp.getClientProperty("intercepted") == null) {
      				comp.putClientProperty("intercepted", Boolean.TRUE);
      				postProcessComponent(comp);
      			}
      		}
      	}
      }
      Ollie

      Comment


      • #4
        Hi Oliver,

        your last response was very enlightening, I hadn't considered doing it like that. I appreciate the effort.

        However, I'm still a bit in the dark about the relationship between views and forms (because of the apparent differences in the way they are assembled).

        As I'm typing this, the following occurs to me: is it as simple as... RCP forms are like HTML forms and Views are like - umm - HTML pages?

        Thanks,
        Trevor

        Comment

        Working...
        X