下面列出了org.eclipse.swt.widgets.Combo#setToolTipText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static void selectProjectInList( String name ) {
GuiToolbarWidgets toolbarWidgets = HopGui.getInstance().getMainToolbarWidgets();
toolbarWidgets.selectComboItem( ID_TOOLBAR_PROJECT_COMBO, name );
Combo combo = getProjectsCombo();
if ( combo != null ) {
ProjectsConfig config = ProjectsConfigSingleton.getConfig();
ProjectConfig projectConfig = config.findProjectConfig( name );
if ( projectConfig != null ) {
String projectHome = projectConfig.getProjectHome();
if ( StringUtils.isNotEmpty( projectHome ) ) {
combo.setToolTipText( "Project " + name + " in '" + projectHome + "' configured in '" + projectConfig.getConfigFilename() + "'" );
}
}
}
}
/**
* Creates the additional controls of the page.
* @param parent parent component
*/
private void addInverseChooser(Composite parent) {
Label label = new Label(parent, SWT.LEFT);
label.setText(TexlipsePlugin.getResourceString("preferenceViewerInverseLabel"));
label.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip"));
label.setLayoutData(new GridData());
String[] list = new String[] {
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchNo"),
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchRun"),
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchStd")
};
// find out which option to choose by default
int index = inverseSearchValues.length - 1;
for (; index > 0 && !inverseSearchValues[index].equals(registry.getInverse()); index--) {}
inverseChooser = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
inverseChooser.setLayoutData(new GridData());
inverseChooser.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip"));
inverseChooser.setItems(list);
inverseChooser.select(index);
}
private void createTextDirectionField( BidiFormat bidiFormat,
Group externalBiDiFormatFrame, GridData innerFrameGridData,
boolean isMetadataSetting )
{
Label textDirectionLabel = new Label( externalBiDiFormatFrame, SWT.NONE );
textDirectionLabel.setText( isMetadataSetting
? BidiConstants.TEXT_DIRECTION_TITLE_METADATA
: BidiConstants.TEXT_DIRECTION_TITLE_CONTENT );
textDirectionLabel.setLayoutData( innerFrameGridData );
textDirectionCombo = new Combo( externalBiDiFormatFrame, SWT.DROP_DOWN
| SWT.READ_ONLY );
textDirectionCombo.setToolTipText( BidiConstants.TEXT_DIRECTION_TOOLTIP );
textDirectionCombo.add( BidiConstants.TEXT_DIRECTION_LTR,
BidiConstants.TEXT_DIRECTION_LTR_INDX );
textDirectionCombo.add( BidiConstants.TEXT_DIRECTION_RTL,
BidiConstants.TEXT_DIRECTION_RTL_INDX );
textDirectionCombo.add( BidiConstants.TEXT_DIRECTION_CONTEXTLTR,
BidiConstants.TEXT_DIRECTION_CONTEXTLTR_INDX );
textDirectionCombo.add( BidiConstants.TEXT_DIRECTION_CONTEXTRTL,
BidiConstants.TEXT_DIRECTION_CONTEXTRTL_INDX );
textDirectionCombo.select( getTextDirectionComboIndx( bidiFormat.getTextDirection( ) ) );
textDirectionCombo.setLayoutData( innerFrameGridData );
}
private void createOrderSchemaField( BidiFormat bidiFormat,
Group externalBiDiFormatFrame, GridData innerFrameGridData,
boolean isMetadataSetting )
{
Label orderingSchemeLabel = new Label( externalBiDiFormatFrame,
SWT.NONE );
orderingSchemeLabel.setText( isMetadataSetting
? BidiConstants.ORDERING_SCHEME_TITLE_METADATA
: BidiConstants.ORDERING_SCHEME_TITLE_CONTENT );
orderingSchemeLabel.setLayoutData( innerFrameGridData );
orderingSchemeCombo = new Combo( externalBiDiFormatFrame, SWT.DROP_DOWN
| SWT.READ_ONLY );
orderingSchemeCombo.setToolTipText( BidiConstants.ORDERING_SCHEME_TOOLTIP );
orderingSchemeCombo.add( BidiConstants.ORDERING_SCHEME_LOGICAL,
BidiConstants.ORDERING_SCHEME_LOGICAL_INDX );
orderingSchemeCombo.add( BidiConstants.ORDERING_SCHEME_VISUAL,
BidiConstants.ORDERING_SCHEME_VISUAL_INDX );
orderingSchemeCombo.select( getOrderingSchemeComboIndx( bidiFormat.getOrderingScheme( ) ) );
orderingSchemeCombo.setLayoutData( innerFrameGridData );
}
public static void selectEnvironmentInList( String name ) {
GuiToolbarWidgets toolbarWidgets = HopGui.getInstance().getMainToolbarWidgets();
toolbarWidgets.selectComboItem( ID_TOOLBAR_ENVIRONMENT_COMBO, name );
Combo combo = getEnvironmentsCombo();
if ( combo != null ) {
ProjectsConfig config = ProjectsConfigSingleton.getConfig();
LifecycleEnvironment environment = config.findEnvironment( name );
if ( environment != null ) {
combo.setToolTipText( "Environment " + name + " for project '" + environment.getProjectName() + "' has purpose: " + environment.getPurpose() );
}
}
}
@Override
public void createWidget(ParameterComposite parameterComposite, Composite parent) {
combo = new Combo(parent, SWT.READ_ONLY);
combo.setItems(getPossibleValues());
combo.setText(getValue());
combo.setToolTipText(getDescription());
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setValue(combo.getText());
parameterComposite.update();
}
});
}
/**
* Creates the file format chooser to the page.
* @param composite parent component
*/
private void addFormatChooser(Composite composite) {
Label formatLabel = new Label(composite, SWT.LEFT);
formatLabel.setText(TexlipsePlugin.getResourceString("preferenceViewerFormatLabel"));
formatLabel.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerFormatTooltip"));
formatLabel.setLayoutData(new GridData());
formatChooser = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
formatChooser.setLayoutData(new GridData());
formatChooser.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerFormatTooltip"));
formatChooser.setItems(registry.getFormatList());
formatChooser.select(formatChooser.indexOf(registry.getFormat()));
}
private void createSystemSwapSettingField( BidiFormat bidiFormat,
Group externalBiDiFormatFrame, GridData innerFrameGridData,
boolean isMetadataSetting )
{
Label symSwapLabel = new Label( externalBiDiFormatFrame, SWT.NONE );
symSwapLabel.setText( isMetadataSetting
? BidiConstants.SYMSWAP_TITLE_METADATA
: BidiConstants.SYMSWAP_TITLE_CONTENT );
symSwapLabel.setLayoutData( innerFrameGridData );
symSwapCombo = new Combo( externalBiDiFormatFrame, SWT.DROP_DOWN
| SWT.READ_ONLY );
symSwapCombo.setToolTipText( BidiConstants.SYMSWAP_TOOLTIP );
symSwapCombo.add( BidiConstants.SYMSWAP_TRUE,
BidiConstants.SYMSWAP_TRUE_INDX );
symSwapCombo.add( BidiConstants.SYMSWAP_FALSE,
BidiConstants.SYMSWAP_FALSE_INDX );
if ( bidiFormat.getSymSwap( ) )
{
symSwapCombo.select( BidiConstants.SYMSWAP_TRUE_INDX );
}
else
{
symSwapCombo.select( BidiConstants.SYMSWAP_FALSE_INDX );
}
symSwapCombo.setLayoutData( innerFrameGridData );
}
private void createContentSettingArea( BidiFormat bidiFormat,
Group externalBiDiFormatFrame, GridData innerFrameGridData,
GridData arabicGridData, GridLayout arabicInnerFrameLayout,
boolean isMetadataSetting )
{
// bidi_acgc added start
Group arabicBiDiFormatFrame = new Group( externalBiDiFormatFrame,
SWT.NONE );
arabicBiDiFormatFrame.setText( BidiConstants.ARABIC_TITLE );
arabicBiDiFormatFrame.setLayout( arabicInnerFrameLayout );
arabicBiDiFormatFrame.setLayoutData( arabicGridData );
// bidi_acgc added end
Label shapingLabel = new Label( arabicBiDiFormatFrame, SWT.NONE );
shapingLabel.setText( isMetadataSetting
? BidiConstants.SHAPING_TITLE_METADATA
: BidiConstants.SHAPING_TITLE_CONTENT );
shapingLabel.setLayoutData( innerFrameGridData );
shapingCombo = new Combo( arabicBiDiFormatFrame, SWT.DROP_DOWN
| SWT.READ_ONLY );
shapingCombo.setToolTipText( BidiConstants.SHAPING_TOOLTIP );
shapingCombo.add( BidiConstants.SHAPING_SHAPED,
BidiConstants.SHAPING_SHAPED_INDX );
shapingCombo.add( BidiConstants.SHAPING_NOMINAL,
BidiConstants.SHAPING_NOMINAL_INDX );
shapingCombo.select( getShapingComboIndx( bidiFormat.getTextShaping( ) ) );
shapingCombo.setLayoutData( innerFrameGridData );
Label numShapingLabel = new Label( arabicBiDiFormatFrame, SWT.NONE );
numShapingLabel.setText( isMetadataSetting
? BidiConstants.NUMSHAPING_TITLE_METADATA
: BidiConstants.NUMSHAPING_TITLE_CONTENT );
numShapingLabel.setLayoutData( innerFrameGridData );
numShapingCombo = new Combo( arabicBiDiFormatFrame, SWT.DROP_DOWN
| SWT.READ_ONLY );
numShapingCombo.setToolTipText( BidiConstants.NUMSHAPING_TOOLTIP );
numShapingCombo.add( BidiConstants.NUMSHAPING_NOMINAL,
BidiConstants.NUMSHAPING_NOMINAL_INDX );
numShapingCombo.add( BidiConstants.NUMSHAPING_NATIONAL,
BidiConstants.NUMSHAPING_NATIONAL_INDX );
numShapingCombo.add( BidiConstants.NUMSHAPING_CONTEXT,
BidiConstants.NUMSHAPING_CONTEXT_INDX );
numShapingCombo.select( getNumShapingComboIndx( bidiFormat.getNumeralShaping( ) ) );
numShapingCombo.setLayoutData( innerFrameGridData );
numShapingLabel.setEnabled( numShapingCombo.isEnabled( ) );
}
protected Composite buildStrategyFilterPanel( Composite aParent )
{
Group tempStrategyFilterGroup = new Group( aParent, SWT.NONE );
tempStrategyFilterGroup.setText( STRATEGY_FILTER_PANEL_NAME );
RowLayout tempStrategyFilterGroupLayout = new RowLayout( SWT.VERTICAL );
tempStrategyFilterGroup.setLayout(tempStrategyFilterGroupLayout);
Composite tempRowOne = new Composite( tempStrategyFilterGroup, SWT.NONE );
tempRowOne.setLayout( new RowLayout( SWT.HORIZONTAL ) );
Label tempLabelStrategyFilterFixMsgType = new Label( tempRowOne, SWT.NONE );
tempLabelStrategyFilterFixMsgType.setText( "FixMsgType:" );
dropDownListStrategyFilterFixMsgType = new Combo( tempRowOne, SWT.READ_ONLY );
List<String> tempFixMsgTypeList = new ArrayList<String>();
tempFixMsgTypeList.add( "" ); // add empty string at top
tempFixMsgTypeList.addAll( Arrays.asList( Atdl4jConstants.STRATEGY_FILTER_FIX_MSG_TYPES ) );
dropDownListStrategyFilterFixMsgType.setItems( tempFixMsgTypeList.toArray( new String[0] ) );
dropDownListStrategyFilterFixMsgType.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
checkboxInputCxlReplaceMode = new Button( tempRowOne, SWT.CHECK );
checkboxInputCxlReplaceMode.setText( "Cxl Replace Mode" );
Composite tempRowTwo = new Composite( tempStrategyFilterGroup, SWT.NONE );
tempRowTwo.setLayout( new RowLayout( SWT.HORIZONTAL ) );
Label tempLabelStrategyFilterRegion = new Label( tempRowTwo, SWT.NONE );
tempLabelStrategyFilterRegion.setText( "Region:" );
dropDownListStrategyFilterRegion = new Combo( tempRowTwo, SWT.READ_ONLY );
List<String> tempRegionList = new ArrayList<String>();
tempRegionList.add( "" ); // add empty string at top
tempRegionList.addAll( Arrays.asList( Atdl4jConstants.STRATEGY_FILTER_REGIONS ) );
dropDownListStrategyFilterRegion.setItems( tempRegionList.toArray( new String[0] ) );
dropDownListStrategyFilterRegion.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
Label tempLabelStrategyFilterCountry = new Label( tempRowTwo, SWT.NONE );
tempLabelStrategyFilterCountry.setText( "Country:" );
dropDownListStrategyFilterCountry = new Combo( tempRowTwo, SWT.NONE );
dropDownListStrategyFilterCountry.setItems( DEFAULT_STRATEGY_FILTER_COUNTRY_SUBSET_LIST );
dropDownListStrategyFilterCountry.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListStrategyFilterCountry.setToolTipText( "Specify ISO 3166 (2 character) Country Code\nExample list provided." );
Label tempLabelStrategyFilterMICCode = new Label( tempRowTwo, SWT.NONE );
tempLabelStrategyFilterMICCode.setText( "MIC Code:" );
dropDownListStrategyFilterMICCode = new Combo( tempRowTwo, SWT.NONE );
dropDownListStrategyFilterMICCode.setItems( DEFAULT_STRATEGY_FILTER_MIC_CODE_SUBSET_LIST );
dropDownListStrategyFilterMICCode.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListStrategyFilterMICCode.setToolTipText( "Specify ISO 10383 (4 character) MICCode Code\nExample list provided." );
Label tempLabelStrategyFilterSecurityType = new Label( tempRowTwo, SWT.NONE );
tempLabelStrategyFilterSecurityType.setText( "Security Type:" );
dropDownListStrategyFilterSecurityType = new Combo( tempRowTwo, SWT.NONE );
List<String> tempSecurityTypeList = new ArrayList<String>();
tempSecurityTypeList.add( "" ); // add empty string at top
tempSecurityTypeList.addAll( Arrays.asList( Atdl4jConstants.STRATEGY_FILTER_SECURITY_TYPES ) );
dropDownListStrategyFilterSecurityType.setItems( tempSecurityTypeList.toArray( new String[0] ) );
dropDownListStrategyFilterSecurityType.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListStrategyFilterSecurityType.setToolTipText( "Specify FIX (tag 167) Security Type value\nExample list provided." );
return tempStrategyFilterGroup;
}
protected Composite buildStandardFixFieldsPanel( Composite aParent )
{
Group tempStandardFixFieldsGroup = new Group( aParent, SWT.NONE );
tempStandardFixFieldsGroup.setText( STANDARD_FIX_FIELDS_PANEL_NAME );
GridLayout tempStandardFixFieldsGroupLayout = new GridLayout( 2, true );
tempStandardFixFieldsGroup.setLayout(tempStandardFixFieldsGroupLayout);
Label tempLabelStrategyFilterOrdType = new Label( tempStandardFixFieldsGroup, SWT.NONE );
tempLabelStrategyFilterOrdType.setText( "OrdType:" );
dropDownListFixFieldOrdType = new Combo( tempStandardFixFieldsGroup, SWT.NONE );
dropDownListFixFieldOrdType.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
dropDownListFixFieldOrdType.setItems( DEFAULT_FIX_FIELD_ORD_TYPE_SUBSET_LIST );
dropDownListFixFieldOrdType.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListFixFieldOrdType.setToolTipText( "Specify FIX Field value\nExample list provided." );
Label tempLabelStrategyFilterSide = new Label( tempStandardFixFieldsGroup, SWT.NONE );
tempLabelStrategyFilterSide.setText( "Side:" );
dropDownListFixFieldSide = new Combo( tempStandardFixFieldsGroup, SWT.NONE );
dropDownListFixFieldSide.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
dropDownListFixFieldSide.setItems( DEFAULT_FIX_FIELD_SIDE_SUBSET_LIST );
dropDownListFixFieldSide.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListFixFieldSide.setToolTipText( "Specify FIX Field value\nExample list provided." );
Label tempLabelStrategyFilterOrderQty = new Label( tempStandardFixFieldsGroup, SWT.NONE );
tempLabelStrategyFilterOrderQty.setText( "OrderQty:" );
dropDownListFixFieldOrderQty = new Combo( tempStandardFixFieldsGroup, SWT.NONE );
dropDownListFixFieldOrderQty.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
dropDownListFixFieldOrderQty.setItems( DEFAULT_FIX_FIELD_ORDER_QTY_SUBSET_LIST );
dropDownListFixFieldOrderQty.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListFixFieldOrderQty.setToolTipText( "Specify FIX Field value\nExample list provided." );
Label tempLabelStrategyFilterPrice = new Label( tempStandardFixFieldsGroup, SWT.NONE );
tempLabelStrategyFilterPrice.setText( "Price:" );
dropDownListFixFieldPrice = new Combo( tempStandardFixFieldsGroup, SWT.NONE );
dropDownListFixFieldPrice.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
dropDownListFixFieldPrice.setItems( DEFAULT_FIX_FIELD_PRICE_SUBSET_LIST );
dropDownListFixFieldPrice.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListFixFieldPrice.setToolTipText( "Specify FIX Field value\nExample list provided." );
Label tempLabelStrategyFilterHandlInst = new Label( tempStandardFixFieldsGroup, SWT.NONE );
tempLabelStrategyFilterHandlInst.setText( "HandlInst:" );
dropDownListFixFieldHandlInst = new Combo( tempStandardFixFieldsGroup, SWT.NONE );
dropDownListFixFieldHandlInst.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
dropDownListFixFieldHandlInst.setItems( DEFAULT_FIX_FIELD_HANDL_INST_SUBSET_LIST );
dropDownListFixFieldHandlInst.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListFixFieldHandlInst.setToolTipText( "Specify FIX Field value\nExample list provided." );
Label tempLabelStrategyFilterExecInst = new Label( tempStandardFixFieldsGroup, SWT.NONE );
tempLabelStrategyFilterExecInst.setText( "ExecInst:" );
dropDownListFixFieldExecInst = new Combo( tempStandardFixFieldsGroup, SWT.NONE );
dropDownListFixFieldExecInst.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
dropDownListFixFieldExecInst.setItems( DEFAULT_FIX_FIELD_EXEC_INST_SUBSET_LIST );
dropDownListFixFieldExecInst.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListFixFieldExecInst.setToolTipText( "Specify FIX Field value\nExample list provided." );
Label tempLabelStrategyFilterTimeInForce = new Label( tempStandardFixFieldsGroup, SWT.NONE );
tempLabelStrategyFilterTimeInForce.setText( "TimeInForce:" );
dropDownListFixFieldTimeInForce = new Combo( tempStandardFixFieldsGroup, SWT.NONE );
dropDownListFixFieldTimeInForce.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
dropDownListFixFieldTimeInForce.setItems( DEFAULT_FIX_FIELD_TIME_IN_FORCE_SUBSET_LIST );
dropDownListFixFieldTimeInForce.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListFixFieldTimeInForce.setToolTipText( "Specify FIX Field value\nExample list provided." );
Label tempLabelStrategyFilterClOrdLinkID = new Label( tempStandardFixFieldsGroup, SWT.NONE );
tempLabelStrategyFilterClOrdLinkID.setText( "ClOrdLinkID:" );
dropDownListFixFieldClOrdLinkID = new Combo( tempStandardFixFieldsGroup, SWT.NONE );
dropDownListFixFieldClOrdLinkID.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
dropDownListFixFieldClOrdLinkID.setItems( DEFAULT_FIX_FIELD_CL_ORD_LINK_ID_SUBSET_LIST );
dropDownListFixFieldClOrdLinkID.setVisibleItemCount( DEFAULT_DROP_DOWN_VISIBLE_ITEM_COUNT );
dropDownListFixFieldClOrdLinkID.setToolTipText( "Specify FIX Field value (eg for PAIRS strategy)\nExample list provided." );
return tempStandardFixFieldsGroup;
}
public Composite buildStrategySelectionPanel(Composite aParentComposite, Atdl4jOptions atdl4jOptions)
{
setAtdl4jOptions( atdl4jOptions );
// Strategy selector dropdown
dropdownComposite = new Composite(aParentComposite, SWT.NONE);
GridLayout dropdownLayout = new GridLayout(2, false);
dropdownComposite.setLayout(dropdownLayout);
dropdownComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// label
Label strategiesDropDownLabel = new Label(dropdownComposite, SWT.NONE);
strategiesDropDownLabel.setText("Strategy");
// dropDownList
strategiesDropDown = new Combo(dropdownComposite, SWT.READ_ONLY | SWT.BORDER);
strategiesDropDown.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
// -- Increase font size for Drop Down --
FontData[] fontData = strategiesDropDown.getFont().getFontData();
for(int i = 0; i < fontData.length; ++i)
{
fontData[i].setHeight( fontData[i].getHeight() + 3 );
fontData[i].setStyle( SWT.BOLD );
}
final Font newFont = new Font(strategiesDropDown.getDisplay(), fontData);
strategiesDropDown.setFont(newFont);
// Since you created the font, you must dispose it
strategiesDropDown.addDisposeListener(new DisposeListener()
{
public void widgetDisposed(DisposeEvent e)
{
newFont.dispose();
}
});
// TODO wish to avoid issue with changing the font causes the initial combo box display to be very narrow
if ( Atdl4jConfig.getConfig().getStrategyDropDownItemDepth() != null )
{
strategiesDropDown.setVisibleItemCount( Atdl4jConfig.getConfig().getStrategyDropDownItemDepth().intValue() );
}
// tooltip
strategiesDropDown.setToolTipText("Select a Strategy");
// action listener
strategiesDropDown.addSelectionListener(new SelectionAdapter()
{
@Override
public void widgetSelected(SelectionEvent event)
{
int index = strategiesDropDown.getSelectionIndex();
logger.debug( "strategiesDropDown.widgetSelected. strategiesDropDown.getSelectionIndex(): " + index );
selectDropDownStrategy( index );
}
}
);
return dropdownComposite;
}
public Widget createWidget(Composite parent, int style)
{
String tooltip = getTooltip();
GridData controlGD = new GridData( SWT.FILL, SWT.CENTER, false, false );
// label
if ( control.getLabel() != null ) {
label = new Label( parent, SWT.NONE );
label.setText( control.getLabel() );
if ( tooltip != null ) label.setToolTipText( tooltip );
controlGD.horizontalSpan = 1;
} else {
controlGD.horizontalSpan = 2;
}
// dropDownList
style = style | SWT.BORDER;
if ( control instanceof DropDownListT )
{
style |= SWT.READ_ONLY;
}
dropDownList = new Combo( parent, style );
dropDownList.setLayoutData( controlGD );
// dropDownList items
java.util.List<ListItemT> listItems = ( control instanceof EditableDropDownListT ) ? ( (EditableDropDownListT) control ).getListItem()
: ( (DropDownListT) control ).getListItem();
// TODO: throw error if there are no list items
for ( ListItemT listItem : listItems ) dropDownList.add( listItem.getUiRep() );
// tooltip
if ( tooltip != null ) dropDownList.setToolTipText( tooltip );
// default initializer
dropDownList.select( 0 );
// select initValue if available
String initValue = (String) ControlHelper.getInitValue( control, getAtdl4jOptions() );
if ( initValue != null )
setValue( initValue, true );
return parent;
}
@Override
protected Control createDialogArea(final Composite parent){
Composite ret = new Composite(parent, SWT.NONE);
ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
ret.setLayout(new GridLayout(2, false));
new Label(ret, SWT.NONE).setText(Messages.PatientErfassenDialog_Name); //$NON-NLS-1$
tName = new Text(ret, SWT.BORDER);
tName.setText(getField(Patient.FLD_NAME));
tName.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
new Label(ret, SWT.NONE).setText(Messages.PatientErfassenDialog_firstName); //$NON-NLS-1$
tVorname = new Text(ret, SWT.BORDER);
tVorname.setText(getField(Patient.FLD_FIRSTNAME));
tVorname.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
new Label(ret, SWT.NONE).setText(Messages.PatientErfassenDialog_sex); //$NON-NLS-1$
cbSex = new Combo(ret, SWT.SINGLE);
String toolTip = String.format(Messages.Patient_male_female_tooltip,
Messages.Patient_male_short, Messages.Patient_female_short,
Messages.Patient_male_long, Messages.Patient_female_long);
cbSex.setToolTipText(toolTip);
cbSex.setItems(new String[] {
Messages.Patient_male_short, Messages.Patient_female_short
}); //$NON-NLS-1$ //$NON-NLS-2$
if (StringTool.isNothing(getField(Patient.FLD_SEX))) {
cbSex.select(0);
} else {
cbSex.select(StringTool.isFemale(getField(Patient.FLD_FIRSTNAME)) ? 1 : 0);
}
new Label(ret, SWT.NONE).setText(Messages.PatientErfassenDialog_birthDate); //$NON-NLS-1$
tGebDat = new Text(ret, SWT.BORDER);
tGebDat.setText(getField(Patient.FLD_DOB));
tGebDat.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
new Label(ret, SWT.NONE).setText(Messages.PatientErfassenDialog_street); //$NON-NLS-1$
tStrasse = new Text(ret, SWT.BORDER);
tStrasse.setText(getField(Patient.FLD_STREET));
tStrasse.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
new Label(ret, SWT.NONE).setText(Messages.PatientErfassenDialog_zip); //$NON-NLS-1$
tPlz = new Text(ret, SWT.BORDER);
tPlz.setText(getField(Patient.FLD_ZIP));
tPlz.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
new Label(ret, SWT.NONE).setText(Messages.PatientErfassenDialog_city); //$NON-NLS-1$
tOrt = new Text(ret, SWT.BORDER);
tOrt.setText(getField(Patient.FLD_PLACE));
tOrt.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
new Label(ret, SWT.NONE).setText(Messages.PatientErfassenDialog_phone); //$NON-NLS-1$
tTel = new Text(ret, SWT.BORDER);
tTel.setText(getField(Patient.FLD_PHONE1));
tTel.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
return ret;
}