本文整理汇总了Java中ca.odell.glazedlists.swing.AutoCompleteSupport类的典型用法代码示例。如果您正苦于以下问题:Java AutoCompleteSupport类的具体用法?Java AutoCompleteSupport怎么用?Java AutoCompleteSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutoCompleteSupport类属于ca.odell.glazedlists.swing包,在下文中一共展示了AutoCompleteSupport类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initExpectations
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
@Override
protected void initExpectations() {
super.initExpectations();
new NonStrictExpectations() {
{
globalConfig.getAvailableLocales(); result = ImmutableMap.of("en", Locale.ENGLISH);
AppContext.getProperty("cuba.mainMessagePack"); result = "com.haulmont.cuba.desktop";
}
};
new MockUp<AutoCompleteSupport>() {
@SuppressWarnings("UnusedDeclaration")
@Mock
public void checkAccessThread() {
}
};
}
示例2: setComboModel
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
/**
* GlazedList's comboBox autocompletion and autofiltering.
* @param combo
* @param values
*/
private AutoCompleteSupport<DictionaryEntry> setComboModel(AutoCompleteSupport<DictionaryEntry> compSup,
JComboBox combo,
List<DictionaryEntry> values) {
EventList<DictionaryEntry> possibleValuesEventList = new BasicEventList<DictionaryEntry>(values);
if (compSup != null) {
if(compSup.isInstalled())
compSup.uninstall();
//gc should clean it
compSup = null;
}
compSup = AutoCompleteSupport.install(combo, possibleValuesEventList, new DictionaryElementTextFilterator());
compSup.setFilterMode(TextMatcherEditor.CONTAINS);
return compSup;
}
示例3: changeComboListSorting
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
/**
* Changes the sorting (sort by code or sort by description) of a comboBox
* list.
* @param compSup
* @param combo
* @param sortByCode
* @return
*/
private AutoCompleteSupport<DictionaryEntry> changeComboListSorting(AutoCompleteSupport<DictionaryEntry> compSup,
JComboBox<DictionaryEntry> combo,
boolean sortByCode) {
//We need to setup the new comboBox values. We traverse the current combo
//list because it could be already filtered by a specific category
DictionaryEntry selectedDescEntry = (DictionaryEntry) combo.getSelectedItem();
//List<DictionaryEntry> newValuesList = new LinkedList<DictionaryEntry>() {};
for(int i = 0; i < combo.getItemCount(); i++) {
DictionaryEntry entry = compSup.getItemList().get(i);
if (sortByCode)
entry.setSortByCode();
else
entry.setSortByDescription();
}
if (combo.isPopupVisible()) {
combo.hidePopup();
combo.revalidate();
combo.repaint();
combo.showPopup();
} else {
combo.revalidate();
combo.repaint();
}
combo.setSelectedItem(selectedDescEntry);
return compSup;
}
示例4: FilterSave
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
public FilterSave(final Window window) {
super(null, GuiShared.get().saveFilter(), window);
ListenerClass listener = new ListenerClass();
JLabel jText = new JLabel(GuiShared.get().enterFilterName());
jName = new JComboBox<String>();
JCopyPopup.install((JTextComponent) jName.getEditor().getEditorComponent());
filters = new EventListManager<String>().create();
AutoCompleteSupport.install(jName, EventModels.createSwingThreadProxyList(filters), new Filterator());
jSave = new JButton(GuiShared.get().save());
jSave.setActionCommand(FilterSaveAction.SAVE.name());
jSave.addActionListener(listener);
JButton jCancel = new JButton(GuiShared.get().cancel());
jCancel.setActionCommand(FilterSaveAction.CANCEL.name());
jCancel.addActionListener(listener);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(jText)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(jName, 220, 220, 220)
.addGroup(layout.createSequentialGroup()
.addComponent(jSave, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
.addComponent(jCancel, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
)
)
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addComponent(jText, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jName, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addGroup(layout.createParallelGroup()
.addComponent(jSave, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jCancel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
)
);
}
示例5: addMenuTab
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
public void addMenuTab() {
// create our UI
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
issueUrlButton.setVisible(false);
urlButtonListener = new UrlButtonListener();
issueUrlButton.addActionListener(urlButtonListener);
// tabs with request/response viewers
requestViewer = iburp.createMessageEditor(Tab.this, true);
responseViewer = iburp.createMessageEditor(Tab.this, true);
requestResponsePane.addTab("Request", requestViewer.getComponent());
requestResponsePane.addTab("Response", responseViewer.getComponent());
iburp.customizeUiComponent(Tab.this);
// add the custom tab to Burp's UI
iburp.addSuiteTab(Tab.this);
// this enables auto complete. It must be here (at the Swing Event Dispatch Thread)
projectComboBox.setFocusable(true);
try {
projectAutoComplete = AutoCompleteSupport.install(projectComboBox, GlazedLists.eventListOf(db.getProjects()));
projectAutoComplete.setFilterMode(TextMatcherEditor.CONTAINS);
} catch (IOException ex) {
log.err(ex);
}
}
});
}
示例6: JAutoCompleteDialog
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
public JAutoCompleteDialog(Program program, String title, Image image, String msg, boolean strict, boolean allowOverwrite) {
super(program, title, image);
this.strict = strict;
this.allowOverwrite = allowOverwrite;
ListenerClass listener = new ListenerClass();
JLabel jText = new JLabel(msg);
jItems = new JComboBox<T>();
eventList = new EventListManager<T>().create();
eventList.getReadWriteLock().readLock().lock();
SortedList<T> sortedList = new SortedList<T>(eventList, getComparator());
eventList.getReadWriteLock().readLock().unlock();
autoComplete = AutoCompleteSupport.install(jItems, EventModels.createSwingThreadProxyList(sortedList), getFilterator());
jOK = new JButton(GuiShared.get().ok());
jOK.setActionCommand(AutoCompleteAction.OK.name());
jOK.addActionListener(listener);
JButton jCancel = new JButton(GuiShared.get().cancel());
jCancel.setActionCommand(AutoCompleteAction.CANCEL.name());
jCancel.addActionListener(listener);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(jText)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(jItems, 220, 220, 220)
.addGroup(layout.createSequentialGroup()
.addComponent(jOK, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
.addComponent(jCancel, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
)
)
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addComponent(jText, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jItems, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addGroup(layout.createParallelGroup()
.addComponent(jOK, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jCancel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
)
);
}
示例7: StockpileItemDialog
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
public StockpileItemDialog(final Program program) {
super(program, TabsStockpile.get().addStockpileItem(), Images.TOOL_STOCKPILE.getImage());
ListenerClass listener = new ListenerClass();
JLabel jItemsLabel = new JLabel(TabsStockpile.get().item());
jItems = new JComboBox<Item>();
AutoCompleteSupport<Item> itemAutoComplete = AutoCompleteSupport.install(jItems, EventModels.createSwingThreadProxyList(items), new ItemFilterator());
itemAutoComplete.setStrict(true);
itemAutoComplete.setCorrectsCase(true);
jItems.addItemListener(listener); //Must be added after AutoCompleteSupport
JLabel jCountMinimumLabel = new JLabel(TabsStockpile.get().countMinimum());
jCountMinimum = new JTextField();
jCountMinimum.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(final FocusEvent e) {
jCountMinimum.selectAll();
}
});
jCountMinimum.addCaretListener(listener);
jCopy = new JCheckBox(TabsStockpile.get().copy());
jCopy.setActionCommand(StockpileItemAction.COPY.name());
jCopy.addActionListener(listener);
jOK = new JButton(TabsStockpile.get().ok());
jOK.setActionCommand(StockpileItemAction.OK.name());
jOK.addActionListener(listener);
jOK.setEnabled(false);
jCancel = new JButton(TabsStockpile.get().cancel());
jCancel.setActionCommand(StockpileItemAction.CANCEL.name());
jCancel.addActionListener(listener);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(jItemsLabel)
.addComponent(jCountMinimumLabel)
)
.addGroup(layout.createParallelGroup()
.addComponent(jItems, 300, 300, 300)
.addGroup(layout.createSequentialGroup()
.addComponent(jCountMinimum, 100, 100, Short.MAX_VALUE)
.addComponent(jCopy)
)
)
)
.addGroup(layout.createSequentialGroup()
.addComponent(jOK, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
.addComponent(jCancel, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
)
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(jItemsLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jItems, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
)
.addGroup(layout.createParallelGroup()
.addComponent(jCountMinimumLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jCountMinimum, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jCopy, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
)
.addGroup(layout.createParallelGroup()
.addComponent(jOK, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
.addComponent(jCancel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
)
);
}
示例8: setLocationType
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
private void setLocationType(LocationType locationType) {
this.locationType = locationType;
if (locationType == LocationType.STATION) {
jLocationType.setIcon(Images.LOC_STATION.getIcon());
jLocationType.setToolTipText(TabsStockpile.get().station());
jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().station()));
try {
stations.getReadWriteLock().readLock().lock();
filterList = new FilterList<MyLocation>(stations);
} finally {
stations.getReadWriteLock().readLock().unlock();
}
jStation.setSelected(true);
} else if (locationType == LocationType.SYSTEM) {
jLocationType.setIcon(Images.LOC_SYSTEM.getIcon());
jLocationType.setToolTipText(TabsStockpile.get().system());
jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().system()));
try {
systems.getReadWriteLock().readLock().lock();
filterList = new FilterList<MyLocation>(systems);
} finally {
systems.getReadWriteLock().readLock().unlock();
}
jSystem.setSelected(true);
} else if (locationType == LocationType.REGION) {
jLocationType.setIcon(Images.LOC_REGION.getIcon());
jLocationType.setToolTipText(TabsStockpile.get().region());
jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().region()));
try {
regions.getReadWriteLock().readLock().lock();
filterList = new FilterList<MyLocation>(regions);
} finally {
regions.getReadWriteLock().readLock().unlock();
}
jRegion.setSelected(true);
} else {
jLocationType.setIcon(Images.LOC_LOCATIONS.getIcon());
jLocationType.setToolTipText(TabsStockpile.get().universe());
jPanel.setBorder(BorderFactory.createTitledBorder(TabsStockpile.get().universe()));
EventList<MyLocation> eventList = new EventListManager<MyLocation>().create();
try {
eventList.getReadWriteLock().readLock().lock();
filterList = new FilterList<MyLocation>(eventList);
} finally {
eventList.getReadWriteLock().readLock().unlock();
}
jUniverse.setSelected(true);
}
if (autoComplete != null) { //Remove old
jLocation.removeItemListener(listener);
autoComplete.uninstall();
autoComplete = null;
}
if (locationType != LocationType.UNIVERSE) {
jLocation.setEnabled(true);
autoComplete = AutoCompleteSupport.install(jLocation, EventModels.createSwingThreadProxyList(filterList), new LocationsFilterator());
autoComplete.setStrict(true);
autoComplete.setCorrectsCase(true);
jLocation.addItemListener(listener); //Must be added after AutoCompleteSupport
} else {
jLocation.setEnabled(false);
jLocation.getModel().setSelectedItem(TabsStockpile.get().universe());
}
}
示例9: init
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
private void init() {
setEditable(true);
this.autoCompleteSupport = AutoCompleteSupport.install(this, items);
}
示例10: getAutoCompleteSupport
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
public AutoCompleteSupport<E> getAutoCompleteSupport() {
return autoCompleteSupport;
}
示例11: getEditableUI
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
@Override
protected Object getEditableUI() {
if (panel == null) {
if (!required) {
entries.add(NONE);
}
// get our list of entries
String type = property.getWidgetProperties().get("schemeType");
for (Scheme s : schemes.getSchemes()) {
if ((type == null) || type.equalsIgnoreCase(s.getType())) {
entries.addAll(s.getEntries());
}
}
// sort alphabetically
Collections.sort(entries, new Comparator<SchemeEntry>() {
public int compare(final SchemeEntry o1, final SchemeEntry o2) {
return o1.getName().compareTo(o2.getName());
}
});
// build our icon label
icon = new JLabel();
// build our combobox with auto complete support
combo = new JComboBox(entries.toArray());
TextFilterator<SchemeEntry> filterator = GlazedLists.textFilterator(new String[] { "name", "code" });
AutoCompleteSupport<SchemeEntry> autocomplete = AutoCompleteSupport.install(combo, GlazedLists
.eventList(entries), filterator, new EntryFormat());
autocomplete.setStrict(true);
SchemeEntry e = getEntry(property.getValue());
if (e == null && required) {
e = entries.get(0);
}
if (e == null) {
combo.setSelectedItem(NONE);
icon.setIcon(null);
} else {
combo.setSelectedItem(e);
icon.setIcon(e.getIcon());
}
combo.setRenderer(new EntryRenderer());
combo.addActionListener(this);
combo.setBorder(BorderFactory.createEmptyBorder());
panel = new JPanel(new BorderLayout());
panel.add(icon, BorderLayout.WEST);
panel.add(combo, BorderLayout.CENTER);
}
return panel;
}