Skip to content

Commit

Permalink
Remove popup panel callback APIs from command button
Browse files Browse the repository at this point in the history
For #447
  • Loading branch information
kirill-grouchnikov committed Jun 16, 2023
1 parent 4620054 commit 792ed8d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
package org.pushingpixels.radiance.component.api.common;

import org.pushingpixels.radiance.component.api.common.model.*;
import org.pushingpixels.radiance.component.api.common.popup.PopupPanelCallback;
import org.pushingpixels.radiance.component.api.common.popup.model.BaseCommandPopupMenuPresentationModel;

import java.awt.*;
Expand Down Expand Up @@ -165,7 +164,6 @@ class CommandButtonLayoutInfo {
* The popup area. A mouse click in this area will show the popup content
* associated with the command button.
*
* @see JCommandButton#setPopupCallback(PopupPanelCallback)
* @see Command.Builder#setSecondaryContentModel(CommandMenuContentModel)
* @see CommandButtonPresentationModel.Builder#setPopupMenuPresentationModel(BaseCommandPopupMenuPresentationModel)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
package org.pushingpixels.radiance.component.api.common;

import org.pushingpixels.radiance.component.api.common.model.*;
import org.pushingpixels.radiance.component.api.common.popup.PopupPanelCallback;
import org.pushingpixels.radiance.component.api.common.popup.PopupPanelManager;
import org.pushingpixels.radiance.component.api.common.popup.model.BaseCommandPopupMenuPresentationModel;
import org.pushingpixels.radiance.component.api.common.projection.BaseCommandButtonProjection;
Expand Down Expand Up @@ -94,14 +93,6 @@ public class JCommandButton extends JComponent implements RichTooltipManager.Wit
*/
private ActionHandler actionHandler;

/**
* Associated popup callback. May be <code>null</code>.
*
* @see #setPopupCallback(PopupPanelCallback)
* @see #getPopupCallback()
*/
private PopupPanelCallback popupCallback;

/**
* Popup model of this button.
*
Expand Down Expand Up @@ -262,15 +253,6 @@ public JCommandButton(BaseCommandButtonProjection<? extends BaseCommand<?>,
popupButtonModel.setEnabled(command.isSecondaryEnabled());
this.setPopupModel(popupButtonModel);

boolean hasPopup = (command.getSecondaryContentModel() != null);

if (hasPopup) {
if (command.getSecondaryContentModel() != null) {
this.setPopupCallback(commandButton ->
projection.getPopupMenuPanelProjection().buildComponent());
}
}

this.getActionModel().setFireActionOnPress(commandPresentation.getActionFireTrigger() ==
CommandButtonPresentationModel.ActionFireTrigger.ON_PRESSED);

Expand Down Expand Up @@ -539,26 +521,6 @@ public String getUIClassID() {
return uiClassID;
}

/**
* Returns the associated popup callback.
*
* @return The associated popup callback.
* @see #setPopupCallback(PopupPanelCallback)
*/
public PopupPanelCallback getPopupCallback() {
return this.popupCallback;
}

/**
* Sets new popup callback for <code>this</code> button.
*
* @param popupCallback New popup callback for <code>this</code> button.
* @see #getPopupCallback()
*/
public void setPopupCallback(PopupPanelCallback popupCallback) {
this.popupCallback = popupCallback;
}

/**
* Returns the popup model of this button.
*
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.pushingpixels.radiance.component.api.common.model.PopupButtonModel;
import org.pushingpixels.radiance.component.api.common.popup.JCommandPopupMenuPanel;
import org.pushingpixels.radiance.component.api.common.popup.JPopupPanel;
import org.pushingpixels.radiance.component.api.common.popup.PopupPanelCallback;
import org.pushingpixels.radiance.component.api.common.popup.PopupPanelManager;
import org.pushingpixels.radiance.theming.api.RadianceThemingCortex;
import org.pushingpixels.radiance.theming.api.RadianceThemingSlices;
Expand Down Expand Up @@ -622,13 +621,11 @@ public void processPopupAction() {
}

// check if the command button has an associated popup panel
PopupPanelCallback popupCallback = this.commandButton.getPopupCallback();
final JPopupPanel popupPanel =
(popupCallback != null) ? popupCallback.getPopupPanel(this.commandButton) : null;
final JPopupPanel popupPanel = this.commandButton.getProjection().getPopupMenuPanelProjection().buildComponent();
if (popupPanel != null) {
popupPanel.applyComponentOrientation(this.commandButton.getComponentOrientation());
SwingUtilities.invokeLater(() -> {
if ((commandButton == null) || (popupPanel == null)) {
if (commandButton == null) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ private KeyTipLink getRibbonComponentLink(final JRibbonComponent rc) {
}

private KeyTipLink getCommandButtonPopupLink(final JCommandButton cb) {
if (((cb.getPopupCallback() != null) || cb.getContentModel().hasSecondaryContent()) &&
if (cb.getContentModel().hasSecondaryContent() &&
(cb.getPresentationModel().getPopupKeyTip() != null)) {
final KeyTipLink link = new KeyTipLink();
link.comp = cb;
Expand Down

0 comments on commit 792ed8d

Please sign in to comment.