@Test public void testApplyStyleInternalWithStyle() { styleResolver = createMock(StyleResolver.class); StyleType myStyle = createMock(StyleType.class); myStyle.applyTo(elementType, styleResolver); replay(myStyle); expect(styleResolver.resolve("myStyle")).andReturn(myStyle); replay(styleResolver); elementType.getAttributes().set("style", "myStyle"); elementType.applyStyleInternal(styleResolver); verify(myStyle); verify(styleResolver); }
@Nonnull StyleResolver applyStyleInternal(@Nonnull final StyleResolver styleResolver) { String style = getAttributes().get("style"); if (style != null) { StyleType styleType = styleResolver.resolve(style); if (styleType != null) { styleType.applyTo(this, styleResolver); } if (!style.startsWith("#")) { return new StyleResolverControlDefinintion(styleResolver, style); } } return styleResolver; }
ElementType extends XmlBaseType { @Nonnull StyleResolver applyStyleInternal(@Nonnull final StyleResolver styleResolver) { String style = getAttributes().get("style"); if (style != null) { StyleType styleType = styleResolver.resolve(style); if (styleType != null) { styleType.applyTo(this, styleResolver); } if (!style.startsWith("#")) { return new StyleResolverControlDefinintion(styleResolver, style); } } return styleResolver; } }
ElementType extends XmlBaseType { @Nonnull StyleResolver applyStyleInternal(@Nonnull final StyleResolver styleResolver) { String style = getAttributes().get("style"); if (style != null) { StyleType styleType = styleResolver.resolve(style); if (styleType != null) { styleType.applyTo(this, styleResolver); } if (!style.startsWith("#")) { return new StyleResolverControlDefinintion(styleResolver, style); } } return styleResolver; } ElementType();  ElementType(@Nonnull final ElementType src);  ElementType(@Nonnull final Attributes attributes); }
ElementType extends XmlBaseType { @Nonnull StyleResolver applyStyleInternal(@Nonnull final StyleResolver styleResolver) { String style = getAttributes().get("style"); if (style != null) { StyleType styleType = styleResolver.resolve(style); if (styleType != null) { styleType.applyTo(this, styleResolver); } if (!style.startsWith("#")) { return new StyleResolverControlDefinintion(styleResolver, style); } } return styleResolver; } ElementType();  ElementType(@Nonnull final ElementType src);  ElementType(@Nonnull final Attributes attributes); @Nonnull ElementType copy(); boolean hasElements(); ElementType getFirstElement(); void addElementType(@Nonnull final ElementType type); void addPanel(@Nonnull final ElementType panel); void addImage(@Nonnull final ElementType image); void addLabel(@Nonnull final ElementType label); void addText(@Nonnull final ElementType text); void addControl(@Nonnull final ElementType text); void setInteract(@Nonnull final InteractType interactParam); void setEffect(@Nonnull final EffectsType effectsParam); @Override @Nonnull String output(final int offset); @Nonnull Element create(
      @Nonnull final Element parent,
      @Nonnull final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final LayoutPart layoutPart); @Nonnull Element create(
      @Nonnull final Element parent,
      @Nonnull final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final LayoutPart layoutPart,
      final int index); void applyAttributes(
      @Nonnull final Screen screen,
      @Nonnull final Element element,
      @Nullable final Attributes work,
      @Nonnull final NiftyRenderEngine renderEngine); void applyPostAttributes(
      @Nonnull final Element element,
      @Nullable final Attributes work,
      @Nonnull final NiftyRenderEngine renderEngine); void applyEffects(
      @Nonnull final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final Element element); void applyInteract(
      final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final Element element); void refreshAttributes(
      @Nonnull final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final Element element,
      @Nonnull final ControlAttributes attributes); @Nonnull InteractType getInteract(); @Nonnull EffectsType getEffects(); @Nonnull Collection<ElementType> getElements(); void prepare(
      @Nonnull final Nifty nifty,
      @Nullable final Screen screen,
      @Nonnull final ElementType rootElementType); boolean isPrepared(); @Override void translateSpecialValues(@Nonnull final Nifty nifty, @Nullable final Screen screen); void applyStyles(@Nonnull final StyleResolver styleResolver); void attachController(@Nullable final Controller controller); void removeWithTag(@Nonnull final String styleId); void connectParentControls(@Nonnull final Element parent); }
ElementType extends XmlBaseType { @Nonnull StyleResolver applyStyleInternal(@Nonnull final StyleResolver styleResolver) { String style = getAttributes().get("style"); if (style != null) { StyleType styleType = styleResolver.resolve(style); if (styleType != null) { styleType.applyTo(this, styleResolver); } if (!style.startsWith("#")) { return new StyleResolverControlDefinintion(styleResolver, style); } } return styleResolver; } ElementType();  ElementType(@Nonnull final ElementType src);  ElementType(@Nonnull final Attributes attributes); @Nonnull ElementType copy(); boolean hasElements(); ElementType getFirstElement(); void addElementType(@Nonnull final ElementType type); void addPanel(@Nonnull final ElementType panel); void addImage(@Nonnull final ElementType image); void addLabel(@Nonnull final ElementType label); void addText(@Nonnull final ElementType text); void addControl(@Nonnull final ElementType text); void setInteract(@Nonnull final InteractType interactParam); void setEffect(@Nonnull final EffectsType effectsParam); @Override @Nonnull String output(final int offset); @Nonnull Element create(
      @Nonnull final Element parent,
      @Nonnull final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final LayoutPart layoutPart); @Nonnull Element create(
      @Nonnull final Element parent,
      @Nonnull final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final LayoutPart layoutPart,
      final int index); void applyAttributes(
      @Nonnull final Screen screen,
      @Nonnull final Element element,
      @Nullable final Attributes work,
      @Nonnull final NiftyRenderEngine renderEngine); void applyPostAttributes(
      @Nonnull final Element element,
      @Nullable final Attributes work,
      @Nonnull final NiftyRenderEngine renderEngine); void applyEffects(
      @Nonnull final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final Element element); void applyInteract(
      final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final Element element); void refreshAttributes(
      @Nonnull final Nifty nifty,
      @Nonnull final Screen screen,
      @Nonnull final Element element,
      @Nonnull final ControlAttributes attributes); @Nonnull InteractType getInteract(); @Nonnull EffectsType getEffects(); @Nonnull Collection<ElementType> getElements(); void prepare(
      @Nonnull final Nifty nifty,
      @Nullable final Screen screen,
      @Nonnull final ElementType rootElementType); boolean isPrepared(); @Override void translateSpecialValues(@Nonnull final Nifty nifty, @Nullable final Screen screen); void applyStyles(@Nonnull final StyleResolver styleResolver); void attachController(@Nullable final Controller controller); void removeWithTag(@Nonnull final String styleId); void connectParentControls(@Nonnull final Element parent);  }