use of javax.faces.component.html.HtmlOutputText 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.HtmlOutputText in project gdmatrix by gdmatrix.
the class WidgetTestBean method loadPanel.
private void loadPanel() {
panel = new HtmlPanelGrid();
panel.setId("panel_id");
// Add output
HtmlPanelGroup group = new HtmlPanelGroup();
group.setId("group_id");
HtmlOutputText output = new HtmlOutputText();
output.setId("output_id");
output.setValue("Hoy es: ");
group.getChildren().add(output);
HtmlCalendar cal = new HtmlCalendar();
cal.setId("cal_id");
cal.setValue(TextUtils.formatDate(new Date(), "dd/MM/yyyy"));
group.getChildren().add(cal);
panel.getChildren().add(group);
}
use of javax.faces.component.html.HtmlOutputText in project ctsms by phoenixctms.
the class ColumnManagementBean method getColumnName.
private static String getColumnName(Column column) {
String headerTextEl;
UIComponent headerFacet = column.getFacet("header");
try {
// in general, columns have a header facet with p:outputText
headerTextEl = ((HtmlOutputText) headerFacet).getValueExpression("value").getExpressionString();
} catch (ClassCastException e) {
// and there are columns with a dropdown in the header
headerTextEl = ((HtmlPanelGroup) headerFacet).getChildren().get(0).getValueExpression("label").getExpressionString();
}
// Remove #{}
return headerTextEl.substring(2, headerTextEl.length() - 1);
}
Aggregations