Search in sources :

Example 6 with MethodBinding

use of javax.faces.el.MethodBinding in project acs-community-packaging by Alfresco.

the class ClipboardShelfItemTag method setProperties.

/**
 * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
 */
protected void setProperties(UIComponent component) {
    super.setProperties(component);
    setStringBindingProperty(component, "collections", this.collections);
    if (isValueReference(this.pasteActionListener)) {
        MethodBinding vb = getFacesContext().getApplication().createMethodBinding(this.pasteActionListener, ACTION_CLASS_ARGS);
        ((UIClipboardShelfItem) component).setPasteActionListener(vb);
    } else {
        throw new FacesException("Paste Action listener method binding incorrectly specified: " + this.pasteActionListener);
    }
}
Also used : MethodBinding(javax.faces.el.MethodBinding) UIClipboardShelfItem(org.alfresco.web.ui.repo.component.shelf.UIClipboardShelfItem) FacesException(javax.faces.FacesException)

Example 7 with MethodBinding

use of javax.faces.el.MethodBinding in project acs-community-packaging by Alfresco.

the class ShortcutsShelfItemTag method setProperties.

/**
 * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
 */
protected void setProperties(UIComponent component) {
    super.setProperties(component);
    setStringBindingProperty(component, "value", this.value);
    if (isValueReference(this.clickActionListener)) {
        MethodBinding vb = getFacesContext().getApplication().createMethodBinding(this.clickActionListener, ACTION_CLASS_ARGS);
        ((UIShortcutsShelfItem) component).setClickActionListener(vb);
    } else {
        throw new FacesException("Click Action listener method binding incorrectly specified: " + this.clickActionListener);
    }
    if (isValueReference(this.removeActionListener)) {
        MethodBinding vb = getFacesContext().getApplication().createMethodBinding(this.removeActionListener, ACTION_CLASS_ARGS);
        ((UIShortcutsShelfItem) component).setRemoveActionListener(vb);
    } else {
        throw new FacesException("Remove Action listener method binding incorrectly specified: " + this.clickActionListener);
    }
}
Also used : MethodBinding(javax.faces.el.MethodBinding) UIShortcutsShelfItem(org.alfresco.web.ui.repo.component.shelf.UIShortcutsShelfItem) FacesException(javax.faces.FacesException)

Example 8 with MethodBinding

use of javax.faces.el.MethodBinding in project acs-community-packaging by Alfresco.

the class UIDialogButtons method generateAdditionalButtons.

/**
 * If there are any additional buttons to add as defined by the dialog
 * configuration and the dialog at runtime they are generated in this
 * method.
 *
 * @param context Faces context
 */
@SuppressWarnings("unchecked")
protected void generateAdditionalButtons(FacesContext context) {
    // get potential list of additional buttons
    List<DialogButtonConfig> buttons = Application.getDialogManager().getAdditionalButtons();
    if (buttons != null && buttons.size() > 0) {
        if (logger.isDebugEnabled())
            logger.debug("Adding " + buttons.size() + " additional buttons: " + buttons);
        // add a spacing row to separate the additional buttons from the OK button
        addSpacingRow(context);
        for (DialogButtonConfig buttonCfg : buttons) {
            UICommand button = (UICommand) context.getApplication().createComponent(HtmlCommandButton.COMPONENT_TYPE);
            button.setRendererType(ComponentConstants.JAVAX_FACES_BUTTON);
            FacesHelper.setupComponentId(context, button, buttonCfg.getId());
            // setup the value of the button (the label)
            String label = buttonCfg.getLabel();
            if (label != null) {
                // see if the label represents a value binding
                if (label.startsWith(BINDING_EXPRESSION_START)) {
                    ValueBinding binding = context.getApplication().createValueBinding(label);
                    button.setValueBinding("value", binding);
                } else {
                    button.setValue(label);
                }
            } else {
                // NOTE: the config checks that a label or a label id
                // is present so we can assume there is an id
                // if there isn't a label
                String labelId = buttonCfg.getLabelId();
                label = Application.getMessage(context, labelId);
                button.setValue(label);
            }
            // setup the action binding, the config checks that an action
            // is present so no need to check for NullPointer. It also checks
            // it represents a method binding expression.
            String action = buttonCfg.getAction();
            MethodBinding methodBinding = context.getApplication().createMethodBinding(action, null);
            button.setAction(methodBinding);
            // setup the disabled attribute, check for null and
            // binding expressions
            String disabled = buttonCfg.getDisabled();
            if (disabled != null && disabled.length() > 0) {
                if (disabled.startsWith(BINDING_EXPRESSION_START)) {
                    ValueBinding binding = context.getApplication().createValueBinding(disabled);
                    button.setValueBinding("disabled", binding);
                } else {
                    button.getAttributes().put("disabled", Boolean.parseBoolean(disabled));
                }
            }
            // setup CSS class for the button
            String styleClass = (String) this.getAttributes().get("styleClass");
            if (styleClass != null) {
                button.getAttributes().put("styleClass", styleClass);
            }
            // setup the onclick handler for the button
            String onclick = buttonCfg.getOnclick();
            if (onclick != null && onclick.length() > 0) {
                button.getAttributes().put("onclick", onclick);
            }
            // add the button
            this.getChildren().add(button);
            if (logger.isDebugEnabled())
                logger.debug("Added button with id of: " + button.getId());
        }
        // add a spacing row to separate the additional buttons from the Cancel button
        addSpacingRow(context);
    }
}
Also used : ValueBinding(javax.faces.el.ValueBinding) DialogButtonConfig(org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig) MethodBinding(javax.faces.el.MethodBinding) UICommand(javax.faces.component.UICommand)

Example 9 with MethodBinding

use of javax.faces.el.MethodBinding in project acs-community-packaging by Alfresco.

the class RecentSpacesShelfItemTag method setProperties.

/**
 * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
 */
protected void setProperties(UIComponent component) {
    super.setProperties(component);
    setStringBindingProperty(component, "value", this.value);
    if (isValueReference(this.navigateActionListener)) {
        MethodBinding vb = getFacesContext().getApplication().createMethodBinding(this.navigateActionListener, ACTION_CLASS_ARGS);
        ((UIRecentSpacesShelfItem) component).setNavigateActionListener(vb);
    } else {
        throw new FacesException("Navigate Action listener method binding incorrectly specified: " + this.navigateActionListener);
    }
}
Also used : UIRecentSpacesShelfItem(org.alfresco.web.ui.repo.component.shelf.UIRecentSpacesShelfItem) MethodBinding(javax.faces.el.MethodBinding) FacesException(javax.faces.FacesException)

Example 10 with MethodBinding

use of javax.faces.el.MethodBinding in project acs-community-packaging by Alfresco.

the class ShelfTag method setProperties.

/**
 * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
 */
protected void setProperties(UIComponent component) {
    super.setProperties(component);
    setStringProperty(component, "groupPanel", this.groupPanel);
    setStringProperty(component, "groupBgcolor", this.groupBgcolor);
    setStringProperty(component, "selectedGroupPanel", this.selectedGroupPanel);
    setStringProperty(component, "selectedGroupBgcolor", this.selectedGroupBgcolor);
    setStringProperty(component, "innerGroupPanel", this.innerGroupPanel);
    setStringProperty(component, "innerGroupBgcolor", this.innerGroupBgcolor);
    if (this.groupExpandedActionListener != null) {
        if (isValueReference(this.groupExpandedActionListener)) {
            MethodBinding vb = getFacesContext().getApplication().createMethodBinding(this.groupExpandedActionListener, ACTION_CLASS_ARGS);
            ((UIShelf) component).setGroupExpandedActionListener(vb);
        } else {
            throw new FacesException("Shelf Group Expanded Action listener method binding incorrectly specified: " + this.groupExpandedActionListener);
        }
    }
}
Also used : UIShelf(org.alfresco.web.ui.repo.component.shelf.UIShelf) MethodBinding(javax.faces.el.MethodBinding) FacesException(javax.faces.FacesException)

Aggregations

MethodBinding (javax.faces.el.MethodBinding)10 FacesException (javax.faces.FacesException)6 ValueBinding (javax.faces.el.ValueBinding)3 UICommand (javax.faces.component.UICommand)2 ResponseWriter (javax.faces.context.ResponseWriter)1 SelectItem (javax.faces.model.SelectItem)1 DialogButtonConfig (org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig)1 UIGenericPicker (org.alfresco.web.ui.common.component.UIGenericPicker)1 UIListItems (org.alfresco.web.ui.common.component.UIListItems)1 UIModeList (org.alfresco.web.ui.common.component.UIModeList)1 UIPanel (org.alfresco.web.ui.common.component.UIPanel)1 UIClipboardShelfItem (org.alfresco.web.ui.repo.component.shelf.UIClipboardShelfItem)1 UIRecentSpacesShelfItem (org.alfresco.web.ui.repo.component.shelf.UIRecentSpacesShelfItem)1 UIShelf (org.alfresco.web.ui.repo.component.shelf.UIShelf)1 UIShortcutsShelfItem (org.alfresco.web.ui.repo.component.shelf.UIShortcutsShelfItem)1