/* (non-Javadoc)
   * @see org.xidget.feature.IWidgetCreationFeature#createWidget()
   */
  public void createWidgets() {
    jPanel = new Canvas(xidget, new AnchorLayoutManager(xidget));
    jPanel.addMouseListener(mouseListener);
    jPanel.addMouseMotionListener(mouseListener);

    // create titled border if necessary (but not for tab entries)
    IXidget parent = xidget.getParent();
    if (parent != null && hasTitle()) {
      if (!parent.getConfig().isType("tabs")) jPanel.setBorder(new TitledBorder(getTitle()));
    }

    component = jPanel;

    // create scrollpane if requested
    if (Xlate.get(xidget.getConfig(), "scroll", false)) {
      component = new JScrollPane(jPanel);
    }

    // add panel to parent container
    IXidget xidgetParent = xidget.getParent();
    if (xidgetParent != null) {
      IWidgetContainerFeature containerFeature =
          xidget.getParent().getFeature(IWidgetContainerFeature.class);
      if (containerFeature != null) {
        int index = xidgetParent.getChildren().indexOf(xidget);
        containerFeature.addWidget(index, xidget);
      }
    }
  }
  /* (non-Javadoc)
   * @see org.xidget.feature.IWidgetCreationFeature#destroyWidget()
   */
  public void destroyWidgets(IXidget parent) {
    // remove from parent
    IWidgetContainerFeature containerFeature = parent.getFeature(IWidgetContainerFeature.class);
    if (containerFeature != null) containerFeature.removeWidget(xidget);

    // clear references
    jPanel = null;
    component = null;
  }
Esempio n. 3
0
 /* (non-Javadoc)
  * @see org.xidget.IBindingRule#applies(org.xidget.IXidget, org.xmodel.IModelObject)
  */
 public boolean applies(IXidget xidget, IModelObject element) {
   return xidget.getFeature(IWidgetFeature.class) != null;
 }