Package javax.faces.component

Examples of javax.faces.component.UIPanel


  }

  @Test
  public void resolveComponent_ThisParent() {

    UIComponent root = new UIPanel();

    UIForm form = new UIForm();
    root.getChildren().add(form);

    UINamingContainer outerContainer = new UINamingContainer();
    form.getChildren().add(outerContainer);

    UINamingContainer innerContainer = new UINamingContainer();
View Full Code Here


  }

  @Test
  public void resolveComponent_Namingcontainer() {

    UIComponent root = new UIPanel();

    UIForm form = new UIForm();
    root.getChildren().add(form);

    UINamingContainer outerContainer = new UINamingContainer();
    form.getChildren().add(outerContainer);

    UINamingContainer innerContainer = new UINamingContainer();
View Full Code Here

  }

  @Test
  public void resolveComponent_NamingcontainerNamingcontainer() {

    UIComponent root = new UIPanel();

    UIForm form = new UIForm();
    root.getChildren().add(form);

    UINamingContainer outerContainer = new UINamingContainer();
    form.getChildren().add(outerContainer);

    UINamingContainer innerContainer = new UINamingContainer();
View Full Code Here

  }

  @Test
  public void resolveComponent_NamingcontainerParent() {

    UIComponent root = new UIPanel();

    UIForm form = new UIForm();
    root.getChildren().add(form);

    UINamingContainer outerContainer = new UINamingContainer();
    form.getChildren().add(outerContainer);

    UINamingContainer innerContainer = new UINamingContainer();
View Full Code Here


  protected void renderColumnSelectorHeader(FacesContext facesContext,
      TobagoResponseWriter writer, UIData component, UIColumn column)
      throws IOException {
    UIPanel menu = (UIPanel) column.getFacet(FACET_MENUPOPUP);
    if (menu == null) {
      final Application application = facesContext.getApplication();
      menu = (UIPanel) application.createComponent(UIMenu.COMPONENT_TYPE);
      menu.setId("selectorMenu");
      column.getFacets().put(FACET_MENUPOPUP, menu);
      menu.setRendererType(RENDERER_TYPE_MENUBAR);
      menu.getAttributes().put(ATTR_MENU_POPUP, Boolean.TRUE);
      menu.getAttributes().put(ATTR_MENU_POPUP_TYPE, "SheetSelector");
      menu.getAttributes().put(ATTR_IMAGE, "image/sheetSelectorMenu.gif");

      String sheetId = column.getParent().getClientId(facesContext);

      String action = "Tobago.Sheets.selectAll('" + sheetId + "')";
      String label = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
          "sheetMenuSelect");
      UICommand menuItem = createMenuItem(application, label, action);
      menuItem.setId("menuSelectAll");
      menu.getChildren().add(menuItem);

      action = "Tobago.Sheets.unSelectAll('" + sheetId + "')";
      label = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
          "sheetMenuUnselect");
      menuItem = createMenuItem(application, label, action);
      menuItem.setId("menuUnselectAll");
      menu.getChildren().add(menuItem);

      action = "Tobago.Sheets.toggleAllSelections('" + sheetId + "')";
      label = ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago",
          "sheetMenuToggleselect");
      menuItem = createMenuItem(application, label, action);
      menuItem.setId("menuToggleSelections");
      menu.getChildren().add(menuItem);
    }

    menu.setRendered(UIData.MULTI.equals(component.getSelectable()));

    writer.startElement(HtmlConstants.DIV, null);
    writer.writeIdAttribute(column.getClientId(facesContext));
    writer.writeClassAttribute("tobago-sheet-selector-menu");
    writer.endElement(HtmlConstants.DIV);
View Full Code Here

    }
    writer.endElement(HtmlConstants.DIV);
  }

  private UIComponent createToolbar(FacesContext facesContext, UIInput component) {
    UIPanel toolbar = (UIPanel) ComponentUtil.createComponent(
        facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_TOOL_BAR);
    String clientId = component.getClientId(facesContext);

    component.getFacets().put(FACET_TOOL_BAR, toolbar);
    toolbar.getAttributes().put(ATTR_ICON_SIZE, ToolBarTag.ICON_SMALL);
    toolbar.getAttributes().put(ATTR_LABEL_POSITION, ToolBarTag.LABEL_OFF);

    UICommand //command = (UICommand) ComponentUtil.createComponent(
//        facesContext, UICommand.COMPONENT_TYPE, RENDERER_TYPE_MENUCOMMAND);
//    toolbar.getChildren().add(command);

    command = (UICommand) ComponentUtil.createComponent(
        facesContext, UISelectBooleanCommand.COMPONENT_TYPE, RENDERER_TYPE_MENUCOMMAND);
    toolbar.getChildren().add(command);

    command.getAttributes().put(ATTR_IMAGE, "image/tobago-richtext-edit.gif");
    command.setValueBinding(ATTR_DISABLED, ComponentUtil.createValueBinding("#{! tobagoRichtextPreviewState}"));
    command.setValueBinding(ATTR_VALUE, ComponentUtil.createValueBinding("#{!tobagoRichtextPreviewState}"));

    String title = ResourceManagerUtil.getPropertyNotNull(
        facesContext, "tobago", "tobago.richtexteditor.edit.title");
    command.getAttributes().put(ATTR_TIP, title);

    String onClick = "Tobago.submitAction('"
        + clientId + RichTextEditorRenderer.CHANGE_BUTTON + "')";
    command.getAttributes().put(ATTR_ACTION_ONCLICK, onClick);

    command = (UICommand) ComponentUtil.createComponent(
        facesContext, UISelectBooleanCommand.COMPONENT_TYPE, RENDERER_TYPE_MENUCOMMAND);
    toolbar.getChildren().add(command);
    //command.getAttributes().put(ATTR_COMMAND_TYPE, ToolBarSelectBooleanTag.COMMAND_TYPE);
    command.getAttributes().put(ATTR_IMAGE, "image/tobago-richtext-preview.gif");
    command.setValueBinding(ATTR_DISABLED, ComponentUtil.createValueBinding("#{tobagoRichtextPreviewState}"));
    command.setValueBinding(ATTR_VALUE, ComponentUtil.createValueBinding("#{tobagoRichtextPreviewState}"));

    title = ResourceManagerUtil.getPropertyNotNull(
        facesContext, "tobago", "tobago.richtexteditor.preview.title");
    command.getAttributes().put(ATTR_TIP, title);
    command.getAttributes().put(ATTR_ACTION_ONCLICK, onClick);

    command = (UICommand) ComponentUtil.createComponent(
        facesContext, UICommand.COMPONENT_TYPE, RENDERER_TYPE_MENUCOMMAND);
    toolbar.getChildren().add(command);
    command.getAttributes().put(ATTR_IMAGE, "image/config.gif");
    command.getAttributes().put(ATTR_ACTION_ONCLICK, "Tobago.doEditorCommand(this);");

    return toolbar;
  }
View Full Code Here

  private static final Log LOG = LogFactory.getLog(ToolBarRenderer.class);


  public void encodeEnd(FacesContext facesContext,
      UIComponent uiComponent) throws IOException {
    UIPanel toolbar = (UIPanel) uiComponent;

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
    boolean suppressContainer = ComponentUtil.getBooleanAttribute(toolbar, ATTR_SUPPPRESS_TOOLBAR_CONTAINER);

    if (!suppressContainer) {
      setToolBarHeight(facesContext, uiComponent);

      writer.startElement(HtmlConstants.DIV, toolbar);
      writer.writeIdAttribute(toolbar.getClientId(facesContext));
      writer.writeClassAttribute();
      writer.writeStyleAttribute();
      writer.startElement(HtmlConstants.DIV, toolbar);
      boolean right = false;
      if (toolbar instanceof UIToolBar) {
        right = UIToolBar.ORIENTATION_RIGHT.equals(((UIToolBar) toolbar).getOrientation());
      }
      // TODO use StyleClasses
      writer.writeClassAttribute("tobago-toolbar-div-inner" + (right ? " tobago-toolbar-orientation-right" : ""));

    }

    boolean boxFacet = isBoxFacet(toolbar);

    List children = toolbar.getChildren();

    int index = 0;
    for (Iterator iter = children.iterator(); iter.hasNext();) {
      UIComponent component = (UIComponent) iter.next();
      if (component instanceof UICommand) {
View Full Code Here

    jsf.facesContext().setResponseWriter(new MockResponseWriter(output, null, null));

    UIForm form = new UIForm();
    form.setId("foo");
    testTree.getChildren().add(form);
    UIPanel panel = new UIPanel();
    panel.setId("bar");
    form.getChildren().add(panel);
    ProgressiveUICommand command = new ProgressiveUICommand();
    command.setId("baz");
    panel.getChildren().add(command);

    testTree.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);

    jsf.facesContext().setViewRoot(testTree);
  }
View Full Code Here

    factory = new JsfViewFactory(parser.parseExpression(VIEW_ID, new FluentParserContext().template().evaluate(
        RequestContext.class).expectResult(String.class)), lifecycle);

    UIViewRoot existingRoot = new UIViewRoot();
    existingRoot.setViewId(VIEW_ID);
    UIPanel panel = new UIPanel();
    panel.setId("panel1");
    UIOutput output = new UIOutput();
    output.setValueBinding("binding", jsfMock.facesContext().getApplication()
        .createValueBinding("#{myBean.output}"));
    output.setId("output1");
    UIInput input = new UIInput();
    input.setValueBinding("binding", jsfMock.facesContext().getApplication().createValueBinding("#{myBean.input}"));
    input.setId("input1");

    existingRoot.getChildren().add(panel);
    panel.getFacets().put("label", output);
    panel.getChildren().add(input);

    TestBean testBean = new TestBean();
    jsfMock.externalContext().getRequestMap().put("myBean", testBean);

    ((MockViewHandler) viewHandler).setRestoreView(existingRoot);
View Full Code Here

    } else if (labelString != null) {
      writer.writeText(labelString);
    }
    writer.endElement(HtmlConstants.SPAN);

    UIPanel toolbar = (UIPanel) component.getFacet(FACET_TOOL_BAR);
    if (toolbar != null) {
      renderToolbar(facesContext, writer, toolbar);
    }
    writer.endElement(HtmlConstants.DIV);
  }
View Full Code Here

TOP

Related Classes of javax.faces.component.UIPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.