/** * Constructs an unbound text field with the specified initial value. This * will not interact with the bean model in any way. */ public static UIOutput make(UIContainer parent, String ID, String initvalue) { return make(parent, ID, initvalue, null); }
public static void setElementToFocus(UIComponent tofocus) { ViewRoot root = RSFUtil.findViewRoot(tofocus); UIOutput tofocusel = (UIOutput) root.getComponent(ELEMENT_ID_TO_FOCUS); if (tofocusel == null) { tofocusel = UIOutput.make(root, "elementIDToFocus"); } tofocusel.setValue(tofocus.getFullID()); } }
public UIJointContainer evolveDateInput(UIInput toEvolve, Date value) { // Pull in the template UIJointContainer togo = new UIJointContainer(toEvolve.parent, toEvolve.ID, COMPONENT_ID); // Remove the existing component from the tree toEvolve.parent.remove(toEvolve); String transitBean = transitBase + "." + togo.getFullID(); // Need ISO9601 support. ISO8601FieldDateTransit transit = (ISO8601FieldDateTransit) rbg.getBean(transitBean); if (value == null) { // The UIInput we're evolving must have a OTP bean for this to work. value = (Date) rbg.getBean(toEvolve.valuebinding.value); } if (value != null) { transit.setDate(value); } String ttb = transitBean + "."; UIOutput display = UIOutput.make(togo, "display"); UIInput field = UIInput.make(togo, "iso8601", ttb + "ISO8601", transit.getISO8601()); field.mustapply = true; // Bind the value back through to the transitBase. // This generates a custom hidden HTML UIForm form = RSFUtil.findBasicForm(togo); form.parameters.add(new UIELBinding(toEvolve.valuebinding.value, new ELReference(ttb + "date"))); UIInitBlock.make(togo, "init-date", "rsfDatePicker", new Object[] { display.getFullID(), field.getFullID(), // If we just supply a boolean it is output as a string // which doesn't work. (style.equals(DATE_TIME_INPUT) || style.equals(TIME_INPUT)) ? "1" : "0" }); return togo; }
UICommand helperBinding = (UICommand) view.viewroot.getComponent(HelperViewParameters.POST_HELPER_BINDING); tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.HELPER_ID, helperId.getValue()); if (helperBinding != null) { tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.POST_HELPER_BINDING, tsh.putTokenState(helperId.getValue() + Tool.HELPER_DONE_URL, bup.getBaseURL() + viewParameters.viewID + HELPER_FINISHED_PATH);
/** {@see UIInternalLink#make(UIContainer, String, UIBoundString, ViewParameters) */ public static UIInternalLink make(UIContainer parent, String ID, String text, ViewParameters viewparams) { UIBoundString linktext = null; if (text != null) { linktext = new UIOutput(); linktext.setValue(text); } return make(parent, ID, linktext, viewparams); }
.getComponent(HelperViewParameters.POST_HELPER_BINDING); tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID + HelperViewParameters.HELPER_ID, helperId.getValue()); if (helperBinding != null) { tsh.putTokenState(TOKEN_STATE_PREFIX + viewParameters.viewID tsh.putTokenState(helperId.getValue() + Tool.HELPER_DONE_URL, bup .getBaseURL() + viewParameters.viewID + HELPER_FINISHED_PATH);
/** * Construct a navigation link. * * @param parent Container to which the link is to be added. * @param ID RSF ID of this link. * @param text Text to be rendered for this link. * @param target See {@link #target} */ public static UILink make(UIContainer parent, String ID, String linktext, String target) { UIBoundString linktextnew = null; if (linktext != null) { linktextnew = new UIOutput(); linktextnew.setValue(linktext); } return make(parent, ID, linktextnew, target); }
/** * This constructor creates an output component that will simply select a * message already present in the template, free from any further interaction * with the code. */ public static UIOutput make(UIContainer parent, String ID) { return make(parent, ID, null, null); }
/** * Constructs a text field which is bound to a particular path in the bean * model. If the initial value is set to <code>null</code> (recommended), it * will be fetched automatically from the bean model during fixup. */ public static UIOutput make(UIContainer parent, String ID, String initvalue, String binding) { UIOutput togo = new UIOutput(); if (initvalue != null) { togo.setValue(initvalue); } togo.valuebinding = ELReference.make(binding); togo.ID = ID; parent.addComponent(togo); return togo; }
/** Creates a command link which will initiate a non-idempotent request * (action cycle) to handle the command. * @param parent The parent component to which this action link will be added * as a child. * @param text The text that will be rendered to the user on this component. * @param methodbinding An RSF EL expression representing the action to be * triggered when the user activates this link. */ public static UICommand make(UIContainer parent, String ID, String text, String methodbinding) { UIBoundString commandtext = null; if (text != null) { commandtext = new UIOutput(); commandtext.setValue(text); } return make(parent, ID, commandtext, methodbinding); }
public void renderMessages(MessageFlyweight flyweight, UIBranchContainer member, List messagelist) { if (messagelist == null || messagelist.size() == 0) return; flyweight.rsfMessages.addComponent(member); for (int i = 0; i < messagelist.size(); ++i) { TargettedMessage message = (TargettedMessage) messagelist.get(i); String resolved = message.resolve(messagelocator); if (resolved == null) { resolved = MessageUtil.renderDefaultMessage(message.messagecodes[0]); } UIOutput.make(member, "message:", resolved); } } }
/** * Construct a navigation link with a bound control (e.g. UIMessage) forming * the link text. */ public static UILink make(UIContainer parent, String ID, UIBoundString linktext, String target) { UILink togo = new UILink(); togo.ID = ID; togo.target = new UIOutput(); if (target != null) { togo.target.setValue(target); } togo.linktext = linktext; parent.addComponent(togo); return togo; }
public void makeSearchFilter(UIContainer tofill, String divID, String startingText) { UIJointContainer joint = new UIJointContainer(tofill, divID, "search-filter:", numHeaders+""); UIInput.make(joint, "search-text-input", null, startingText); UIOutput.make(joint, "find-button"); UIOutput.make(joint, "clear-button"); appendJS(HTMLUtil.emitJavascriptCall("theform.addSearchFilter", new String[] {joint.getFullID(),startingText})); numHeaders++; }
/** Create a link which, while internal, does not participate in the * ViewParameters system. This is largely useful for unmanaged environments * such as SpringMVC/Cocoon. Cannot be named "make" to avoid clashing with * UILink through ridiculous Java semantics on static methods. */ public static UIInternalLink makeURL(UIContainer parent, String ID, String target) { UIInternalLink togo = new UIInternalLink(); togo.ID = ID; togo.target = new UIOutput(); if (target != null) { togo.target.setValue(target); } parent.addComponent(togo); return togo; } /** ViewParameters representing the navigation target of this link control */
public void makeSortedHeader(UIContainer tofill, String thId, String linktext, String sortid, boolean curascending) { String newsortdir = curascending ? "asc" : "dsc"; String cursortdir = curascending ? "dsc" : "asc"; UIJointContainer joint; if (curascending) joint = new UIJointContainer(tofill, thId, "theader:cursort-asc-link", numHeaders+""); else joint = new UIJointContainer(tofill, thId, "theader:cursort-dsc-link", numHeaders+""); UIOutput sortlink = UIOutput.make(joint, "sort-link"); UIOutput.make(joint, "link-text", linktext); appendJS(HTMLUtil.emitJavascriptCall("theform.addSortedHeader", new String[] {joint.getFullID(), sortid, cursortdir, newsortdir})); numHeaders++; }
toprocess.target = new UIOutput();
public void makeSearchFilter(UIContainer tofill, String divID, String startingText) { UIJointContainer joint = new UIJointContainer(tofill, divID, "search-filter:", numHeaders+""); UIInput.make(joint, "search-text-input", null, startingText); UIOutput.make(joint, "find-button"); UIOutput.make(joint, "clear-button"); appendJS(HTMLUtil.emitJavascriptCall("theform.addSearchFilter", new String[] {joint.getFullID(),startingText})); numHeaders++; }
public void makeSortedHeader(UIContainer tofill, String thId, String linktext, String sortid, boolean curascending) { String newsortdir = curascending ? "asc" : "dsc"; String cursortdir = curascending ? "dsc" : "asc"; UIJointContainer joint; if (curascending) joint = new UIJointContainer(tofill, thId, "theader:cursort-asc-link", numHeaders+""); else joint = new UIJointContainer(tofill, thId, "theader:cursort-dsc-link", numHeaders+""); UIOutput sortlink = UIOutput.make(joint, "sort-link"); UIOutput.make(joint, "link-text", linktext); appendJS(HTMLUtil.emitJavascriptCall("theform.addSortedHeader", new String[] {joint.getFullID(), sortid, cursortdir, newsortdir})); numHeaders++; }
public void makeSortableHeader(UIContainer tofill, String thID, String linktext, String sortid) { UIJointContainer joint = new UIJointContainer(tofill, thID, "theader:sort-link", numHeaders+""); UIOutput sortlink = UIOutput.make(joint, "sort-link", linktext ); appendJS(HTMLUtil.emitJavascriptCall("theform.addSortableHeader", new String[] {joint.getFullID(), sortid, "asc"})); numHeaders++; }