use of javax.faces.component.html.HtmlCommandButton in project gdmatrix by gdmatrix.
the class QueryInstanceBean method addPredicateComponents.
private void addPredicateComponents(Predicate predicate, HtmlPanelGroup exprPanelGroup) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
exprPanelGroup.setStyleClass("expression predicate");
addLabelComponents(predicate.getLabel(), "expressions['" + predicate.getId() + "'].parameterValuesMap", predicate.getParameters(), exprPanelGroup);
id++;
HtmlCommandButton button = new HtmlCommandButton();
button.setId("button_" + id);
MethodBinding method = application.createMethodBinding("#{queryInstanceBean.expressionWrappers['" + predicate.getId() + "'].removeExpression}", new Class[0]);
button.setAction(method);
button.setImage("/common/misc/images/remove_expr.png");
button.setStyleClass("expr_button remove");
exprPanelGroup.getChildren().add(button);
}
use of javax.faces.component.html.HtmlCommandButton in project gdmatrix by gdmatrix.
the class QueryInstanceBean method addOperatorComponents.
private void addOperatorComponents(Operator operator, HtmlPanelGroup exprPanelGroup) {
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
ValueBinding valueBinding = context.getApplication().createValueBinding("expression #{queryInstanceBean.expressions['" + operator.getId() + "'].type}");
exprPanelGroup.setValueBinding("styleClass", valueBinding);
if (operator.getType().equals(Operator.ROOT)) {
addLabelComponents(selectedInstance.getQuery().getLabel(), "selectedInstance.globalParameterValuesMap", selectedInstance.getQuery().getGlobalParameters(), exprPanelGroup);
} else // other operators: and, or, nor
{
// add operator select box
id++;
HtmlSelectOneMenu selectMenu = new HtmlSelectOneMenu();
selectMenu.setId(operator.getType() + "_" + id);
selectMenu.setStyleClass("operator");
selectMenu.setOnchange("submit();");
String valueExpr = "#{queryInstanceBean.expressions['" + operator.getId() + "'].type}";
valueBinding = context.getApplication().createValueBinding(valueExpr);
selectMenu.setValueBinding("value", valueBinding);
ArrayList list = new ArrayList();
SelectItem item1 = new SelectItem();
item1.setDescription(Operator.AND);
item1.setValue(Operator.AND);
item1.setLabel(getQueryLabel(Operator.AND));
list.add(item1);
SelectItem item2 = new SelectItem();
item2.setDescription(Operator.OR);
item2.setValue(Operator.OR);
item2.setLabel(getQueryLabel(Operator.OR));
list.add(item2);
SelectItem item3 = new SelectItem();
item3.setDescription(Operator.NOR);
item3.setValue(Operator.NOR);
item3.setLabel(getQueryLabel(Operator.NOR));
list.add(item3);
id++;
UISelectItems selectItems = new UISelectItems();
selectItems.setId("si_" + id);
selectItems.setValue(list);
selectMenu.getChildren().add(selectItems);
exprPanelGroup.getChildren().add(selectMenu);
id++;
HtmlCommandButton button = new HtmlCommandButton();
button.setId("button_" + id);
MethodBinding method = application.createMethodBinding("#{queryInstanceBean.expressionWrappers['" + operator.getId() + "'].removeExpression}", new Class[0]);
button.setAction(method);
button.setImage("/common/misc/images/remove_expr.png");
button.setStyleClass("expr_button remove");
exprPanelGroup.getChildren().add(button);
}
id++;
HtmlPanelGroup subPanelGroup = new HtmlPanelGroup();
subPanelGroup.setId("comp_" + id);
subPanelGroup.setStyleClass("op_children");
exprPanelGroup.getChildren().add(subPanelGroup);
for (Expression expr : operator.getArguments()) {
addExpressionComponents(expr, subPanelGroup);
if (!operator.getType().equals(Operator.ROOT)) {
id++;
HtmlOutputText linkText = new HtmlOutputText();
linkText.setId("link_" + id);
valueBinding = application.createValueBinding("#{queryInstanceBean.expressionWrappers['" + operator.getId() + "'].linkLabel}");
linkText.setValueBinding("value", valueBinding);
linkText.setStyleClass("operator_link");
subPanelGroup.getChildren().add(linkText);
}
}
if (operator.equals(selectedExpression)) {
addExpressionList(context, subPanelGroup);
} else {
id++;
HtmlCommandButton button = new HtmlCommandButton();
button.setId("button_" + id);
MethodBinding method = application.createMethodBinding("#{queryInstanceBean.expressionWrappers['" + operator.getId() + "'].selectExpression}", new Class[0]);
button.setAction(method);
button.setImage("/common/misc/images/add_expr.png");
button.setStyleClass("expr_button add");
ValueBinding value = application.createValueBinding("#{queryInstanceBean.expressionWrappers['" + operator.getId() + "'].addButtonRendered}");
button.setValueBinding("rendered", value);
subPanelGroup.getChildren().add(button);
}
}
use of javax.faces.component.html.HtmlCommandButton in project gdmatrix by gdmatrix.
the class QueryInstanceBean method addExpressionList.
private void addExpressionList(FacesContext context, HtmlPanelGroup subPanelGroup) {
id++;
HtmlDataList dataList = new HtmlDataList();
dataList.setId("data_list_" + id);
dataList.setVar("expression");
dataList.setLayout("unorderedList");
dataList.setStyleClass("data_list");
ArrayList list = new ArrayList();
list.add(OPERATOR_PREFIX + Operator.AND);
list.add(OPERATOR_PREFIX + Operator.OR);
list.add(OPERATOR_PREFIX + Operator.NOR);
List<Query.Predicate> predicates = getQuery().getPredicates();
for (Query.Predicate predicate : predicates) {
list.add(predicate.getName());
}
dataList.setValue(list);
subPanelGroup.getChildren().add(dataList);
id++;
HtmlCommandLink link = new HtmlCommandLink();
link.setId("expr_link_" + id);
Application application = context.getApplication();
MethodBinding method = application.createMethodBinding("#{queryInstanceBean.addExpression}", new Class[0]);
link.setAction(method);
ValueBinding valueBinding = application.createValueBinding("#{queryInstanceBean.expressionLabel}");
link.setValueBinding("value", valueBinding);
link.setStyleClass("expr_option");
dataList.getChildren().add(link);
id++;
HtmlCommandButton cancelButton = new HtmlCommandButton();
cancelButton.setId("cancel_link_" + id);
method = context.getApplication().createMethodBinding("#{queryInstanceBean.cancel}", new Class[0]);
cancelButton.setAction(method);
valueBinding = application.createValueBinding("#{objectBundle.cancel}");
cancelButton.setValueBinding("value", valueBinding);
cancelButton.setStyleClass("big_button");
subPanelGroup.getChildren().add(cancelButton);
}
Aggregations