Example usage for com.vaadin.shared.ui MarginInfo hasBottom

List of usage examples for com.vaadin.shared.ui MarginInfo hasBottom

Introduction

In this page you can find the example usage for com.vaadin.shared.ui MarginInfo hasBottom.

Prototype

public boolean hasBottom() 

Source Link

Document

Checks if this MarginInfo object has the bottom edge margin enabled.

Usage

From source file:com.haulmont.cuba.web.gui.components.WebAbstractBox.java

License:Apache License

@Override
public void setMargin(com.haulmont.cuba.gui.components.MarginInfo marginInfo) {
    MarginInfo vMargin = new MarginInfo(marginInfo.hasTop(), marginInfo.hasRight(), marginInfo.hasBottom(),
            marginInfo.hasLeft());//from w ww. j  a v  a 2 s . co  m
    component.setMargin(vMargin);
}

From source file:com.haulmont.cuba.web.gui.components.WebAbstractBox.java

License:Apache License

@Override
public com.haulmont.cuba.gui.components.MarginInfo getMargin() {
    MarginInfo vMargin = component.getMargin();
    return new com.haulmont.cuba.gui.components.MarginInfo(vMargin.hasTop(), vMargin.hasRight(),
            vMargin.hasBottom(), vMargin.hasLeft());
}

From source file:com.haulmont.cuba.web.gui.components.WebGroupBox.java

License:Apache License

@Override
public void setOuterMargin(com.haulmont.cuba.gui.components.MarginInfo marginInfo) {
    MarginInfo vMargin = new MarginInfo(marginInfo.hasTop(), marginInfo.hasRight(), marginInfo.hasBottom(),
            marginInfo.hasLeft());//w  ww.  jav  a  2 s  .co m
    component.setOuterMargin(vMargin);
}

From source file:com.haulmont.cuba.web.gui.components.WebGroupBox.java

License:Apache License

@Override
public com.haulmont.cuba.gui.components.MarginInfo getOuterMargin() {
    MarginInfo vMargin = component.getOuterMargin();
    return new com.haulmont.cuba.gui.components.MarginInfo(vMargin.hasTop(), vMargin.hasRight(),
            vMargin.hasBottom(), vMargin.hasLeft());
}

From source file:com.haulmont.cuba.web.gui.components.WebScrollBoxLayout.java

License:Apache License

@Override
public com.haulmont.cuba.gui.components.MarginInfo getMargin() {
    MarginInfo vMargin = getContent().getMargin();
    return new com.haulmont.cuba.gui.components.MarginInfo(vMargin.hasTop(), vMargin.hasRight(),
            vMargin.hasBottom(), vMargin.hasLeft());
}

From source file:com.haulmont.cuba.web.gui.WebWindow.java

License:Apache License

@Override
public void setMargin(com.haulmont.cuba.gui.components.MarginInfo marginInfo) {
    if (getContainer() instanceof Layout.MarginHandler) {
        MarginInfo vMargin = new MarginInfo(marginInfo.hasTop(), marginInfo.hasRight(), marginInfo.hasBottom(),
                marginInfo.hasLeft());//from   www .  j a  v a  2  s. c o m
        ((Layout.MarginHandler) getContainer()).setMargin(vMargin);
    }
}

From source file:com.haulmont.cuba.web.gui.WebWindow.java

License:Apache License

@Override
public com.haulmont.cuba.gui.components.MarginInfo getMargin() {
    if (getContainer() instanceof Layout.MarginHandler) {
        MarginInfo vMargin = ((Layout.MarginHandler) getContainer()).getMargin();
        return new com.haulmont.cuba.gui.components.MarginInfo(vMargin.hasTop(), vMargin.hasRight(),
                vMargin.hasBottom(), vMargin.hasLeft());
    }/*w  ww . j  a v a2  s. c  om*/
    return new com.haulmont.cuba.gui.components.MarginInfo(false);
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.cssactionslayout.CubaCssActionsLayoutWidget.java

License:Apache License

public void setMargin(MarginInfo marginInfo) {
    if (marginInfo != null) {
        // Styles inherited from v-csslayout from base theme
        enableStyleDependentName("margin-top", marginInfo.hasTop());
        enableStyleDependentName("margin-right", marginInfo.hasRight());
        enableStyleDependentName("margin-bottom", marginInfo.hasBottom());
        enableStyleDependentName("margin-left", marginInfo.hasLeft());
    }//from  ww  w  .  j a v  a 2  s.  c om
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.groupbox.CubaGroupBoxWidget.java

License:Apache License

public void setOuterMargin(MarginInfo marginInfo) {
    this.marginInfo = marginInfo;
    if (marginInfo != null) {
        setStyleName("c-outer-margin-top", marginInfo.hasTop());
        setStyleName("c-outer-margin-right", marginInfo.hasRight());
        setStyleName("c-outer-margin-bottom", marginInfo.hasBottom());
        setStyleName("c-outer-margin-left", marginInfo.hasLeft());
    }/*from   w w w . j a  v a  2 s.c om*/
}

From source file:org.vaadin.declarative.SpyComponentFactory.java

License:Apache License

private void initHandlers() {
    addHandler((Consumer<JExpression> expr, Object obj) -> expr.accept(JExpr.lit(((Number) obj).longValue())),
            byte.class, Byte.class, short.class, Short.class, int.class, Integer.class, long.class, Long.class);

    addHandler((Consumer<JExpression> expr, Object obj) -> expr.accept(JExpr.lit(((Number) obj).doubleValue())),
            float.class, Float.class, double.class, Double.class);

    addHandler(/*from w w w . j  a va  2s  . c  o  m*/
            (Consumer<JExpression> expr, Object obj) -> expr.accept(JExpr.lit(((Character) obj).charValue())),
            char.class, Character.class);

    addHandler((Consumer<JExpression> expr, Object obj) -> expr.accept(JExpr.lit(((String) obj))), String.class,
            CharSequence.class);

    addHandler((Consumer<JExpression> expr, Object obj) -> expr.accept(JExpr.lit(((Boolean) obj))),
            boolean.class, Boolean.class);

    addHandler((Consumer<JExpression> expr, Object obj) -> {
        @SuppressWarnings("RedundantCast")
        String constName = alignments.get((Alignment) obj);
        expr.accept(((JClass) jCodeModel._ref(Alignment.class)).staticRef(constName));
    }, Alignment.class);

    addHandler((Consumer<JExpression> expr, Object obj) -> {
        JClass jClass = (JClass) jCodeModel._ref((Class<?>) obj);
        expr.accept(jClass.dotclass());
    }, Class.class);

    addHandler((Consumer<JExpression> expr, Object obj) -> {
        @SuppressWarnings("RedundantCast")
        MarginInfo marginInfo = (MarginInfo) obj;
        expr.accept(JExpr._new(jCodeModel._ref(MarginInfo.class)).arg(JExpr.lit(marginInfo.hasTop()))
                .arg(JExpr.lit(marginInfo.hasRight())).arg(JExpr.lit(marginInfo.hasBottom()))
                .arg(JExpr.lit(marginInfo.hasLeft())));
    }, MarginInfo.class);

    for (Field field : Alignment.class.getDeclaredFields()) {
        if (Alignment.class.equals(field.getType()) && (field.getModifiers() & Modifier.STATIC) != 0) {
            try {
                alignments.put((Alignment) field.get(null), field.getName());
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
    }
}