cssimagegwtcssresourceclientbundle

GWT css background image


I use GWT 2.1.1

In package resources i have png images and one css file.

In css file i wrote:

.finishedTask {
    background: white url("tick64.png") center center;
    padding: 0.5em;
    border: 0;
}

.unFinishedTask {
    background-color: white;
    padding: 0.5em;
    border: 0;
}

Than i create ClientBundle interface extension. With this CSS and images.

Than in UiBunder view i try to change css style:

    textArea.setStyleName(isFinished() ? res.style().finishedTask() : 
res.style().unFinishedTask());

When this code executed css layout of textArea are broken but i see that class changed (FireBug). Seems bug in css.

Maybe somebody already tried do the same thing.


Solution

  • Probably you should use addStyleName or addStyleDependentName instead of setStyleName which remove existing styles.