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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
}
Aggregations