/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import javax.accessibility.*;
// Inspired by MetalComboBoxUI, which also has a combined text-and-arrow button for noneditables
return new AquaComboBoxUI();
}
private boolean wasOpaque;
super.installUI(c);
// this doesn't work right now, because the JComboBox.init() method calls
// .setOpaque(false) directly, and doesn't allow the LaF to decided. Bad Sun!
c.setOpaque(false);
}
super.uninstallUI(c);
}
protected void installListeners() {
super.installListeners();
}
protected void uninstallListeners() {
super.uninstallListeners();
}
protected void installComponents() {
super.installComponents();
// client properties must be applied after the components have been installed,
// because isSquare and isPopdown are applied to the installed button
}
protected void uninstallComponents() {
super.uninstallComponents();
}
return new ItemListener() {
long lastBlink = 0L;
public void itemStateChanged(final ItemEvent e) {
// sometimes, multiple selection changes can occur while the popup is up,
// and blinking more than "once" (in a second) is not desirable
if (!(listUI instanceof AquaListUI)) return;
public void paintSelected(final boolean selected) {
}
});
}
};
}
// this space intentionally left blank
}
return new AquaComboBoxRenderer(comboBox);
}
return new AquaComboBoxPopup(comboBox);
}
}
return new AquaComboBoxEditor();
}
implements UIResource, DocumentListener {
super();
editor = new AquaCustomComboTextField();
editor.addFocusListener(this);
}
if (arrowButton != null) {
}
}
if (arrowButton != null) {
}
}
}
}
}
private void editorTextChanged() {
for (int i = 0; i < items; i++) {
return;
}
}
}
public AquaCustomComboTextField() {
public void actionPerformed(final ActionEvent e) {
if (editor instanceof AquaCustomComboTextField) {
}
} else {
}
}
});
}
// workaround for 4530952
return;
}
super.setText(s);
}
}
/**
* This listener hides the popup when the focus is lost. It also repaints
* when focus is gained or lost.
*
* This override is necessary because the Basic L&F for the combo box is working
* around a Solaris-only bug that we don't have on Mac OS X. So, remove the lightweight
* popup check here. rdar://Problem/3518582
*/
return new BasicComboBoxUI.FocusHandler() {
public void focusLost(final FocusEvent e) {
hasFocus = false;
if (!e.isTemporary()) {
setPopupVisible(comboBox, false);
}
// Notify assistive technologies that the combo box lost focus
}
}
};
}
protected void installKeyboardActions() {
super.installKeyboardActions();
}
if (comboBox.isPopupVisible()) {
} else {
comboBox.setPopupVisible(true);
}
}
}
/**
* Hilight _but do not select_ the next item in the list.
*/
}
}
};
/**
* Hilight _but do not select_ the previous item in the list.
*/
if (si > 0) {
}
}
};
}
};
}
};
return;
}
}
};
return;
}
}
};
// For <rdar://problem/3759984> Java 1.4.2_5: Serializing Swing components not working
// Inner classes were using a this reference and then trying to serialize the AquaComboBoxUI
// We shouldn't do that. But we need to be able to get the popup from other classes, so we need
// a public accessor.
return popup;
}
return new AquaComboBoxLayoutManager();
}
arrowButton.setBounds(insets.left, insets.top, width - (insets.left + insets.right), height - (insets.top + insets.bottom));
return;
}
final int buttonWidth = 20;
if (arrowButton != null) {
}
}
}
}
// This is here because Sun can't use protected like they should!
}
return c.isEditable() || Boolean.TRUE.equals(c.getClientProperty(AquaComboBoxUI.POPDOWN_CLIENT_PROPERTY_KEY));
}
comboBox.setPopupVisible(false);
}
if (isTableCellEditor(comboBox)) {
// Forces the selection of the list item if the combo box is in a JTable
return;
}
if (comboBox.isPopupVisible()) {
comboBox.setPopupVisible(false);
return;
}
// Call the default button binding.
// This is a pretty messy way of passing an event through to the root pane
action.actionPerformed(new ActionEvent(root, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers()));
}
// This is somewhat messy. The difference here from BasicComboBoxUI.EnterAction is that
// arrow up or down does not automatically select the
public void actionPerformed(final ActionEvent e) {
}
};
public void actionPerformed(final ActionEvent e) {
if (comboBox.isEditable()) return;
if (comboBox.isPopupVisible()) {
comboBox.setPopupVisible(false);
return;
}
comboBox.setPopupVisible(true);
}
};
if (arrowButton == null) return;
if (!(border instanceof AquaButtonBorder)) return;
}
if (!isMinimumSizeDirty) {
return new Dimension(cachedMinimumSize);
}
// Insets insets = comboBox.getInsets();
size = getDisplaySize();
// Min height = Height of arrow button plus 2 pixels fuzz above plus 2 below. 23 + 2 + 2
size = super.getMinimumSize(c);
} else {
size = super.getMinimumSize(c);
}
}
isMinimumSizeDirty = false;
return new Dimension(cachedMinimumSize);
}
@SuppressWarnings("unchecked")
static final RecyclableSingleton<ClientPropertyApplicator<JComboBox, AquaComboBoxUI>> APPLICATOR = new RecyclableSingleton<ClientPropertyApplicator<JComboBox, AquaComboBoxUI>>() {
}
}
},
}
},
}
},
}
},
}
},
}
}
) {
return null;
}
};
}
};
return APPLICATOR.get();
}
}