⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 icombostrategy.java

📁 利用它可以做出非常漂亮的swt界面,包含的组件有PShelf Plist
💻 JAVA
字号:
package com.swtplus.widgets.combo;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;

import com.swtplus.widgets.PCombo;

/**
 * An IComboStrategy determines the contents of a PCombo drop down
 * and the PCombo itself.
 */
public interface IComboStrategy {
	
	/**
	 * Returns the size of the drop down.
	 * @param comboWidth the width of the PCombo
	 * @return the size of the drop down
	 */
	public Point getSize(int comboWidth);
	
	/**
	 * Creates the contents of the drop down.  The IComboUpdater is 
	 * used to callback and set the selected value into the PCombo.
	 * 
	 * @param parent parent Composite
	 * @param updater callback to PCombo
	 * @return the main Control in the drop down
	 */
	public Control createContents(Composite parent,final IComboUpdater updater);	

	/**
	 * Moves the drop down's selection up one item in response
	 * to a user's up arrow key on the parent PCombo.  Implementers
	 * should both move the selection in the drop down and set the 
	 * new value through the IComboUpdater.
	 * 
	 * @param updater callback to PCombo
	 */
	public void keyUp(IComboUpdater updater);
	
	/**
	 * Moves the drop down's selection down one item in response
	 * to a user's down arrow key on the parent PCombo.  Implementers
	 * should both move the selection in the drop down and set the 
	 * new value through the IComboUpdater.
	 * 
	 * @param updater callback to PCombo
	 */
	public void keyDown(IComboUpdater updater);
	
	/**
	 * Selects the passed in value within the drop down.  This method
	 * is called to keep the value of the PCombo in sync with the value
	 * shown as the selected item in the drop down.
	 * 
	 * @param newValue PCombo's value object
	 */
	public void selectValue(Object newValue);
	
	/**
	 * This a special method used to determine whether focus can be 
	 * immediately returned to the PCombo when a mouse down event is 
	 * triggered on the drop down.  This is all in an effort to minimize
	 * the distracting focus changing that occurs.  Whether this eases
	 * the focus changing or not is dependent on the base SWT control 
	 * used within the drop down.
	 * 
	 * @return true to return focus on mouse down
	 */
	public boolean canReturnFocusOnMouseDown(); 
	
	/**
	 * Scrolls the drop down in response to the mouse wheel.
	 * @param linesToScroll how many lines to scroll 
	 */
	public void mouseWheel(int linesToScroll);
	
	/**
	 * Dispose this strategy.
	 */
	public void dispose();
	
	/**
	 * Returns the label provider which determines how the value object
	 * is displayed within the PCombo.
	 * 
	 * @return the label provider
	 */
	public IComboLabelProvider createLabelProvider();

	/**
	 * Scrolls the drop down in response to a user key event, 
	 * scrolling the list to the first entry that begins with the
	 * String given.
	 * 
	 * @param beginning typed text
	 */
	public void jumpTo(String beginning);
	
	/**
	 * Provides any necessary initialization of the Text editor.
	 * 
	 * @param editor Text widget used as an editor.
	 */
	public void initializeEditor(Text editor);
	
	/**
	 * Provides any necessary initialization.
	 * 
	 * @param pCombo PCombo parent of this strategy
	 */
	public void initialize(PCombo pCombo);
	
    /**
     * Verifies that an object set as the value of the parent PCombo is 
     * appropriate for this strategy.  
     * <p>
     * For example, the TreeComboStrategy only allows Strings and TreeItems.
     * Example code might look like:
     * <p>
     * <code>
     * Assert.isTrue(newValue instanceof TreeItem || newValue instanceof String);<BR>
     * </code>
     * 
     * @param newValue value to verify
     */
    public void checkValue(Object newValue);
    
    public boolean isLazyCreation();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -