All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wings.plaf.css.ScrollPaneLayoutCG Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2005 Your Corporation. All Rights Reserved.
 */
package org.wings.plaf.css;

import org.wings.*;
import org.wings.io.Device;

import java.io.IOException;
import java.util.Map;

public class ScrollPaneLayoutCG extends AbstractLayoutCG {

    private static final long serialVersionUID = 1L;

    @Override
    public void write(Device d, SLayoutManager l) throws IOException {
        SScrollPaneLayout layout = (SScrollPaneLayout) l;
        SScrollPane scrollpane = (SScrollPane) layout.getContainer();

        if (scrollpane.getMode() != SScrollPane.MODE_COMPLETE) {
            writePaging(d, layout);
        } else {
            writeNonePaging(d, layout);
        }
    }

    protected static void writeNonePaging(Device d, SScrollPaneLayout layout) throws IOException {
        openLayouterBody(d, layout);
        if( Utils.isMSIEVersion( 8 ) )
        	d.print("
"); else d.print("
"); Map components = layout.getComponents(); SComponent center = (SComponent) components.get(SScrollPaneLayout.VIEWPORT); writeComponent(d, center); d.print("
"); closeLayouterBody(d, layout); } protected static void writePaging(Device d, SScrollPaneLayout layout) throws IOException { SContainer container = layout.getContainer(); Map components = layout.getComponents(); SComponent north = (SComponent) components.get(SScrollPaneLayout.NORTH); SComponent east = (SComponent) components.get(SScrollPaneLayout.EAST); SComponent center = (SComponent) components.get(SScrollPaneLayout.VIEWPORT); SComponent west = (SComponent) components.get(SScrollPaneLayout.WEST); SComponent south = (SComponent) components.get(SScrollPaneLayout.SOUTH); SDimension preferredSize = container.getPreferredSize(); String height = preferredSize != null ? preferredSize.getHeight() : null; boolean clientLayout = Utils.isMSIE(container) && height != null && !"auto".equals(height); openLayouterBody(d, layout); if (north != null) { if (clientLayout) d.print(""); else d.print(""); if (west != null) { d.print(""); } d.print(""); writeComponent(d, north); d.print(""); if (east != null) { d.print(""); } d.print("\n"); } if (clientLayout) d.print(""); else d.print(""); if (west != null) { d.print(""); writeComponent(d, west); d.print(""); } if (center != null) { d.print(""); writeComponent(d, center); d.print(""); } if (east != null) { d.print(""); writeComponent(d, east); d.print(""); } d.print("\n"); if (south != null) { if (clientLayout) d.print(""); else d.print(""); if (west != null) { d.print(""); } d.print(""); writeComponent(d, south); d.print(""); if (east != null) { d.print(""); } d.print("\n"); } closeLayouterBody(d, layout); } protected static void writeComponent(Device d, SComponent c) throws IOException { c.write(d); } @Override protected int getLayoutHGap(SLayoutManager layout) { return -1; } @Override protected int getLayoutVGap(SLayoutManager layout) { return -1; } @Override protected int getLayoutBorder(SLayoutManager layout) { return -1; } @Override protected int layoutOversize(SLayoutManager layout) { return 0; } @Override public int getDefaultLayoutCellHAlignment() { return SConstants.NO_ALIGN; } @Override public int getDefaultLayoutCellVAlignment() { return SConstants.NO_ALIGN; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy