/** * 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); }
/** * 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); }
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); } } }
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 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++; }
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 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++; }
public void fillComponents(UIContainer tofill, ViewParameters viewparamso, ComponentChecker checker) { if (uvbbean.paths != null && uvbbean.values != null) { for (int i = 0; i < uvbbean.paths.length; ++i) { String path = uvbbean.paths[i]; Object bean = uvbbean.values[i]; UIOutput out = UIOutput.make(tofill, ":" + i, jsonProvider.toString(bean)); out.decorators = new DecoratorList(new UIIDStrategyDecorator(path)); } } for (int i = 0; i < tml.size(); ++i) { TargettedMessage message = tml.messageAt(i); String rendered = message.message != null? message.message : messageLocator.getMessage(message.messagecodes, message.args); UIOutput out = UIOutput.make(tofill, "tml:" + i, rendered); Map attrmap = new HashMap(); attrmap.put("target", message.targetid); attrmap.put("severity", message.severity == TargettedMessage.SEVERITY_ERROR ? "error" : "info"); out.decorators = new DecoratorList(new UIFreeAttributeDecorator(attrmap)); out.decorators.add(UIIDStrategyDecorator.ID_FULL); } }
"dynamic-list-input-row:", Integer.toString(i)); UIBasicListMember.makeBasic(row, "input", toevolve.getFullID(), i); UIOutput.make(row, "remove", removelabel.getValue(), removelabel.valuebinding == null ? null : removelabel.valuebinding.value); UIOutput.make(core, "add-row", addlabel.getValue(), addlabel.valuebinding == null ? null : addlabel.valuebinding.value);
"dynamic-list-input-row:", Integer.toString(i)); UIBasicListMember.makeBasic(row, "input", toevolve.getFullID(), i); UIOutput.make(row, "remove", removelabel.getValue(), removelabel.valuebinding == null ? null : removelabel.valuebinding.value); UIOutput.make(core, "add-row", addlabel.getValue(), addlabel.valuebinding == null ? null : addlabel.valuebinding.value);
UIOutput.make(joint, "instructions:", "Viewing " + (startItem+1) + " to " + (endItem) + " of "+totalsize); UIOutput firstPageButton = UIOutput.make(joint, "first-page-button"); UIOutput prevPageButton = UIOutput.make(joint, "prev-page-button"); UIOutput nextPageButton = UIOutput.make(joint, "next-page-button"); UIOutput lastPageButton = UIOutput.make(joint, "last-page-button");
UIInput field = UIInput.make(togo, "date-field", ttb + "short", transit.getShort()); field.mustapply = true; UIOutput.make(togo, "date-annotation", null, ttb + "shortFormat"); if (invalidDateKey != null) { form.parameters.add(new UIELBinding(ttb + "invalidDateKey", invalidDateKey)); UIInput field = UIInput.make(togo, "time-field", ttb + "time", transit.getTime()); field.mustapply = true; UIOutput.make(togo, "time-annotation", null, ttb + "timeFormat"); if (invalidTimeKey != null) { form.parameters.add(new UIELBinding(ttb + "invalidTimeKey", invalidTimeKey)); new ELReference(ttb + "date"))); UIOutput.make(togo, "date-container"); UIOutput.make(togo, "date-link");
UIOutput.make(joint, "instructions:", "Viewing " + (startItem+1) + " to " + (endItem) + " of "+totalsize); UIOutput firstPageButton = UIOutput.make(joint, "first-page-button"); UIOutput prevPageButton = UIOutput.make(joint, "prev-page-button"); UIOutput nextPageButton = UIOutput.make(joint, "next-page-button"); UIOutput lastPageButton = UIOutput.make(joint, "last-page-button");
UIInput field = UIInput.make(togo, "date-field", ttb + "short", transit.getShort()); field.mustapply = true; UIOutput.make(togo, "date-annotation", null, ttb + "shortFormat"); if (invalidDateKey != null) { form.parameters.add(new UIELBinding(ttb + "invalidDateKey", invalidDateKey)); UIInput field = UIInput.make(togo, "time-field", ttb + "time", transit.getTime()); field.mustapply = true; UIOutput.make(togo, "time-annotation", null, ttb + "timeFormat"); if (invalidTimeKey != null) { form.parameters.add(new UIELBinding(ttb + "invalidTimeKey", invalidTimeKey)); new ELReference(ttb + "date"))); UIOutput.make(togo, "date-container"); UIOutput.make(togo, "date-link");
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; }