当前位置: 首页>>代码示例>>Java>>正文


Java AutoCompleteSupport类代码示例

本文整理汇总了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() {
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:DesktopLookupFieldTest.java

示例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;
}
 
开发者ID:IARC-CSU,项目名称:CanReg5,代码行数:20,代码来源:DictionaryVariableEditorPanel.java

示例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;
}
 
开发者ID:IARC-CSU,项目名称:CanReg5,代码行数:35,代码来源:DictionaryVariableEditorPanel.java

示例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())
			)
	);
}
 
开发者ID:GoldenGnu,项目名称:jeveassets,代码行数:41,代码来源:FilterSave.java

示例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);
            }
        }
    });
}
 
开发者ID:sapo,项目名称:sscan,代码行数:35,代码来源:Tab.java

示例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())
			)
	);
}
 
开发者ID:GoldenGnu,项目名称:jeveassets,代码行数:49,代码来源:JAutoCompleteDialog.java

示例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())
			)
	);
}
 
开发者ID:GoldenGnu,项目名称:jeveassets,代码行数:74,代码来源:StockpileItemDialog.java

示例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());
	}
}
 
开发者ID:GoldenGnu,项目名称:jeveassets,代码行数:65,代码来源:StockpileDialog.java

示例9: init

import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
private void init() {
  setEditable(true);
  this.autoCompleteSupport = AutoCompleteSupport.install(this, items);
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:5,代码来源:AutocompleteComboBox.java

示例10: getAutoCompleteSupport

import ca.odell.glazedlists.swing.AutoCompleteSupport; //导入依赖的package包/类
public AutoCompleteSupport<E> getAutoCompleteSupport() {
  return autoCompleteSupport;
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:4,代码来源:AutocompleteComboBox.java

示例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;
}
 
开发者ID:laccore,项目名称:coretools,代码行数:52,代码来源:SchemeEntryWidget.java


注:本文中的ca.odell.glazedlists.swing.AutoCompleteSupport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。