mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-02 19:27:57 +08:00
PL-10534 Button.setAction doesn't refresh UI element
This commit is contained in:
parent
14d8497d16
commit
9e8e355c0e
@ -33,6 +33,7 @@ import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DesktopButton extends DesktopAbstractComponent<JButton> implements Button {
|
||||
|
||||
@ -95,6 +96,15 @@ public class DesktopButton extends DesktopAbstractComponent<JButton> implements
|
||||
if (this.action != null) {
|
||||
this.action.removeOwner(this);
|
||||
this.action.removePropertyChangeListener(actionPropertyChangeListener);
|
||||
if (Objects.equals(this.action.getCaption(), getCaption())) {
|
||||
setCaption(null);
|
||||
}
|
||||
if (Objects.equals(this.action.getDescription(), getDescription())) {
|
||||
setDescription(null);
|
||||
}
|
||||
if (Objects.equals(this.action.getIcon(), getIcon())) {
|
||||
setIcon(null);
|
||||
}
|
||||
}
|
||||
|
||||
this.action = action;
|
||||
|
@ -22,6 +22,7 @@ import com.haulmont.cuba.web.toolkit.ui.CubaButton;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.Objects;
|
||||
|
||||
public class WebButton extends WebAbstractComponent<CubaButton> implements Button {
|
||||
|
||||
@ -63,6 +64,15 @@ public class WebButton extends WebAbstractComponent<CubaButton> implements Butto
|
||||
if (this.action != null) {
|
||||
this.action.removeOwner(this);
|
||||
this.action.removePropertyChangeListener(actionPropertyChangeListener);
|
||||
if (Objects.equals(this.action.getCaption(), getCaption())) {
|
||||
setCaption(null);
|
||||
}
|
||||
if (Objects.equals(this.action.getDescription(), getDescription())) {
|
||||
setDescription(null);
|
||||
}
|
||||
if (Objects.equals(this.action.getIcon(), getIcon())) {
|
||||
setIcon(null);
|
||||
}
|
||||
}
|
||||
|
||||
this.action = action;
|
||||
|
Loading…
Reference in New Issue
Block a user