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

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

Introduction

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

Prototype

public boolean hasTop() 

Source Link

Document

Checks if this MarginInfo object has the top 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());/*  w  w  w.  ja v a  2s.  c  o 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  w  w .  j  ava2 s  .  c o 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  w ww  .  ja v  a2  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());
    }//from  w w  w. ja  v  a  2  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());
    }//w  w w .j a  v a  2  s. c o  m
}

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());
    }/*w  ww  . j  av a2s  .co  m*/
}

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 ww  w.  ja v  a 2  s .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);
            }
        }
    }
}