public String toString() { return "width: " + getWidth() + "; height: " + getHeight(); }
styleString.append("height:").append(preferredSize.getHeight()).append(';');
String height = preferredSize != null ? preferredSize.getHeight() : null; boolean clientLayout = height != null && Utils.isMSIE(container) && !"auto".equals(height) && (layout instanceof SBorderLayout || layout instanceof SGridBagLayout || layout instanceof SCardLayout);
@Override public void writeInternal(Device device, SComponent component) throws IOException { SScrollPane scrollpane = (SScrollPane) component; if (scrollpane.getMode() == SScrollPane.MODE_COMPLETE) { SDimension preferredSize = scrollpane.getPreferredSize(); if (preferredSize == null) { scrollpane.setPreferredSize(new SDimension(200, 400)); } else { if (preferredSize.getWidthInt() < 0) Utils.setPreferredSize(component, "200", preferredSize.getHeight()); if (preferredSize.getHeightInt() < 0) Utils.setPreferredSize(component, preferredSize.getWidth(), "400");; } ScriptManager.getInstance().addScriptListener(new LayoutScrollPaneScript(component.getName())); writeContent(device, component); } else { writeContent(device, component); } Adjustable sb = scrollpane.getVerticalScrollBar(); SComponent viewport = (SComponent)scrollpane.getScrollable(); if (viewport != null && sb instanceof SScrollBar) { final JavaScriptDOMListener handleMouseWheel = new JavaScriptDOMListener( "DOMMouseScroll", "wingS.scrollbar.handleMouseWheel", '\'' +((SScrollBar)sb).getName()+ '\'', viewport); viewport.addScriptListener(handleMouseWheel); } }
public SDimension(SDimension dim) { this(dim.getWidth(), dim.getHeight()); }
private static String getInitScript(SPopup popup) { String anchor = popup.isAnchored() ? popup.getAnchor().getName() : ""; String corner = popup.isAnchored() ? popup.getCorner() : ""; String name = "popup_" + popup.getName(); SDimension dim = popup.getPreferredSize(); if (dim == null) { dim = DEFAULT_DIMENSION; } String heightUnit = dim.getHeightUnit(); if (heightUnit != null && !heightUnit.equals("px")) { throw new IllegalStateException("Only 'px' is a valid unit, but height was specified as " + dim.getHeight()); } String widthUnit = dim.getWidthUnit(); if (widthUnit != null && !widthUnit.equals("px")) { throw new IllegalStateException("Only 'px' is a valid unit, but width was specified as " + dim.getWidth()); } StringBuilder code = new StringBuilder(); code.append("if (document.getElementById('").append(popup.getName()).append("yahoo') != null) { return; }\n"); code.append(name). append(" = new wingS.Popup("). append('\'').append(popup.getName()).append("', ").append(popup.getX()).append(", ").append(popup.getY()).append(", "). append(dim.getWidthInt()).append(", "). append(dim.getHeightInt()).append(", "). append('\'').append(anchor).append("', "). append('\'').append(corner).append('\''). append(");"); code.append(name).append(".show();"); return code.toString(); }
/** * Prints a HTML style attribute with widht/height of 100% if the passed dimension defines a height or width.. * <p>Sample: <code> style="width:100%;"</code> * <p/> * <p>This is typicall needed to stretch inner HTML element to expand to the full dimenstion defined * on an outer, sized HTML element. Otherwise the component would appear to small (as size is applied only * on the invisible outer limiting element) * * @param device Device to print to * @param preferredSize trigger dimension */ public static void printCSSInlineFullSize(Device device, SDimension preferredSize) throws IOException { if ((preferredSize != null) && (!SDimension.AUTO.equals(preferredSize.getWidth()) || !SDimension.AUTO.equals(preferredSize.getHeight()))) { // opera doesn't show height 100% when parent has no defined height if (!SDimension.AUTO.equals(preferredSize.getHeight())) { device.print(" style=\"width:100%;height:100%\""); } else { device.print(" style=\"width:100%\""); } } }
public static void optFullSize(Device device, SComponent component) throws IOException { SDimension dim = component.getPreferredSize(); if (dim != null) { String width = dim.getWidth(); boolean widthSet = width != null && !"".equals(width) && !SDimension.AUTO.equals(width); String height = dim.getHeight(); boolean heightSet = height != null && !"".equals(height) && !SDimension.AUTO.equals(height); StringBuilder style = new StringBuilder(); if (widthSet) { style.append("width:100%;"); } if (heightSet) { style.append("height:100%;"); } if (style.length() > 0) Utils.optAttribute(device, "style", style); } }
/** * Prints a HTML style attribute with widht/height of 100% if the passed dimension defines a height or width.. * <p>Sample: <code> style="width:100%;"</code> * <p/> * <p>This is typicall needed to stretch inner HTML element to expand to the full dimenstion defined * on an outer, sized HTML element. Otherwise the component would appear to small (as size is applied only * on the invisible outer limiting element) * * @param pStringBuilder buffer to append to * @param pComponent preferredSize trigger dimension */ public static void appendCSSInlineFullSize(StringBuilder pStringBuilder, SComponent pComponent) { SDimension preferredSize = pComponent.getPreferredSize(); if (preferredSize != null && (!SDimension.AUTO.equals(preferredSize.getWidth()) || !SDimension.AUTO.equals(preferredSize.getHeight()))) { pStringBuilder.append("width:100%;height:100%;"); } }
height = getPreferredSize().getHeight(); width = getPreferredSize().getWidth(); } else {
/** * @param d the device to write the code to * @param l the layout manager * @throws IOException */ @Override public void write(Device d, SLayoutManager l) throws IOException { SCardLayout cardLayout = (SCardLayout) l; SContainer container = l.getContainer(); SComponent c = cardLayout.getVisibleComponent(); SDimension preferredSize = container.getPreferredSize(); String height = preferredSize != null ? preferredSize.getHeight() : null; boolean clientLayout = Utils.isMSIE(container) && height != null && !"auto".equals(height); if (clientLayout) d.print("<tr yweight=\"100\">"); else openLayouterRow(d, "100%"); openLayouterCell(d, c); // Just present visible component if (c != null) { c.write(d); } closeLayouterCell(d); closeLayouterRow(d); }
String height = preferredSize != null ? preferredSize.getHeight() : null; boolean clientLayout = Utils.isMSIE(container) && height != null && !"auto".equals(height);
String height = preferredSize != null ? preferredSize.getHeight() : null; boolean clientLayout = Utils.isMSIE(scrollPane) && height != null && !"auto".equals(height) && scrollPane.getMode() != SScrollPane.MODE_COMPLETE;
if (tableWrapping) { actualWidth = preferredSize.getWidth(); Utils.setPreferredSize(component, "100%", preferredSize.getHeight()); device.print("<table style=\"table-layout: fixed; width: " + actualWidth + "\"><tr>"); device.print("<td style=\"padding-right: " + Utils.calculateHorizontalOversize(component, true) + "px\">"); device.print("/>"); if (tableWrapping) { Utils.setPreferredSize(component, actualWidth, preferredSize.getHeight()); device.print("</td></tr></table>");
private static void writeVerticalScrollbar(Device device, SScrollBar sb) throws IOException { SDimension preferredSize = sb.getPreferredSize(); String height = preferredSize != null ? preferredSize.getHeight() : null; boolean clientLayout = Utils.isMSIE(sb) && height != null && !"auto".equals(height); Utils.printNewline(device, sb); device.print("<table"); if (clientLayout) { Utils.optAttribute(device, "layoutHeight", height); Utils.setPreferredSize(sb, preferredSize.getWidth(), null); } sb.setAttribute(CSSProperty.TABLE_LAYOUT, "fixed"); Utils.writeAllAttributes(device, sb); if (clientLayout) { Utils.setPreferredSize(sb, preferredSize.getWidth(), height); sb.getSession().getScriptManager().addScriptListener(new LayoutFillScript(sb.getName())); } device.print("><tbody><tr><td>\n"); device.print("<div class=\"outer\"><div class=\"inner\"/></div>\n"); device.print("</td></tr></tbody></table>"); sb.getSession().getScriptManager().addScriptListener(new VerticalScrollBarLayoutScript(sb)); sb.getSession().getScriptManager().addScriptListener(new VerticalScrollBarSetScript(sb)); }
if (tableWrapping) { String actualWidth = preferredSize.getWidth(); Utils.setPreferredSize(component, "100%", preferredSize.getHeight()); device.print("<table style=\"table-layout: fixed; width: " + actualWidth + "\"><tr>"); device.print("<td style=\"padding-right: " + Utils.calculateHorizontalOversize(component, true) + "px\">");
String height = preferredSize != null ? preferredSize.getHeight() : null; boolean clientLayout = Utils.isMSIE(form) && height != null && !"auto".equals(height) && (layout instanceof SBorderLayout || layout instanceof SGridBagLayout);
scrollPane.setViewportView(viewComponent); scrollPane.setPreferredSize(new SDimension("180px", scrollPane .getPreferredSize().getHeight())); IView<SComponent> view = constructView(scrollPane, viewDescriptor, connector);
if (ieTableWrapping) { actualWidth = preferredSize.getWidth(); Utils.setPreferredSize(component, "100%", preferredSize.getHeight()); if (component.getSession().getUserAgent().getMajorVersion() >= 7) { device.print("<table style=\"width: " + actualWidth + "\"><tr>"); Utils.setPreferredSize(component, actualWidth, preferredSize.getHeight()); device.print("</td></tr></table>");
scrollPane.setViewportView(viewComponent); scrollPane.setPreferredSize(new SDimension("180px", scrollPane .getPreferredSize().getHeight())); IView<SComponent> view = constructView(scrollPane, viewDescriptor, connector);