Skip to content

Commit

Permalink
Refactoring an internal client property
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-grouchnikov committed Jun 2, 2023
1 parent a2b8dcd commit e6483a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public JCommandButton(BaseCommandButtonProjection<? extends BaseCommand<?>,
}

if (!commandPresentation.isToDismissPopupsOnActivation()) {
this.putClientProperty(BasicCommandButtonUI.DONT_DISPOSE_POPUPS, Boolean.TRUE);
this.putClientProperty(BasicCommandButtonUI.DO_NOT_DISPOSE_POPUPS, Boolean.TRUE);
}

this.setPresentationState(commandPresentation.getPresentationState());
Expand Down Expand Up @@ -377,7 +377,8 @@ public JCommandButton(BaseCommandButtonProjection<? extends BaseCommand<?>,
}

if (hasAction && hasPopup) {
this.setCommandButtonKind(commandPresentation.getTextClick() == BaseCommandButtonPresentationModel.TextClick.ACTION
this.setCommandButtonKind((commandPresentation.getTextClick() ==
BaseCommandButtonPresentationModel.TextClick.ACTION)
? JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION
: JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_POPUP);
} else if (hasPopup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ public abstract class BasicCommandButtonUI extends CommandButtonUI {
*
* @see #disposePopupsActionListener
*/
public static final String DONT_DISPOSE_POPUPS =
"radiance.component.internal.commandButton.ui.dontDisposePopups";
public static final String DO_NOT_DISPOSE_POPUPS =
"radiance.component.internal.commandButton.ui.doNotDisposePopups";

/**
* This listener disposes all popup panels when button's action is activated. An example of
* scenario would be a command button in the popup panel of an in-ribbon gallery. When this
* command button is activated, the associated popup panel is dismissed.
*
* @see #DONT_DISPOSE_POPUPS
* @see #DO_NOT_DISPOSE_POPUPS
*/
private CommandAction disposePopupsActionListener;

Expand Down Expand Up @@ -400,7 +400,7 @@ protected void installListeners() {

this.disposePopupsActionListener = commandActionEvent -> {
boolean toDismiss = !Boolean.TRUE
.equals(commandButton.getClientProperty(DONT_DISPOSE_POPUPS));
.equals(commandButton.getClientProperty(DO_NOT_DISPOSE_POPUPS));
if (toDismiss) {
JCommandPopupMenuPanel menuPanel = (JCommandPopupMenuPanel) SwingUtilities
.getAncestorOfClass(JCommandPopupMenuPanel.class, commandButton);
Expand Down

0 comments on commit e6483a1

Please sign in to comment.