Dengues Studio: Google Group:http://groups.google.com/group/dengues; QQ Group:24885404.
关于如何配置GEF中的Palette

参考Dengues源代码: org.dengues.designer.ui.process.editors.GEFComponentsEditor。在一个Editor里面重写getPaletteRoot()方法。可以返回一个PaletteRoot。但是要配置Palette就要覆盖 getPalettePreferences();返回一个FlyoutPreferences主要需要三个参数:
public int getDockLocation() {
return getPreferenceStore().getInt(IDenguesPrefsConstant.PALETTE_DOCK_LOCATION);
}

public int getPaletteState() {
return getPreferenceStore().getInt(IDenguesPrefsConstant.PALETTE_STATE);
}

public int getPaletteWidth() {
return getPreferenceStore().getInt(IDenguesPrefsConstant.PALETTE_SIZE);
}
这三个参数的值范围:
getDockLocation()的参数有:
1.PositionConstants.EAST表示Palette在右边或说东边,这个是默认值。
2.PositionConstants.WEST表示Palette在左边或说西边。
getPaletteState()的参数有:
1.FlyoutPaletteComposite.STATE_COLLAPSED表示Palette会用完后自动收缩,还可以放大缩小。为默认值。
2.FlyoutPaletteComposite.STATE_PINNED_OPEN表示Palette会无法收缩和放大缩小。
getPaletteWidth()的参数范围是:FlyoutPaletteComposite.MAX_PALETTE_SIZE=500;
FlyoutPaletteComposite.MIN_PALETTE_SIZE=20;
FlyoutPaletteComposite.DEFAULT_PALETTE_SIZE=125;
可以参考代码:
CompEditorPaletteFactory.createPalettePreferences();



Dengues论坛(http://groups.google.com/group/dengues/),一个很好的Eclipse开发者乐园.

Feedback

# re: [Dengues] 关于如何配置GEF中的Palette  回复  更多评论   

2007-10-26 10:46 by 小张飞刀
不错,顶顶先~

# re: [Dengues] 关于如何配置GEF中的Palette[未登录]  回复  更多评论   

2007-10-26 11:02 by yy
期待文档阿....~~~~

# re: [Dengues] 关于如何配置GEF中的Palette  回复  更多评论   

2007-10-26 11:24 by 小张飞刀(Dengues Studio)
补充一下其实说白了,在Graphical Editor的getPalettePreference方法里返回一个FlyoutPreferences对象就可以了,它是一个写在FlyoutPaletteComposite里的接口,源代码如下:


/**
* FlyoutPreferences is used to save/load the preferences for the flyout palette.
*
* @author Pratik Shah
* @since 3.0
*/
public interface FlyoutPreferences {
/**
* Should return {@link PositionConstants#EAST} or {@link PositionConstants#WEST}.
* Any other int will be ignored and the default dock location (EAST) will be
* used instead.
* @return the saved dock location of the Palette
*/
int getDockLocation();
/**
* When there is no saved state, this method can return any non-positive int (which
* will result in the palette using the default state -- collapsed), or
* {@link FlyoutPaletteComposite#STATE_COLLAPSED}, or
* {@link FlyoutPaletteComposite#STATE_PINNED_OPEN}
* @return the saved state of the palette
*/
int getPaletteState();
/**
* When there is no saved width, this method can return any int (preferrably a
* non-positive int). Returning a non-positive int will cause the palette to be
* sized to the default size, whereas returning a postive int will find the
* closest match in the valid range (>= minimum and <= maximum)
* @return the saved width of the flyout palette
*/
int getPaletteWidth();
/**
* This method is invoked when the flyout palette's dock location is changed. The
* provided dock location should be persisted and returned in
* {@link #getDockLocation()}.
* @param location {@link PositionConstants#EAST} or {@link PositionConstants#WEST}
*/
void setDockLocation(int location);
/**
* This method is invoked when the flyout palette's state is changed (the new state
* becomes the default). The provided state should be persisted and returned in
* {@link #getPaletteState()}.
* @param state {@link FlyoutPaletteComposite#STATE_COLLAPSED} or
* {@link FlyoutPaletteComposite#STATE_PINNED_OPEN}
*/
void setPaletteState(int state);
/**
* This method is invoked when the flyout palette is resized. The provided width
* should be persisted and returned in {@link #getPaletteWidth()}.
* @param width the new size of the flyout palette
*/
void setPaletteWidth(int width);
}


只有注册用户登录后才能发表评论。


网站导航:
 
Dengues Studio: Google Group:http://groups.google.com/group/dengues; QQ Group:24885404.