Package org.apache.myfaces.tobago.component

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


      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

  @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

      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

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.