use of javax.faces.component.html.HtmlOutputText in project gdmatrix by gdmatrix.
the class HtmlDataScrollerRenderer method getLink.
protected HtmlCommandLink getLink(FacesContext facesContext, HtmlDataScroller scroller, String text, int pageIndex) {
String id = HtmlDataScrollerRenderer.PAGE_NAVIGATION + Integer.toString(pageIndex);
Application application = facesContext.getApplication();
// TOMAHAWK-596 Duplicate id exception for HtmlDataScrollerRenderer
// For prevent this condition, try to detect if there is a component.
// Theorically this method should always return null, but it is known
// than in some cases (portlet) when the state manager is different from
// the default one, transient components are saved on the component tree.
// Really the error is on the jsf portlet bridge implementation used, but
// do this does not cause any side effect.
HtmlCommandLink link = (HtmlCommandLink) scroller.findComponent(scroller.getId() + id);
if (link == null) {
// See Jira Issue TOMAHAWK-117 http://issues.apache.org/jira/browse/TOMAHAWK-117
// and http://issues.apache.org/jira/browse/MYFACES-1809
link = new HtmlAriaCommandLink();
link.setId(scroller.getId() + id);
link.setTransient(true);
List children = link.getChildren();
if (text != null) {
HtmlOutputText uiText = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
uiText.setId(scroller.getId() + id + "_text");
uiText.setTransient(true);
uiText.setValue(text);
children.add(uiText);
}
scroller.getChildren().add(link);
} else {
UIOutput uiText = (UIOutput) link.findComponent(scroller.getId() + id + "_text");
if (uiText != null) {
// Update text value
uiText.setValue(text);
}
removeParameterFromList(link.getChildren(), scroller.getId() + id + "_param");
}
UIParameter parameter = (UIParameter) application.createComponent(UIParameter.COMPONENT_TYPE);
parameter.setId(scroller.getId() + id + "_param");
parameter.setTransient(true);
parameter.setName(scroller.getClientId(facesContext));
parameter.setValue(id);
List children = link.getChildren();
children.add(parameter);
return link;
}
use of javax.faces.component.html.HtmlOutputText in project gdmatrix by gdmatrix.
the class QueryInstanceBean method addLabelComponents.
private void addLabelComponents(String label, String expression, List<Query.Parameter> parameters, HtmlPanelGroup exprPanelGroup) {
int index1 = 0;
int index2;
for (Query.Parameter parameter : parameters) {
String paramName = parameter.getName();
String tag = "${" + paramName + "}";
index2 = label.indexOf(tag, index1);
if (index2 != -1) {
String text = label.substring(index1, index2);
id++;
HtmlOutputText outputText = new HtmlOutputText();
outputText.setId("output_" + id);
outputText.setValue(text);
outputText.setStyleClass("part");
exprPanelGroup.getChildren().add(outputText);
index1 = index2 + tag.length();
addParameterComponent(parameter, expression, exprPanelGroup);
}
}
if (index1 < label.length()) {
id++;
String text = label.substring(index1);
HtmlOutputText outputText = new HtmlOutputText();
outputText.setId("output_" + id);
outputText.setValue(text);
outputText.setStyleClass("part");
exprPanelGroup.getChildren().add(outputText);
}
}
use of javax.faces.component.html.HtmlOutputText in project empire-db by apache.
the class TextInputControl method createUnitLabel.
protected UIComponent createUnitLabel(String tagStyle, InputInfo ii, String value) {
HtmlOutputText text = new HtmlOutputText();
text.setValue(value);
// wrap
HtmlPanelGroup span = new HtmlPanelGroup();
/*
--- dataTypeClass not needed ---
String dataTypeClass = TagEncodingHelper.getDataTypeClass(ii.getColumn().getDataType());
String styleClass = TagEncodingHelper.getTagStyleClass(tagStyle, dataTypeClass, null, null);
*/
span.getAttributes().put("styleClass", tagStyle);
span.getChildren().add(text);
return span;
}
use of javax.faces.component.html.HtmlOutputText in project empire-db by apache.
the class TagEncodingHelper method addRequiredMark.
protected void addRequiredMark(HtmlOutputLabel label) {
HtmlPanelGroup span = new HtmlPanelGroup();
span.setStyleClass("required");
HtmlOutputText text = new HtmlOutputText();
text.setValue("*");
span.getChildren().add(text);
label.getChildren().add(span);
}
use of javax.faces.component.html.HtmlOutputText in project gdmatrix by gdmatrix.
the class HtmlCalendarRenderer method writeLink.
/**
* Create child components to represent a link to a specific date value, and render them.
* <p>
* For a disabled calendar, this just creates a Text component, attaches it as a child
* of the calendar and renders it. The value of the component is the string returned by
* valueForLink.getTime().
* <p>
* For a non-disabled calendar, create an HtmlCommandLink child that wraps the text
* returned by valueForLink.getTime(), and add it to the component.
*/
private void writeLink(String content, UIInput component, FacesContext facesContext, Date valueForLink, String linkTitle) throws IOException {
Converter converter = getConverter(component);
Application application = facesContext.getApplication();
HtmlOutputText text = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
text.setValue(content);
text.setId(component.getId() + "_" + valueForLink.getTime() + "_text");
text.setTransient(true);
HtmlInputCalendar calendar = (HtmlInputCalendar) component;
if (isDisabled(facesContext, component) || calendar.isReadonly()) {
component.getChildren().add(text);
RendererUtils.renderChild(facesContext, text);
return;
}
HtmlAriaCommandLink link = (HtmlAriaCommandLink) application.createComponent("HtmlAriaCommandLink");
link.setId(component.getId() + "_" + valueForLink.getTime() + "_link");
link.setTransient(true);
link.setImmediate(component.isImmediate());
if (linkTitle != null) {
Locale locale = facesContext.getViewRoot().getLocale();
ResourceBundle bundle = ResourceBundle.getBundle("org.santfeliu.faces.render.myfaces.calendar.resources.CalendarBundle", locale);
link.setTitle(bundle.getString(linkTitle));
link.setAriaLabel(bundle.getString(linkTitle));
}
UIParameter parameter = (UIParameter) application.createComponent(UIParameter.COMPONENT_TYPE);
parameter.setId(component.getId() + "_" + valueForLink.getTime() + "_param");
parameter.setTransient(true);
parameter.setName(component.getClientId(facesContext));
parameter.setValue(converter.getAsString(facesContext, component, valueForLink));
RendererUtils.addOrReplaceChild(component, link);
link.getChildren().add(parameter);
link.getChildren().add(text);
RendererUtils.renderChild(facesContext, link);
}
Aggregations