/**
  * This method gets called when a bound property is changed.
  *
  * @param evt A PropertyChangeEvent object describing the event source and the property that has
  *     changed.
  */
 public void propertyChange(final PropertyChangeEvent evt) {
   if (StringUtils.isEmpty(getWrapper().getDrillDownPath())) {
     paramTableElement.setDisabled(true);
   } else {
     paramTableElement.setDisabled(false);
   }
 }
Beispiel #2
0
 public void dispose() {
   super.dispose();
   List<XulComponent> pops = xulDomContainer.getDocumentRoot().getElementsByTagName("menupopup");
   for (XulComponent pop : pops) {
     ((MenuManager) pop.getManagedObject()).dispose();
   }
 }
  private void loadDatabaseOptionsFragment(
      String fragmentUri,
      final DataHandler dataHandler,
      final IDatabaseType database,
      final IFragmentHandler.Callback parentCallback)
      throws XulException {

    // clean out group before reloading
    XulComponent groupElement = document.getElementById("database-options-box"); // $NON-NLS-1$
    for (XulComponent component : groupElement.getChildNodes()) {
      groupElement.removeChild(component);
    }

    XulComponent parentElement = groupElement.getParent();
    XulDomContainer fragmentContainer = null;

    //    try {

    // Get new group box fragment ...
    // This will effectively set up the SWT parent child relationship...

    IXulLoaderCallback internalCallback =
        new IXulLoaderCallback() {
          public void overlayLoaded() {
            // TODO Auto-generated method stub
            afterOverlay(dataHandler, database);
            if (parentCallback != null) {
              parentCallback.callback();
            }
          }

          public void overlayRemoved() {}

          public void xulLoaded(GwtXulRunner runner) {}
        };

    // this call will cache the individual overlays in a map within AsyncXulLoader
    AsyncXulLoader.loadOverlayFromUrl(
        GWT.getModuleBaseURL() + fragmentUri,
        GWT.getModuleBaseURL() + "databasedialog",
        (GwtXulDomContainer) getXulDomContainer(),
        internalCallback,
        true);

    //      fragmentContainer = this.xulDomContainer.loadFragment(fragmentUri, (Object)null);
    // //messages.getBundle());
    //      XulComponent newGroup = fragmentContainer.getDocumentRoot().getFirstChild();
    //      parentElement.replaceChild(groupElement, newGroup);

    //    } catch (XulException e) {
    //      e.printStackTrace();
    //      throw e;
    //    }

    //    if (fragmentContainer == null){
    //      return;
    //    }

  }
  public SwtLabel(Element self, XulComponent parent, XulDomContainer container, String tagName) {
    super(tagName);

    String multi = (self != null) ? self.getAttributeValue("multiline") : null;
    if (multi != null && multi.equals("true")) {
      label = new Label((Composite) parent.getManagedObject(), SWT.WRAP);
      setManagedObject(label);
    } else {
      cLabel = new CLabel((Composite) parent.getManagedObject(), SWT.NONE);
      setManagedObject(cLabel);
    }
  }
  public SwtWindow(Element self, XulComponent parent, XulDomContainer container, String tagName) {
    super(tagName);

    Shell possibleParent = null;

    orient = Orient.VERTICAL;

    if (container.getOuterContext() != null
        && container.getOuterContext() instanceof Shell
        && (self != null && self.getAttributeValue("proxyoutercontext") != null)) {
      shell = (Shell) container.getOuterContext();
    } else {

      // First, check to see if an outer context was passed before parser started...
      if (container.getOuterContext() != null && container.getOuterContext() instanceof Shell) {
        possibleParent = (Shell) container.getOuterContext();
      }

      // If not, then try to use the API's parent parameter...
      if ((possibleParent == null) && (parent != null)) {
        possibleParent = (Shell) parent.getManagedObject();
      }

      // Otherwise, you're on your own...
      shell =
          (possibleParent != null)
              ? new Shell(possibleParent, SWT.SHELL_TRIM)
              : new Shell(SWT.SHELL_TRIM);
    }

    shell.setLayout(new GridLayout());
    shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
    setManagedObject(shell);
    xulDomContainer = container;
  }
 protected XulMenupopup getXulPopupMenu(String id, String documentPath, IPentahoSession session) {
   XulDomContainer container = getXulContainer(documentPath, session);
   if (container != null) {
     List<XulComponent> components =
         container.getDocumentRoot().getElementsByTagName("menupopup"); // $NON-NLS-1$
     for (XulComponent component : components) {
       if (component.getId().equals(id) && component instanceof XulMenupopup) {
         return (XulMenupopup) component;
       }
     }
   }
   Logger.error(
       getClass().getName(),
       Messages.getErrorString(
           "BaseMenuProvider.ERROR_0003_COULD_NOT_GET_POPUP_MENU")); //$NON-NLS-1$
   return null;
 }
  protected XulMenubar getXulMenubar(String id, String documentPath, IPentahoSession session) {
    XulDomContainer container = getXulContainer(documentPath, session);
    if (container == null) {
      return null;
    }
    List<XulComponent> components =
        container.getDocumentRoot().getElementsByTagName("menubar"); // $NON-NLS-1$
    for (XulComponent component : components) {
      if (component instanceof XulMenubar && component.getId().equals(id)) {
        XulMenubar menubar = (XulMenubar) component;
        // now get customizations to it
        IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, session);
        List<?> menuCustomizations = pluginManager.getMenuCustomizations();
        for (Object custom : menuCustomizations) {
          if (custom instanceof IMenuCustomization) {
            IMenuCustomization item = (IMenuCustomization) custom;
            try {
              // apply each customization and log any failures
              MenuUtil.customizeMenu(menubar, item, getXulLoader());
            } catch (Exception e) {
              session.error(
                  Messages.getString(
                      "BaseMenuProvider.ERROR_0004_COULD_NOT_CUSTOMIZE_MENU",
                      item.getId(),
                      item.getLabel()),
                  e); //$NON-NLS-1$
            }
          }
        }

        return menubar;
      }
    }
    Logger.error(
        getClass().getName(),
        Messages.getErrorString(
            "BaseMenuProvider.ERROR_0002_COULD_NOT_GET_MENUBAR")); //$NON-NLS-1$
    return null;
  }