本文整理汇总了Java中ca.odell.glazedlists.swing.AutoCompleteSupport.install方法的典型用法代码示例。如果您正苦于以下问题:Java AutoCompleteSupport.install方法的具体用法?Java AutoCompleteSupport.install怎么用?Java AutoCompleteSupport.install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.odell.glazedlists.swing.AutoCompleteSupport
的用法示例。
在下文中一共展示了AutoCompleteSupport.install方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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())
)
);
}
示例3: 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())
)
);
}
示例4: 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())
)
);
}
示例5: 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());
}
}
示例6: init
import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入方法依赖的package包/类
private void init() {
setEditable(true);
this.autoCompleteSupport = AutoCompleteSupport.install(this, items);
}
示例7: 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;
}