How to import image from one ClientBundle to use it in style of another ClientBundle

69 Views Asked by At

I have like one client bundle :

public interface FirstClientBundle extends ClientBundle {

  public static final FirstClientBundle INSTANCE = 
  GWT.create(FirstClientBundle.class);

  @Source("panel-top-bg.png")
  public ImageResource panelTopBg();
}

and I'd like to use image from first Bundle in styles of another Bundle. Something like this:

public interface SecondClientBundle extends ClientBundle {

  public static final SecondClientBundle INSTANCE = 
  GWT.create(SecondClientBundle.class);

  public interface Style extends CssResource {
    @ClassName("panelTop")
    String panelTop();
  }

  @Source({ "style.css" })
  public Style style();
}

end the CSS file looks like:

@sprite .panel-top {
  gwt-image: "FirstClientBundle.panelTopBg";
  height: 18px;
  cursor: move;
}

Is it even possible? Or should I do whole thing differently?

1

There are 1 best solutions below

5
slugmandrew On

Could you write the second ClientBundle as a subinterface of the first one?

public interface SecondClientBundle extends FirstClientBundle