Examples of UIProgress


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

  private static final Logger LOG = LoggerFactory.getLogger(ProgressRenderer.class);

  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {

    UIProgress progress = (UIProgress) component;

    BoundedRangeModel model = (BoundedRangeModel) progress.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(0, 1, 0, 100);
    }

    final int diff = model.getMaximum() - model.getMinimum();
    Object title = progress.getAttributes().get(Attributes.TIP);
    if (title == null && diff > 0) {
      title = Integer.toString(100 * model.getValue() / diff) + " %";
    }

    final Style style = new Style(facesContext, progress);
    final Measure width = style.getWidth();
    final Measure valueWidth = diff > 0 ? width.multiply(model.getValue()).divide(diff) : width;

    final Style valueStyle = new Style();
    valueStyle.setHeight(style.getHeight());
    valueStyle.setWidth(valueWidth);

    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlElements.DIV, progress);
    writer.writeClassAttribute(Classes.create(progress));
    HtmlRendererUtils.writeDataAttributes(facesContext, writer, progress);
    writer.writeStyleAttribute(style);
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, String.valueOf(title), true);
    }

    writer.startElement(HtmlElements.DIV, null);
    writer.writeClassAttribute(Classes.create(progress, "value"));
    writer.writeStyleAttribute(valueStyle);
    writer.endElement(HtmlElements.DIV);

    writer.endElement(HtmlElements.DIV);

    UIComponent facet = progress.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet instanceof UICommand) {
      UICommand command = (UICommand) facet;
      writer.writeJavascript(HtmlRendererUtils.createSubmitAction(command.getClientId(facesContext), true, null, null));
    }

View Full Code Here

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

  private static final Logger LOG = LoggerFactory.getLogger(ProgressRenderer.class);

  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {

    UIProgress progress = (UIProgress) component;

    BoundedRangeModel model = (BoundedRangeModel) progress.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(0, 1, 0, 100);
    }

    final int diff = model.getMaximum() - model.getMinimum();
    Object title = progress.getAttributes().get(Attributes.TIP);
    if (title == null && diff > 0) {
      title = Integer.toString(100 * model.getValue() / diff) + " %";
    }

    final Style style = new Style(facesContext, progress);
    final Measure width = style.getWidth();
    final Measure valueWidth = diff > 0 ? width.multiply(model.getValue()).divide(diff) : width;

    final Style valueStyle = new Style();
    valueStyle.setHeight(style.getHeight());
    valueStyle.setWidth(valueWidth);

    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlElements.DIV, progress);
    writer.writeClassAttribute(Classes.create(progress));
    HtmlRendererUtils.writeDataAttributes(facesContext, writer, progress);
    writer.writeStyleAttribute(style);
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, String.valueOf(title), true);
    }
    UIComponent facet = progress.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet instanceof UICommand) {
      HtmlRendererUtils.renderCommandFacet(progress, facesContext, writer);
    }
    writer.startElement(HtmlElements.DIV, null);
    writer.writeClassAttribute(Classes.create(progress, "value"));
View Full Code Here

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

  }

  @Override
  protected void setProperties(final UIComponent uiComponent) {
    super.setProperties(uiComponent);
    final UIProgress component = (UIProgress) 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 (tip != null) {
      component.setValueExpression("tip", tip);
    }

    if (value != null) {
      if (!value.isLiteralText()) {
        component.setValueExpression("value", value);
      /*} else {
        component.setValue(value.getExpressionString());*/
      }
    }
  }
View Full Code Here

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

  private static final Log LOG = LogFactory.getLog(ProgressRenderer.class);
      
  public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {

    UIProgress component = (UIProgress) uiComponent;

    BoundedRangeModel model = (BoundedRangeModel) component.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(4, 1, 0, 10);
    }

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    String value1 = Integer.toString(model.getValue());
    String value2 = Integer.toString(model.getMaximum() - model.getValue());

    Integer width = LayoutUtil.getLayoutWidth(component);

    String width1 = value1;
    String width2 = value2;

    if (width != null) {
      int value = (width -1) * model.getValue()
          / (model.getMaximum() - model.getMinimum());
      width1 = Integer.toString(value);
      width2 = Integer.toString((width - 2) - value);
    }


    writer.startElement(HtmlConstants.TABLE, null);
    writer.writeAttribute(HtmlAttributes.BORDER, 0);
    writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
    writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
    writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);

    writer.startElement(HtmlConstants.TR, null);

    writer.startElement(HtmlConstants.TD, null);
    writer.writeStyleAttribute("background-color: #aabbcc;");
    writer.writeAttribute(HtmlAttributes.WIDTH, width1, false);
    writer.writeText(TobagoConstants.CHAR_NON_BEAKING_SPACE);
    writer.endElement(HtmlConstants.TD);

    writer.startElement(HtmlConstants.TD, null);
    writer.writeStyleAttribute("background-color: #ddeeff;");
    writer.writeAttribute(HtmlAttributes.WIDTH, width2, false);
    writer.writeText(TobagoConstants.CHAR_NON_BEAKING_SPACE);
    writer.endElement(HtmlConstants.TD);

    writer.endElement(HtmlConstants.TR);
    writer.endElement(HtmlConstants.TABLE);
    UIComponent facet = component.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet != null
        && facet instanceof UICommand) {
      UICommand command = (UICommand) facet;
      writer.writeJavascript("Tobago.submitAction2(this, '" + command.getClientId(facesContext) + "', null, null);");
    }
View Full Code Here

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

  private static final Logger LOG = LoggerFactory.getLogger(ProgressRenderer.class);

  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {

    UIProgress progress = (UIProgress) component;

    BoundedRangeModel model = (BoundedRangeModel) progress.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(0, 1, 0, 100);
    }

    Object title = progress.getAttributes().get(Attributes.TIP);
    if (title == null) {
      title = Integer.toString(100 * model.getValue()
          / (model.getMaximum() - model.getMinimum())) + " %";
    }

    final Style style = new Style(facesContext, progress);
    final Measure width = style.getWidth();
    final Measure valueWidth = width.multiply(model.getValue()).divide(model.getMaximum() - model.getMinimum());

    final Style valueStyle = new Style();
    valueStyle.setHeight(style.getHeight());
    valueStyle.setWidth(valueWidth);

    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlElements.DIV, progress);
    writer.writeClassAttribute(Classes.create(progress));
    writer.writeStyleAttribute(style);
    writer.writeAttribute(HtmlAttributes.TITLE, String.valueOf(title), true);

    writer.startElement(HtmlElements.DIV, null);
    writer.writeClassAttribute(Classes.create(progress, "value"));
    writer.writeStyleAttribute(valueStyle);
    writer.endElement(HtmlElements.DIV);

    writer.endElement(HtmlElements.DIV);

    UIComponent facet = progress.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet instanceof UICommand) {
      UICommand command = (UICommand) facet;
      writer.writeJavascript(HtmlRendererUtils.createSubmitAction(command.getClientId(facesContext), true, null, null));
    }

View Full Code Here

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

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

  public void encodeEnd(FacesContext facesContext,
      UIComponent uiComponent) throws IOException {

    UIProgress component = (UIProgress) uiComponent;

    BoundedRangeModel model = (BoundedRangeModel) component.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(40, 1, 0, 100);
    }

    String image = ResourceManagerUtil.getImageWithPath(facesContext, "image/1x1.gif");

    String value1 = Integer.toString(model.getValue());
    String value2 = Integer.toString(model.getMaximum() - model.getValue());

    Object title = component.getAttributes().get(ATTR_TIP);
    if (title == null) {
      title = Integer.toString(100 * model.getValue()
          / (model.getMaximum() - model.getMinimum())) + " %";
    }

    Integer width = LayoutUtil.getLayoutWidth(component);

    String width1 = value1;
    String width2 = value2;

    if (width != null) {
      int value = (width -1) * model.getValue()
          / (model.getMaximum() - model.getMinimum());
      width1 = Integer.toString(value);
      width2 = Integer.toString((width - 2) - value);
    }

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlConstants.SPAN, component);
    writer.writeClassAttribute();
    writer.writeAttribute(HtmlAttributes.TITLE, String.valueOf(title), true);

    writer.startElement(HtmlConstants.IMG, null);
    StyleClasses color1Classes = new StyleClasses();
    color1Classes.addClass("progress", "color1");
    color1Classes.addMarkupClass(component, "progress", "color1");
    writer.writeClassAttribute(color1Classes);
    writer.writeAttribute(HtmlAttributes.SRC, image, false);
    writer.writeAttribute(HtmlAttributes.ALT, String.valueOf(title), true);
    writer.writeAttribute(HtmlAttributes.WIDTH, width1, false);
    writer.writeAttribute(HtmlAttributes.BORDER, 0);
    writer.endElement(HtmlConstants.IMG);

    writer.startElement(HtmlConstants.IMG, null);
    StyleClasses color2Classes = new StyleClasses();
    color2Classes.addClass("progress", "color2");
    color2Classes.addMarkupClass(component, "progress", "color2");
    writer.writeClassAttribute(color2Classes);
    writer.writeAttribute(HtmlAttributes.SRC, image, false);
    writer.writeAttribute(HtmlAttributes.ALT, String.valueOf(title), true);
    writer.writeAttribute(HtmlAttributes.WIDTH, width2, false);
    writer.writeAttribute(HtmlAttributes.BORDER, 0);
    writer.endElement(HtmlConstants.IMG);

    writer.endElement(HtmlConstants.SPAN);
    UIComponent facet = component.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet != null
        && facet instanceof UICommand) {
      UICommand command = (UICommand) facet;
      writer.writeJavascript("Tobago.submitAction2(this, '" + command.getClientId(facesContext) + "', null, null);");
    }
View Full Code Here

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

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

  public void encodeEnd(FacesContext facesContext,
      UIComponent uiComponent) throws IOException {

    UIProgress component = (UIProgress) uiComponent;

    BoundedRangeModel model = (BoundedRangeModel) component.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(40, 1, 0, 100);
    }

    String image = ResourceManagerUtil.getImageWithPath(facesContext, "image/1x1.gif");

    String value1 = Integer.toString(model.getValue());
    String value2 = Integer.toString(model.getMaximum() - model.getValue());

    Object title = component.getAttributes().get(ATTR_TIP);
    if (title == null) {
      title = Integer.toString(100 * model.getValue()
          / (model.getMaximum() - model.getMinimum())) + " %";
    }

    Integer width = LayoutUtil.getLayoutWidth(component);

    String width1 = value1;
    String width2 = value2;

    if (width != null) {
      int value = (width -1) * model.getValue()
          / (model.getMaximum() - model.getMinimum());
      width1 = Integer.toString(value);
      width2 = Integer.toString((width - 2) - value);
    }

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlConstants.SPAN, component);
    writer.writeClassAttribute();
    writer.writeAttribute(HtmlAttributes.TITLE, String.valueOf(title), true);

    writer.startElement(HtmlConstants.IMG, null);
    StyleClasses color1Classes = new StyleClasses();
    color1Classes.addClass("progress", "color1");
    color1Classes.addMarkupClass(component, "progress", "color1");
    writer.writeClassAttribute(color1Classes);
    writer.writeAttribute(HtmlAttributes.SRC, image, false);
    writer.writeAttribute(HtmlAttributes.ALT, String.valueOf(title), true);
    writer.writeAttribute(HtmlAttributes.WIDTH, width1, false);
    writer.writeAttribute(HtmlAttributes.BORDER, 0);
    writer.endElement(HtmlConstants.IMG);

    writer.startElement(HtmlConstants.IMG, null);
    StyleClasses color2Classes = new StyleClasses();
    color2Classes.addClass("progress", "color2");
    color2Classes.addMarkupClass(component, "progress", "color2");
    writer.writeClassAttribute(color2Classes);
    writer.writeAttribute(HtmlAttributes.SRC, image, false);
    writer.writeAttribute(HtmlAttributes.ALT, String.valueOf(title), true);
    writer.writeAttribute(HtmlAttributes.WIDTH, width2, false);
    writer.writeAttribute(HtmlAttributes.BORDER, 0);
    writer.endElement(HtmlConstants.IMG);

    writer.endElement(HtmlConstants.SPAN);
    UIComponent facet = component.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet != null
        && facet instanceof UICommand) {
      UICommand command = (UICommand) facet;
      writer.writeJavascript("Tobago.submitAction('" + command.getClientId(facesContext) + "');");
    }
View Full Code Here

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

  private static final Log LOG = LogFactory.getLog(ProgressRenderer.class);
      
  public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {

    UIProgress component = (UIProgress) uiComponent;

    BoundedRangeModel model = (BoundedRangeModel) component.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(4, 1, 0, 10);
    }

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    String value1 = Integer.toString(model.getValue());
    String value2 = Integer.toString(model.getMaximum() - model.getValue());

    Integer width = LayoutUtil.getLayoutWidth(component);

    String width1 = value1;
    String width2 = value2;

    if (width != null) {
      int value = (width -1) * model.getValue()
          / (model.getMaximum() - model.getMinimum());
      width1 = Integer.toString(value);
      width2 = Integer.toString((width - 2) - value);
    }


    writer.startElement(HtmlConstants.TABLE, null);
    writer.writeAttribute(HtmlAttributes.BORDER, 0);
    writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
    writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
    writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);

    writer.startElement(HtmlConstants.TR, null);

    writer.startElement(HtmlConstants.TD, null);
    writer.writeStyleAttribute("background-color: #aabbcc;");
    writer.writeAttribute(HtmlAttributes.WIDTH, width1, false);
    writer.writeText(TobagoConstants.CHAR_NON_BEAKING_SPACE);
    writer.endElement(HtmlConstants.TD);

    writer.startElement(HtmlConstants.TD, null);
    writer.writeStyleAttribute("background-color: #ddeeff;");
    writer.writeAttribute(HtmlAttributes.WIDTH, width2, false);
    writer.writeText(TobagoConstants.CHAR_NON_BEAKING_SPACE);
    writer.endElement(HtmlConstants.TD);

    writer.endElement(HtmlConstants.TR);
    writer.endElement(HtmlConstants.TABLE);
    UIComponent facet = component.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet != null
        && facet instanceof UICommand) {
      UICommand command = (UICommand) facet;
      writer.writeJavascript("Tobago.submitAction('" + command.getClientId(facesContext) + "');");
    }
View Full Code Here

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

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

  public void encodeEnd(FacesContext facesContext,
      UIComponent uiComponent) throws IOException {

    UIProgress component = (UIProgress) uiComponent;

    BoundedRangeModel model = (BoundedRangeModel) component.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(40, 1, 0, 100);
    }

    String image = ResourceManagerUtil.getImageWithPath(facesContext, "image/1x1.gif");

    String value1 = Integer.toString(model.getValue());
    String value2 = Integer.toString(model.getMaximum() - model.getValue());

    Object title = component.getAttributes().get(ATTR_TIP);
    if (title == null) {
      title = Integer.toString(100 * model.getValue()
          / (model.getMaximum() - model.getMinimum())) + " %";
    }

    Integer width = LayoutUtil.getLayoutWidth(component);

    String width1 = value1;
    String width2 = value2;

    if (width != null) {
      int value = (width -1) * model.getValue()
          / (model.getMaximum() - model.getMinimum());
      width1 = Integer.toString(value);
      width2 = Integer.toString((width - 2) - value);
    }

    TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlConstants.SPAN, component);
    writer.writeClassAttribute();
    writer.writeAttribute(HtmlAttributes.TITLE, String.valueOf(title), true);

    writer.startElement(HtmlConstants.IMG, null);
    StyleClasses color1Classes = new StyleClasses();
    color1Classes.addClass("progress", "color1");
    color1Classes.addMarkupClass(component, "progress", "color1");
    writer.writeClassAttribute(color1Classes);
    writer.writeAttribute(HtmlAttributes.SRC, image, false);
    writer.writeAttribute(HtmlAttributes.ALT, String.valueOf(title), true);
    writer.writeAttribute(HtmlAttributes.STYLE, "width:" + width1 + "px", false);
    writer.writeAttribute(HtmlAttributes.BORDER, 0);
    writer.endElement(HtmlConstants.IMG);

    writer.startElement(HtmlConstants.IMG, null);
    StyleClasses color2Classes = new StyleClasses();
    color2Classes.addClass("progress", "color2");
    color2Classes.addMarkupClass(component, "progress", "color2");
    writer.writeClassAttribute(color2Classes);
    writer.writeAttribute(HtmlAttributes.SRC, image, false);
    writer.writeAttribute(HtmlAttributes.ALT, String.valueOf(title), true);
    writer.writeAttribute(HtmlAttributes.STYLE, "width:" + width2 + "px", false);
    writer.writeAttribute(HtmlAttributes.BORDER, 0);
    writer.endElement(HtmlConstants.IMG);

    writer.endElement(HtmlConstants.SPAN);
    UIComponent facet = component.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet != null
        && facet instanceof UICommand) {
      UICommand command = (UICommand) facet;
      writer.writeJavascript("Tobago.submitAction2(this, '" + command.getClientId(facesContext) + "', null, null);");
    }
View Full Code Here

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

  private static final Logger LOG = LoggerFactory.getLogger(ProgressRenderer.class);

  public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {

    final UIProgress progress = (UIProgress) component;

    BoundedRangeModel model = (BoundedRangeModel) progress.getValue();

    if (model == null) {
      LOG.warn("'null' value found! Using dummy Model instead!");
      model = new DefaultBoundedRangeModel(0, 1, 0, 100);
    }

    final int diff = model.getMaximum() - model.getMinimum();
    Object title = progress.getAttributes().get(Attributes.TIP);
    if (title == null && diff > 0) {
      title = Integer.toString(100 * model.getValue() / diff) + " %";
    }

    final Style style = new Style(facesContext, progress);
    final Measure width = style.getWidth();
    final Measure valueWidth = diff > 0 ? width.multiply(model.getValue()).divide(diff) : width;

    final Style valueStyle = new Style();
    valueStyle.setHeight(style.getHeight());
    valueStyle.setWidth(valueWidth);

    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    writer.startElement(HtmlElements.DIV, progress);
    writer.writeClassAttribute(Classes.create(progress));
    HtmlRendererUtils.writeDataAttributes(facesContext, writer, progress);
    writer.writeStyleAttribute(style);
    if (title != null) {
      writer.writeAttribute(HtmlAttributes.TITLE, String.valueOf(title), true);
    }
    final UIComponent facet = progress.getFacet("complete");
    if (model.getValue() == model.getMaximum() && facet instanceof UICommand) {
      HtmlRendererUtils.renderCommandFacet(progress, facesContext, writer);
    }
    writer.startElement(HtmlElements.DIV, null);
    writer.writeClassAttribute(Classes.create(progress, "value"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.