Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Our own imageResources are not found when disabled in Firefox 38 and higher

    Hello.

    We have our own images ressources which are loaded at runtime :

    @Source("add.png")
    ImageResource add();

    @Source("delete.png")
    ImageResource delete();


    These imageResources are used as constructor-parameter:

    public class CATVImgButton extends ImgButton {
    public CATVImgButton(ImageResource imageResource) {
    this.setShowDisabledIcon(false);
    this.setShowFocused(false);
    this.setShowRollOver(false);
    this.setShowDown(false);
    String safeUri = imageResource.getSafeUri().asString();
    this.setSrc(safeUri);
    this.setSize(CATVListGrid.BUTTON_SIZE);
    }

    public void setImg(ImageResource imageResource) {
    this.setSrc(imageResource.getSafeUri().asString());
    }
    }
    We create and use these the buttons in a DynamicForm object :
    private final add = new CATVImgButton(Resources.INSTANCE.add());
    private final delete = new CATVImgButton(Resources.INSTANCE.delete());



    // HLayout
    final HLayout hLayout = new HLayout();
    ...
    // HLayout contains add and remove buttons
    hLayout.addMember(this.add);
    hLayout.addMember(this.delete);

    // CanvasItem contains hLayout
    final CanvasItem vodContentsButtons = new CanvasItem();
    vodContentsButtons.setShowTitle(false);
    vodContentsButtons.setWidth("*");
    vodContentsButtons.setColSpan("*");
    vodContentsButtons.setCanvas(hLayout);
    vodContentsButtons.setGlobalTabIndex(4);

    ...

    // Set Datasource and fields to Form
    this.form.setDataSource(EnumDataSource.VOD_PROMO_SCREEN.rest());
    this.form.setItems(...
    vodContentsButtons,
    this.vodContentsCanvasItem);

    // add stack to form layout
    this.addMember(this.form);

    if (update) {
    this.form.setCanEdit(false);
    }
    else{
    this.form.setCanEdit(true);
    }


    At creation, the DynamicForm has its fields enabled (good) and the add and delete icons are well-displayed (see screenshot1).
    At update, the DynamicForm has its fields disabled (good) but the add and delete icons are displayed as not-found images (see screenshot2).
    In the Web Console, we have that :
    Failed to load resource: the server responded with a status of 404 (Not Found)
    http://localhost:8080/catv_web_clien...4,iVBORw0KGgoA...
    Failed to load resource: the server responded with a status of 404 (Not Found)
    http://localhost:8080/catv_web_clien...64,iVBORw0KGgo....
    This appears with the line this.setShowDisabledIcon(false); commented and uncommented
    For some of our HMI, a workaround is to use the hide() and show() methods in the CATVImgButton objects but it is not efficients on all our HMI and the errors in the log console remains for all of them.

    Why trying to load these images from the "images/_Disableddata" directory?




    Regards.
    Attached Files

    #2
    setShowDisabledIcon() controls statefulness for the icon, specified via setIcon() property. You want setShowDisabled(false); this controls what happens to the image you've specified via setSrc().

    However, it does appear that you want a distinct disabled appearance for these controls, so you probably want to scrap all of the above and render the images via imgButton.baseStyle instead, which still allows data URLs.

    Comment

    Working...
    X