Package org.apache.myfaces.tobago.component

Examples of org.apache.myfaces.tobago.component.UIColumn


  @Override
  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
    super.prepareRender(facesContext, component);

    final UIColumn column = (UIColumn) component;
    if (isPure(column)) {
      ComponentUtils.addCurrentMarkup(column, Markup.PURE);
    }
  }
View Full Code Here


      try {
        ResultSetMetaData metaData = resultSet.getMetaData();
        String columns = "";
        for (int i = 1; i <= metaData.getColumnCount(); i++) {

          UIColumn column = (UIColumn) application.createComponent(UIColumn.COMPONENT_TYPE);
          String name = metaData.getColumnName(i);
          int displaySize = metaData.getColumnDisplaySize(i);

          if (i > 1) {
            columns += ";";
          }
          if (displaySize < 10) {
            columns += "1*";
          } else if (displaySize < 20) {
            columns += "2*";
          } else {
            columns += "4*";
          }
          if (metaData.getColumnType(i) == Types.INTEGER || metaData.getColumnType(i) == Types.FLOAT) {
            column.setAlign("right");
          }
          column.setLabel(name);
          String ref = "#{" + table.getVar() + "." + name + "}";
          ValueBinding binding = application.createValueBinding(ref);
          if (name.equals("NAME")) {
            UICommand command = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
            command.setRendererType("Link");
            command.setValueBinding("label", binding);
            MethodBinding action = application.createMethodBinding("#{test.select}", new Class[0]);
            command.setAction(action);
            column.getChildren().add(command);
          } else {
            UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
            output.setValueBinding("value", binding);
            column.getChildren().add(output);
          }
          table.getChildren().add(column);
        }

        table.setColumns(columns);
View Full Code Here

  }

  public void sheetSorter(ActionEvent event) {
    if (event instanceof SortActionEvent) {
      SortActionEvent sortEvent = (SortActionEvent) event;
      UIColumn column = (UIColumn) sortEvent.getColumn();

      SheetState sheetState = ((UISheet) sortEvent.getSheet()).getSheetState(FacesContext.getCurrentInstance());
      currentAddressList = addressDao.findAddresses(searchCriterion, column.getId(), sheetState.isAscending());
    }
  }
View Full Code Here

  }

  public void sheetSorter(ActionEvent event) {
    if (event instanceof SortActionEvent) {
      SortActionEvent sortEvent = (SortActionEvent) event;
      UIColumn column = (UIColumn) sortEvent.getColumn();

      SheetState sheetState = ((UISheet) sortEvent.getSheet()).getSheetState(FacesContext.getCurrentInstance());
      currentAddressList = addressDao.findAddresses(searchCriterion, column.getId(), sheetState.isAscending());
    }
  }
View Full Code Here

  @Override
  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
    super.prepareRender(facesContext, component);

    final UIColumn column = (UIColumn) component;
    if (isPure(column)) {
      ComponentUtils.addCurrentMarkup(column, Markup.PURE);
    }
  }
View Full Code Here

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UIColumn component = (UIColumn) uiComponent;
    final FacesContext context = FacesContext.getCurrentInstance();
    final Application application = context.getApplication();
    if (markup != null) {
      if (!markup.isLiteralText()) {
        component.setValueExpression("markup", markup);
      } else {
        component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
      }
    }
    if (width != null) {
      component.setValueExpression("width", width);
    }

    if (sortable != null) {
      if (!sortable.isLiteralText()) {
        component.setValueExpression("sortable", sortable);
      } else {
        component.setSortable(Boolean.parseBoolean(sortable.getExpressionString()));
      }
    }
    if (align != null) {
      component.setValueExpression("align", align);
    }

    if (label != null) {
      component.setValueExpression("label", label);
    }

    if (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (resizable != null) {
      if (!resizable.isLiteralText()) {
        component.setValueExpression("resizable", resizable);
      } else {
        component.setResizable(Boolean.parseBoolean(resizable.getExpressionString()));
      }
    }
  }
View Full Code Here

  @Override
  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
    super.prepareRender(facesContext, component);

    final UIColumn column = (UIColumn) component;
    if (isPure(column)) {
      column.setCurrentMarkup(Markup.PURE.add(column.getCurrentMarkup()));
    }
  }
View Full Code Here

      try {
        ResultSetMetaData metaData = resultSet.getMetaData();
        String columns = "";
        for (int i = 1; i <= metaData.getColumnCount(); i++) {

          UIColumn column = (UIColumn) application.createComponent(UIColumn.COMPONENT_TYPE);
          String name = metaData.getColumnName(i);
          int displaySize = metaData.getColumnDisplaySize(i);

          if (i > 1) {
            columns += ";";
          }
          if (displaySize < 10) {
            columns += "1*";
          } else if (displaySize < 20) {
            columns += "2*";
          } else {
            columns += "4*";
          }
          if (metaData.getColumnType(i) == Types.INTEGER || metaData.getColumnType(i) == Types.FLOAT) {
            column.setAlign("right");
          }
          column.setLabel(name);
          String ref = "#{" + table.getVar() + "." + name + "}";
          ValueBinding binding = application.createValueBinding(ref);
          if (name.equals("NAME")) {
            UICommand command = (UICommand) application.createComponent(UICommand.COMPONENT_TYPE);
            command.setRendererType("Link");
            command.setValueBinding("label", binding);
            MethodBinding action = application.createMethodBinding("#{test.select}", new Class[0]);
            command.setAction(action);
            column.getChildren().add(command);
          } else {
            UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
            output.setValueBinding("value", binding);
            column.getChildren().add(output);
          }
          table.getChildren().add(column);
        }

        table.setColumns(columns);
View Full Code Here

  }

  public void sheetSorter(ActionEvent event) throws AddressDaoException {
    if (event instanceof SortActionEvent) {
      SortActionEvent sortEvent = (SortActionEvent) event;
      UIColumn column = (UIColumn) sortEvent.getColumn();

      SheetState sheetState = sortEvent.getSheet().getSheetState(FacesContext.getCurrentInstance());
      currentAddressList = addressDao.findAddresses(searchCriterion, column.getId(), sheetState.isAscending());
    }
  }
View Full Code Here

  }

  public void sheetSorter(ActionEvent event) throws AddressDaoException {
    if (event instanceof SortActionEvent) {
      SortActionEvent sortEvent = (SortActionEvent) event;
      UIColumn column = (UIColumn) sortEvent.getColumn();

      SheetState sheetState = sortEvent.getSheet().getSheetState(FacesContext.getCurrentInstance());
      currentAddressList = addressDao.findAddresses(searchCriterion, column.getId(), sheetState.isAscending());
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.component.UIColumn

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.