private UIComponent createDateTimeFields( FacesContext context, final EventEditorDialog dialog, final String idPrefix) { DateChooser dateField = Components.getOrCreateFacet( context, dialog, DateChooser.COMPONENT_TYPE, idPrefix + "DateField", DateChooser.class); HtmlOutputText nbsp = Components.createOutputText(context, HTML.NBSP_ENTITY, false); UIInput timeField = Components.getOrCreateFacet( context, dialog, HtmlInputText.COMPONENT_TYPE, idPrefix + "TimeField", UIInput.class); String timeCls = Styles.mergeClassNames( (String) timeField.getAttributes().get("styleClass"), "o_eventEditor_timeField"); timeField.getAttributes().put("styleClass", timeCls); final UIComponent[][] components = new UIComponent[][] {{dateField, nbsp, timeField}}; return new UIComponentBase() { @Override public String getFamily() { return null; } @Override public void encodeBegin(FacesContext context) throws IOException { new TableRenderer(idPrefix + "Fields", 0, 0, 0, null).render(dialog, components); } }; }
private UIComponent getNameField(FacesContext context, EventEditorDialog dialog) { UIInput nameField = Components.getOrCreateFacet( context, dialog, HtmlInputText.COMPONENT_TYPE, "nameField", UIInput.class); nameField.getAttributes().put("styleClass", "o_fullWidth"); return nameField; }
private UIComponent getDescriptionField(FacesContext context, EventEditorDialog dialog) { UIInput descriptionField = Components.getOrCreateFacet( context, dialog, HtmlInputTextarea.COMPONENT_TYPE, "descriptionArea", UIInput.class); descriptionField.getAttributes().put("styleClass", "o_fullWidthAndHeight"); descriptionField.getAttributes().put("style", "resize: none"); return descriptionField; }
/* (non-Javadoc) * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp() */ public void setUp() throws Exception { super.setUp(); form = new HtmlForm(); form.setId("form"); form2 = new HtmlForm(); form2.setId("form2"); facesContext.getViewRoot().getChildren().add(form); facesContext.getViewRoot().getChildren().add(form2); stp1 = (UISimpleTogglePanel) application.createComponent("org.richfaces.SimpleTogglePanel"); stp1.setId("simpleTogglePanel1"); stp1.setOpened(true); stp1.setSwitchType(UISimpleTogglePanel.SERVER_SWITCH_TYPE); openMarker1 = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE); openMarker1.setId("openMarker"); openMarker1.setValue("open"); closeMarker1 = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE); closeMarker1.setId("closeMarker"); closeMarker1.setValue("close"); stp1.getFacets().put(openMarker1.getId(), openMarker1); stp1.getFacets().put(closeMarker1.getId(), closeMarker1); form.getChildren().add(stp1); stp2 = (UISimpleTogglePanel) application.createComponent("org.richfaces.SimpleTogglePanel"); stp2.setId("simpleTogglePanel2"); stp2.setOpened(false); stp2.setSwitchType(UISimpleTogglePanel.SERVER_SWITCH_TYPE); openMarker2 = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE); openMarker2.setId("openMarker"); openMarker2.setValue("open"); closeMarker2 = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE); closeMarker2.setId("closeMarker"); closeMarker2.setValue("close"); stp2.getFacets().put(openMarker2.getId(), openMarker2); stp2.getFacets().put(closeMarker2.getId(), closeMarker2); form2.getChildren().add(stp2); input = (UIInput) application.createComponent(UIInput.COMPONENT_TYPE); input.setValue(""); input.setId("opened"); input.getAttributes().put("onchange", "return true;"); stp1.getChildren().add(input); command = new HtmlCommandLink(); command.setId("command"); stp1.getChildren().add(command); }
/** * Method that triggers when a module is selected * * @param event ValueChangeEvent object * @throws AbortProcessingException */ public void selectedModule(ValueChangeEvent event) throws AbortProcessingException { if ((moduleDateBeans == null) || (moduleDateBeans.size() == 0)) return; if (selectAllFlag == false) { UIInput mod_Selected = (UIInput) event.getComponent(); if (((Boolean) mod_Selected.getValue()).booleanValue() == true) count++; else count--; String title = (String) mod_Selected.getAttributes().get("title"); if (title != null) { selectedModId = Integer.parseInt(title); if (selectedModIds == null) { selectedModIds = new ArrayList(); } selectedModIds.add(new Integer(selectedModId)); moduleSelected = true; } } return; }
public void setUp() throws Exception { super.setUp(); ajaxForm = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE); ajaxForm.setId("form"); child = new UIInput() { public void processDecodes(FacesContext context) { childInvoked++; super.processDecodes(context); } }; child.setId("input"); child.getAttributes().put("onchange", "return true;"); child.addValidator(new TestAjaxFormValidator()); childInvoked = 0; child.setId("child"); ajaxForm.getChildren().add(child); facesContext.getViewRoot().getChildren().add(ajaxForm); }