wffweb/src/main/java/com/webfirmframework/wffweb/css/Margin.java
public void setMargin(final MarginTop marginTop,
            final MarginRight marginRight, final MarginBottom marginBottom,
            final MarginLeft marginLeft) {

        if (marginTop != null && marginRight != null && marginBottom != null
                && marginLeft != null) {

            if (MarginTop.INITIAL.equals(marginTop.getCssValue())
                    || MarginTop.INHERIT.equals(marginTop.getCssValue())
                    || MarginRight.INITIAL.equals(marginRight.getCssValue())
                    || MarginRight.INHERIT.equals(marginRight.getCssValue())
                    || MarginBottom.INITIAL.equals(marginBottom.getCssValue())
                    || MarginBottom.INHERIT.equals(marginBottom.getCssValue())
                    || MarginLeft.INITIAL.equals(marginLeft.getCssValue())
                    || MarginLeft.INHERIT.equals(marginLeft.getCssValue())) {
                throw new InvalidValueException(
                        "Any or all of the given arguments have initial/inherit constant value as its cssValue");
            }

            try {
                final MarginTop marginTopTemp;
                final MarginRight marginRightTemp;
                final MarginBottom marginBottomTemp;
                final MarginLeft marginLeftTemp;

                if (this.marginTop != null) {
                    this.marginTop.setAlreadyInUse(false);
                    this.marginRight.setAlreadyInUse(false);
                    this.marginBottom.setAlreadyInUse(false);
                    this.marginLeft.setAlreadyInUse(false);
                }

                if (marginTop.isAlreadyInUse() && this.marginTop != marginTop) {
                    if (this.marginTop != null) {
                        marginTopTemp = this.marginTop
                                .setCssValue(marginTop.getCssValue());
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginTop is already used by another object so the existing object is used");
                        }
                    } else {
                        marginTopTemp = marginTop.clone();
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginTop is already used by another object so its clone is assigned");
                        }
                    }
                } else {
                    marginTopTemp = marginTop;
                }

                if (marginRight.isAlreadyInUse()
                        && this.marginRight != marginRight) {
                    if (this.marginRight != null) {
                        marginRightTemp = this.marginRight
                                .setCssValue(marginTop.getCssValue());
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginRight is already used by another object so the existing object is used");
                        }
                    } else {
                        marginRightTemp = marginRight.clone();
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginRight is already used by another object so its clone is assigned");
                        }
                    }

                } else {
                    marginRightTemp = marginRight;
                }

                if (marginBottom.isAlreadyInUse()
                        && this.marginBottom != marginBottom) {
                    if (this.marginBottom != null) {
                        marginBottomTemp = this.marginBottom
                                .setCssValue(marginTop.getCssValue());
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginBottom is already used by another object so the existing object is used");
                        }
                    } else {
                        marginBottomTemp = marginBottom.clone();
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginBottom is already used by another object so its clone is assigned");
                        }
                    }

                } else {
                    marginBottomTemp = marginBottom;
                }

                if (marginLeft.isAlreadyInUse()
                        && this.marginLeft != marginLeft) {
                    if (this.marginLeft != null) {
                        marginLeftTemp = this.marginLeft
                                .setCssValue(marginTop.getCssValue());
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginLeft is already used by another object so the existing object is used");
                        }
                    } else {
                        marginLeftTemp = marginLeft.clone();
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginLeft is already used by another object so its clone is assigned");
                        }
                    }

                } else {
                    marginLeftTemp = marginLeft;
                }

                marginTopTemp.setAlreadyInUse(true);
                marginTopTemp.setStateChangeInformer(this);

                marginRightTemp.setAlreadyInUse(true);
                marginRightTemp.setStateChangeInformer(this);

                marginBottomTemp.setAlreadyInUse(true);
                marginBottomTemp.setStateChangeInformer(this);

                marginLeftTemp.setAlreadyInUse(true);
                marginLeftTemp.setStateChangeInformer(this);

                assignProducedCssValue(marginTop, marginRight, marginBottom,
                        marginLeft);

                this.marginTop = marginTopTemp;
                this.marginRight = marginRightTemp;
                this.marginBottom = marginBottomTemp;
                this.marginLeft = marginLeftTemp;

            } catch (final CloneNotSupportedException e) {
                throw new InvalidValueException(e);
            } catch (final Exception e) {
                throw new InvalidValueException(e);
            }

        } else {
            throw new NullValueException("cannot accept null arguments");
        }

    }
public void setMargin(final MarginTop marginTop,
            final MarginRight marginRight, final MarginBottom marginBottom,
            final MarginLeft marginLeft) {

        if (marginTop != null && marginRight != null && marginBottom != null
                && marginLeft != null) {

            if (MarginTop.INITIAL.equals(marginTop.getCssValue())
                    || MarginTop.INHERIT.equals(marginTop.getCssValue())
                    || MarginRight.INITIAL.equals(marginRight.getCssValue())
                    || MarginRight.INHERIT.equals(marginRight.getCssValue())
                    || MarginBottom.INITIAL.equals(marginBottom.getCssValue())
                    || MarginBottom.INHERIT.equals(marginBottom.getCssValue())
                    || MarginLeft.INITIAL.equals(marginLeft.getCssValue())
                    || MarginLeft.INHERIT.equals(marginLeft.getCssValue())) {
                throw new InvalidValueException(
                        "Any or all of the given arguments have initial/inherit constant value as its cssValue");
            }

            try {
                final MarginTop marginTopTemp;
                final MarginRight marginRightTemp;
                final MarginBottom marginBottomTemp;
                final MarginLeft marginLeftTemp;

                if (this.marginTop != null) {
                    this.marginTop.setAlreadyInUse(false);
                    this.marginRight.setAlreadyInUse(false);
                    this.marginBottom.setAlreadyInUse(false);
                    this.marginLeft.setAlreadyInUse(false);
                }

                if (marginTop.isAlreadyInUse() && this.marginTop != marginTop) {
                    if (this.marginTop != null) {
                        marginTopTemp = this.marginTop
                                .setCssValue(marginTop.getCssValue());
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginTop is already used by another object so the existing object is used");
                        }
                    } else {
                        marginTopTemp = marginTop.clone();
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginTop is already used by another object so its clone is assigned");
                        }
                    }
                } else {
                    marginTopTemp = marginTop;
                }

                if (marginRight.isAlreadyInUse()
                        && this.marginRight != marginRight) {
                    if (this.marginRight != null) {
                        marginRightTemp = this.marginRight
                                .setCssValue(marginTop.getCssValue());
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginRight is already used by another object so the existing object is used");
                        }
                    } else {
                        marginRightTemp = marginRight.clone();
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginRight is already used by another object so its clone is assigned");
                        }
                    }

                } else {
                    marginRightTemp = marginRight;
                }

                if (marginBottom.isAlreadyInUse()
                        && this.marginBottom != marginBottom) {
                    if (this.marginBottom != null) {
                        marginBottomTemp = this.marginBottom
                                .setCssValue(marginTop.getCssValue());
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginBottom is already used by another object so the existing object is used");
                        }
                    } else {
                        marginBottomTemp = marginBottom.clone();
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginBottom is already used by another object so its clone is assigned");
                        }
                    }

                } else {
                    marginBottomTemp = marginBottom;
                }

                if (marginLeft.isAlreadyInUse()
                        && this.marginLeft != marginLeft) {
                    if (this.marginLeft != null) {
                        marginLeftTemp = this.marginLeft
                                .setCssValue(marginTop.getCssValue());
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginLeft is already used by another object so the existing object is used");
                        }
                    } else {
                        marginLeftTemp = marginLeft.clone();
                        if (LOGGER.isLoggable(Level.WARNING)) {
                            LOGGER.warning(
                                    "the given marginLeft is already used by another object so its clone is assigned");
                        }
                    }

                } else {
                    marginLeftTemp = marginLeft;
                }

                marginTopTemp.setAlreadyInUse(true);
                marginTopTemp.setStateChangeInformer(this);

                marginRightTemp.setAlreadyInUse(true);
                marginRightTemp.setStateChangeInformer(this);

                marginBottomTemp.setAlreadyInUse(true);
                marginBottomTemp.setStateChangeInformer(this);

                marginLeftTemp.setAlreadyInUse(true);
                marginLeftTemp.setStateChangeInformer(this);

                assignProducedCssValue(marginTop, marginRight, marginBottom,
                        marginLeft);

                this.marginTop = marginTopTemp;
                this.marginRight = marginRightTemp;
                this.marginBottom = marginBottomTemp;
                this.marginLeft = marginLeftTemp;

            } catch (final CloneNotSupportedException e) {
                throw new InvalidValueException(e);
            } catch (final Exception e) {
                throw new InvalidValueException(e);
            }

        } else {
            throw new NullValueException("cannot accept null arguments");
        }

    }
public void setMargin ( final MarginTop marginTop , final MarginRight marginRight , final MarginBottom marginBottom , final MarginLeft marginLeft ) { if ( marginTop != null && marginRight != null && marginBottom != null && marginLeft != null ) { if ( MarginTop . INITIAL . equals ( marginTop . getCssValue ( ) ) || MarginTop . INHERIT . equals ( marginTop . getCssValue ( ) ) || MarginRight . INITIAL . equals ( marginRight . getCssValue ( ) ) || MarginRight . INHERIT . equals ( marginRight . getCssValue ( ) ) || MarginBottom . INITIAL . equals ( marginBottom . getCssValue ( ) ) || MarginBottom . INHERIT . equals ( marginBottom . getCssValue ( ) ) || MarginLeft . INITIAL . equals ( marginLeft . getCssValue ( ) ) || MarginLeft . INHERIT . equals ( marginLeft . getCssValue ( ) ) ) { throw new InvalidValueException ( "Any or all of the given arguments have initial/inherit constant value as its cssValue" ) ; } try { final MarginTop marginTopTemp ; final MarginRight marginRightTemp ; final MarginBottom marginBottomTemp ; final MarginLeft marginLeftTemp ; if ( this . marginTop != null ) { this . marginTop . setAlreadyInUse ( false ) ; this . marginRight . setAlreadyInUse ( false ) ; this . marginBottom . setAlreadyInUse ( false ) ; this . marginLeft . setAlreadyInUse ( false ) ; } if ( marginTop . isAlreadyInUse ( ) && this . marginTop != marginTop ) { if ( this . marginTop != null ) { marginTopTemp = this . marginTop . setCssValue ( marginTop . getCssValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginTop is already used by another object so the existing object is used" ) ; } } else { marginTopTemp = marginTop . clone ( ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginTop is already used by another object so its clone is assigned" ) ; } } } else { marginTopTemp = marginTop ; } if ( marginRight . isAlreadyInUse ( ) && this . marginRight != marginRight ) { if ( this . marginRight != null ) { marginRightTemp = this . marginRight . setCssValue ( marginTop . getCssValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginRight is already used by another object so the existing object is used" ) ; } } else { marginRightTemp = marginRight . clone ( ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginRight is already used by another object so its clone is assigned" ) ; } } } else { marginRightTemp = marginRight ; } if ( marginBottom . isAlreadyInUse ( ) && this . marginBottom != marginBottom ) { if ( this . marginBottom != null ) { marginBottomTemp = this . marginBottom . setCssValue ( marginTop . getCssValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginBottom is already used by another object so the existing object is used" ) ; } } else { marginBottomTemp = marginBottom . clone ( ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginBottom is already used by another object so its clone is assigned" ) ; } } } else { marginBottomTemp = marginBottom ; } if ( marginLeft . isAlreadyInUse ( ) && this . marginLeft != marginLeft ) { if ( this . marginLeft != null ) { marginLeftTemp = this . marginLeft . setCssValue ( marginTop . getCssValue ( ) ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginLeft is already used by another object so the existing object is used" ) ; } } else { marginLeftTemp = marginLeft . clone ( ) ; if ( LOGGER . isLoggable ( Level . WARNING ) ) { LOGGER . warning ( "the given marginLeft is already used by another object so its clone is assigned" ) ; } } } else { marginLeftTemp = marginLeft ; } marginTopTemp . setAlreadyInUse ( true ) ; marginTopTemp . setStateChangeInformer ( this ) ; marginRightTemp . setAlreadyInUse ( true ) ; marginRightTemp . setStateChangeInformer ( this ) ; marginBottomTemp . setAlreadyInUse ( true ) ; marginBottomTemp . setStateChangeInformer ( this ) ; marginLeftTemp . setAlreadyInUse ( true ) ; marginLeftTemp . setStateChangeInformer ( this ) ; assignProducedCssValue ( marginTop , marginRight , marginBottom , marginLeft ) ; this . marginTop = marginTopTemp ; this . marginRight = marginRightTemp ; this . marginBottom = marginBottomTemp ; this . marginLeft = marginLeftTemp ; } catch ( final CloneNotSupportedException e ) { throw new InvalidValueException ( e ) ; } catch ( final Exception e ) { throw new InvalidValueException ( e ) ; } } else { throw new NullValueException ( "cannot accept null arguments" ) ; } }
sets the top, right, bottom and left width in {@code Margin}. If the
given argument is already used by another object, then the
existing/cloned object will be used. And throws
{@code NullValueException} if any of the given argument is null.

@param marginTop
@param marginRight
@param marginBottom
@param marginLeft
@author WFF
@since 1.0.0
sets the top right bottom and left width in { @code Margin } . If the given argument is already used by another object then the existing / cloned object will be used . And throws { @code NullValueException } if any of the given argument is null .