ICEfaces
  1. ICEfaces
  2. ICE-1604

<ice:inputFile/> has too much margin around it and does not fit tightly with sibling components

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6DR#4
    • Fix Version/s: 1.6DR#6, 1.6
    • Component/s: None
    • Labels:
      None
    • Environment:
      Tomcat 5.5.17 / Liferay 4.3.0 (pre-release)

      Description

      <ice:inputFile/> has too much margin around it and does not fit tightly with sibling components

      fixes are attached
      1. InputFile.java
        27 kB
        Neil Griffin
      2. InputFileRenderer.java
        5 kB
        Neil Griffin

        Activity

        Hide
        Neil Griffin added a comment -

        Search for ICE-1604 in attached files for fixes.

        Show
        Neil Griffin added a comment - Search for ICE-1604 in attached files for fixes.
        Hide
        Adnan Durrani added a comment -

        Neil's suggested fix applied. revision 13945

        Show
        Adnan Durrani added a comment - Neil's suggested fix applied. revision 13945
        Hide
        Neil Griffin added a comment -

        Adnan,

        I just did an svn-update and part of the fix is missing. Currently, lines 429-436 looks like this:

        public String getStyle() {
        if (style != null)

        { return style; }

        ValueBinding vb = getValueBinding("style");

        return vb != null ? (String) vb.getValue(getFacesContext()) :
        "padding:0px;";
        }

        However, the fix I submitted modified the "padding:0px;" line a little, to this:

        // ngriffin@liferay.com: partial fix for http://jira.icefaces.org/browse/ICE-1604
        "border-collapse:collapse; border-spacing:0px; width:" + width + "px; height:" + height + "px; padding:0px;";

        Thanks!!

        Neil

        Show
        Neil Griffin added a comment - Adnan, I just did an svn-update and part of the fix is missing. Currently, lines 429-436 looks like this: public String getStyle() { if (style != null) { return style; } ValueBinding vb = getValueBinding("style"); return vb != null ? (String) vb.getValue(getFacesContext()) : "padding:0px;"; } However, the fix I submitted modified the "padding:0px;" line a little, to this: // ngriffin@liferay.com: partial fix for http://jira.icefaces.org/browse/ICE-1604 "border-collapse:collapse; border-spacing:0px; width:" + width + "px; height:" + height + "px; padding:0px;"; Thanks!! Neil
        Hide
        Adnan Durrani added a comment -

        Neil,

        I noticed above changes while I was applying your suggested fix, but I do not see if the getStyle() is being used anywhere?

        Thanks,
        Adnan

        Show
        Adnan Durrani added a comment - Neil, I noticed above changes while I was applying your suggested fix, but I do not see if the getStyle() is being used anywhere? Thanks, Adnan
        Hide
        Neil Griffin added a comment -

        Adnan,

        You're right! I think you found a related bug!

        In the ICEfaces 1.5.3 code, InputFileRenderer.getIframe() was doing this:

        if (((InputFile) uiComponent).getStyle() != null)

        { iframe.setAttribute(HTML.STYLE_ATTR, ((InputFile) uiComponent).getStyle()); }

        Which would basically set the "style" attribute of the rendered <iframe> element to whatever the value was for the <ice:inputFile/> style attribute.

        This feature is not present in the current/equivalent InputFileRenderer.encodeEnd() method.

        Instead, InputFileRender.encodeEnd() is doing this:

        writer.writeAttribute("style", "overflow: hidden;", null);

        So I recommend changing this to:

        writer.writeAttribute("style", c.getStyle(), null);

        And adding "overflow:hidden" to the getStyle() method in InputFile.java, so that it looks like this:

        "overflow: hidden; border-collapse:collapse; border-spacing:0px; width:" + width + "px; height:" + height + "px; padding:0px;";

        Thanks!!

        Neil

        Show
        Neil Griffin added a comment - Adnan, You're right! I think you found a related bug! In the ICEfaces 1.5.3 code, InputFileRenderer.getIframe() was doing this: if (((InputFile) uiComponent).getStyle() != null) { iframe.setAttribute(HTML.STYLE_ATTR, ((InputFile) uiComponent).getStyle()); } Which would basically set the "style" attribute of the rendered <iframe> element to whatever the value was for the <ice:inputFile/> style attribute. This feature is not present in the current/equivalent InputFileRenderer.encodeEnd() method. Instead, InputFileRender.encodeEnd() is doing this: writer.writeAttribute("style", "overflow: hidden;", null); So I recommend changing this to: writer.writeAttribute("style", c.getStyle(), null); And adding "overflow:hidden" to the getStyle() method in InputFile.java, so that it looks like this: "overflow: hidden; border-collapse:collapse; border-spacing:0px; width:" + width + "px; height:" + height + "px; padding:0px;"; Thanks!! Neil
        Hide
        Neil Griffin added a comment -

        Correction:

        Also recommend dropping the width and height stuff from this:

        "overflow: hidden; border-collapse:collapse; border-spacing:0px; width:" + width + "px; height:" + height + "px; padding:0px;";

        So that it looks like this:

        "overflow: hidden; border-collapse:collapse; border-spacing:0px; padding:0px;";

        Because the InputFileRenderer.encodeEnd() method does this too:

        writer.writeAttribute("width", c.getWidth() + "px", null);
        writer.writeAttribute("height", c.getHeight() + "px", null);

        Which would conflict with the style attribute value.

        Neil

        Show
        Neil Griffin added a comment - Correction: Also recommend dropping the width and height stuff from this: "overflow: hidden; border-collapse:collapse; border-spacing:0px; width:" + width + "px; height:" + height + "px; padding:0px;"; So that it looks like this: "overflow: hidden; border-collapse:collapse; border-spacing:0px; padding:0px;"; Because the InputFileRenderer.encodeEnd() method does this too: writer.writeAttribute("width", c.getWidth() + "px", null); writer.writeAttribute("height", c.getHeight() + "px", null); Which would conflict with the style attribute value. Neil
        Hide
        Ken Fyten added a comment -

        Please review Neil's latest suggestions.

        Show
        Ken Fyten added a comment - Please review Neil's latest suggestions.
        Hide
        Neil Griffin added a comment -

        Here are my latest suggestions:

        In InputFile.java, change line 491 from:

        "padding:0px;";

        To this:

        "border-collapse:collapse; border-spacing:0px; padding:0px;";

        And in InputFileRenderer.java, at line 58, change this:

        writer.startElement("iframe", c);
        writer.writeAttribute("src", pseudoURL, null);
        writer.writeAttribute("class", c.getStyleClass(), null);
        writer.writeAttribute("style", "overflow: hidden;", null);

        To this:

        writer.writeAttribute("marginwidth", "0", null);
        writer.writeAttribute("marginheight", "0", null);
        writer.writeAttribute("scrolling", "no", null);
        writer.writeAttribute("src", pseudoURL, null);
        writer.writeAttribute("class", c.getStyleClass(), null);
        writer.writeAttribute("style", c.getStyle(), null);

        Thanks!

        Neil

        Show
        Neil Griffin added a comment - Here are my latest suggestions: In InputFile.java, change line 491 from: "padding:0px;"; To this: "border-collapse:collapse; border-spacing:0px; padding:0px;"; And in InputFileRenderer.java, at line 58, change this: writer.startElement("iframe", c); writer.writeAttribute("src", pseudoURL, null); writer.writeAttribute("class", c.getStyleClass(), null); writer.writeAttribute("style", "overflow: hidden;", null); To this: writer.writeAttribute("marginwidth", "0", null); writer.writeAttribute("marginheight", "0", null); writer.writeAttribute("scrolling", "no", null); writer.writeAttribute("src", pseudoURL, null); writer.writeAttribute("class", c.getStyleClass(), null); writer.writeAttribute("style", c.getStyle(), null); Thanks! Neil
        Hide
        Adnan Durrani added a comment -

        Neil's suggested fix applied. revision 14222

        Show
        Adnan Durrani added a comment - Neil's suggested fix applied. revision 14222

          People

          • Assignee:
            Unassigned
            Reporter:
            Neil Griffin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: