@Test public void styleOf() { StubFlowPanel p = new StubFlowPanel(); TakesValue<String> style = TakesValues.styleOf(p); assertThat(style.getValue(), is(nullValue())); style.setValue("foo"); assertThat(p, hasStyle("foo")); assertThat(style.getValue(), is("foo")); style.setValue("bar"); assertThat(p, hasStyle("bar")); assertThat(p, not(hasStyle("foo"))); assertThat(style.getValue(), is("bar")); style.setValue(null); assertThat(p, not(hasStyle("bar"))); assertThat(style.getValue(), is(nullValue())); style.setValue(""); assertThat(style.getValue(), is(nullValue())); }
public static TakesValue<String> styleOf(final HasCss target) { return new TakesValue<String>() { private String lastAddedStyle; @Override public String getValue() { return lastAddedStyle; } @Override public void setValue(String value) { if (lastAddedStyle != null) { target.removeStyleName(lastAddedStyle); lastAddedStyle = null; } if (value != null && !"".equals(value)) { target.addStyleName(value); lastAddedStyle = value; } } }; }
TakesValues { public static TakesValue<String> styleOf(final HasCss target) { return new TakesValue<String>() { private String lastAddedStyle; @Override public String getValue() { return lastAddedStyle; } @Override public void setValue(String value) { if (lastAddedStyle != null) { target.removeStyleName(lastAddedStyle); lastAddedStyle = null; } if (value != null && !"".equals(value)) { target.addStyleName(value); lastAddedStyle = value; } } }; } }
TakesValues { public static TakesValue<String> styleOf(final HasCss target) { return new TakesValue<String>() { private String lastAddedStyle; @Override public String getValue() { return lastAddedStyle; } @Override public void setValue(String value) { if (lastAddedStyle != null) { target.removeStyleName(lastAddedStyle); lastAddedStyle = null; } if (value != null && !"".equals(value)) { target.addStyleName(value); lastAddedStyle = value; } } }; }  }
TakesValues { public static TakesValue<String> styleOf(final HasCss target) { return new TakesValue<String>() { private String lastAddedStyle; @Override public String getValue() { return lastAddedStyle; } @Override public void setValue(String value) { if (lastAddedStyle != null) { target.removeStyleName(lastAddedStyle); lastAddedStyle = null; } if (value != null && !"".equals(value)) { target.addStyleName(value); lastAddedStyle = value; } } }; }  static TakesValue<String> textOf(final HasText target); static TakesValue<String> textOf(final IsElement target); static TakesValue<String> innerTextOf(final IsWidget target); static TakesValue<String> htmlOf(final HasHTML target); static TakesValue<String> htmlOf(final IsElement target); static TakesValue<String> urlOf(final IsImage target); static TakesValue<String> debugId(final IsWidget w); static SetsValue<String> debugIdSuffix(final HasEnsureDebugIdSuffix w); static TakesValue<String> styleOf(final HasCss target); static TakesValue<String> attributeOf(final IsElement target, final String attribute); }
TakesValues { public static TakesValue<String> styleOf(final HasCss target) { return new TakesValue<String>() { private String lastAddedStyle; @Override public String getValue() { return lastAddedStyle; } @Override public void setValue(String value) { if (lastAddedStyle != null) { target.removeStyleName(lastAddedStyle); lastAddedStyle = null; } if (value != null && !"".equals(value)) { target.addStyleName(value); lastAddedStyle = value; } } }; }  static TakesValue<String> textOf(final HasText target); static TakesValue<String> textOf(final IsElement target); static TakesValue<String> innerTextOf(final IsWidget target); static TakesValue<String> htmlOf(final HasHTML target); static TakesValue<String> htmlOf(final IsElement target); static TakesValue<String> urlOf(final IsImage target); static TakesValue<String> debugId(final IsWidget w); static SetsValue<String> debugIdSuffix(final HasEnsureDebugIdSuffix w); static TakesValue<String> styleOf(final HasCss target); static TakesValue<String> attributeOf(final IsElement target, final String attribute);  }