Java Code Examples for org.eclipse.swt.widgets.Text.getLayoutData()

The following are Jave code examples for showing how to use getLayoutData() of the org.eclipse.swt.widgets.Text class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Hydrograph   File: FTPProtocolWidget.java   View Source Code Vote up 5 votes
/**
 * Create TextBoxes on Stack layout composite
 * @param labelName
 * @param compositeWithStack
 * @return
 */
private AbstractELTWidget createWidgetTextbox(String labelName, ELTDefaultSubgroupComposite compositeWithStack, String text) {

	AbstractELTWidget textboxWgt = new ELTDefaultTextBox()
			.grabExcessHorizontalSpace(true).defaultText(text);
	compositeWithStack.attachWidget(textboxWgt);
	Text textbox = ((Text) textboxWgt.getSWTWidgetControl());
	
	GridData data = (GridData) textbox.getLayoutData();
	data.horizontalIndent = 5;
	data.verticalIndent = 5;
	data.widthHint = 260;
	return textboxWgt;
}
 
Example 2
Project: Hydrograph   File: SelectionDatabaseWidget.java   View Source Code Vote up 5 votes
/**
 * Create TextBoxes on Stack layout composite
 * @param labelName
 * @param compositeWithStack
 * @return
 */
private AbstractELTWidget createWidgetTextbox(String labelName, ELTSubGroupCompositeWithStack compositeWithStack) {

	AbstractELTWidget textboxWgt = new ELTDefaultTextBox()
			.grabExcessHorizontalSpace(textBoxConfig.getGrabExcessSpace());
	compositeWithStack.attachWidget(textboxWgt);
	Text textbox = ((Text) textboxWgt.getSWTWidgetControl());

	GridData data = (GridData) textbox.getLayoutData();
	data.horizontalIndent = 16;
	data.verticalIndent = 5;
	data.widthHint = 260;
	return textboxWgt;
}
 
Example 3
Project: Hydrograph   File: TextBoxWithLabelWidget.java   View Source Code Vote up 5 votes
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {
	
	logger.trace("Starting {} textbox creation", textBoxConfig.getName());
	lableAndTextBox = new ELTDefaultSubgroupComposite(container.getContainerControl());
	lableAndTextBox.createContainerWidget();
	
	AbstractELTWidget label = new ELTDefaultLable(textBoxConfig.getName() + " ");
	lableAndTextBox.attachWidget(label);
	setPropertyHelpWidget((Control) label.getSWTWidgetControl());
	
	AbstractELTWidget textBoxWidget = new ELTDefaultTextBox().
			grabExcessHorizontalSpace(textBoxConfig.getGrabExcessSpace());//.textBoxWidth(textBoxConfig.getwidgetWidth());
	lableAndTextBox.attachWidget(textBoxWidget);
	
	textBox = (Text) textBoxWidget.getSWTWidgetControl();
	textBox.setEnabled(textBoxConfig.isEnabled());
	txtDecorator = WidgetUtility.addDecorator(textBox, Messages.bind(Messages.EMPTY_FIELD, textBoxConfig.getName()));
	txtDecorator.setMarginWidth(3);
	GridData gridData = (GridData)textBox.getLayoutData();
	if(OSValidator.isMac()){
		gridData.widthHint = 106;
	}else{
		gridData.widthHint = 80;
	}
	attachListeners(textBoxWidget);
	String property = propertyValue;
	textBox.setText(property);
	
	 /**
	 *parameter resolution at dev phase 
	 */
	Utils.INSTANCE.loadProperties();
	cursor = container.getContainerControl().getDisplay().getSystemCursor(SWT.CURSOR_HAND);
	
	populateWidget();
	logger.trace("Finished {} textbox creation", textBoxConfig.getName());
}
 
Example 4
Project: Hydrograph   File: WorksheetWidget.java   View Source Code Vote up 5 votes
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget subGroup) {
	eltSubgroupComposite = new ELTDefaultSubgroupComposite(subGroup.getContainerControl());
	eltSubgroupComposite.createContainerWidget();
	Utils.INSTANCE.loadProperties();
	this.cursor = subGroup.getContainerControl().getDisplay().getSystemCursor(SWT.CURSOR_HAND);

	AbstractELTWidget label = new ELTDefaultLable(Messages.LABEL_WORKSHEET_NAME + " ");
	eltSubgroupComposite.attachWidget(label);
	setPropertyHelpWidget((Control) label.getSWTWidgetControl());

	AbstractELTWidget textBoxWidget = new ELTDefaultTextBox();
	eltSubgroupComposite.attachWidget(textBoxWidget);

	textBox = (Text) textBoxWidget.getSWTWidgetControl();
	txtDecorator = WidgetUtility.addDecorator(textBox, Messages.bind(Messages.EMPTY_FIELD, ((Label) label.getSWTWidgetControl()).getText()));
	txtDecorator.setMarginWidth(3);
	txtDecorator.show();
	textBox.setToolTipText("Worksheet Name can be static or FieldName or a Parameter");
	GridData gridData = (GridData) textBox.getLayoutData();
	if (OSValidator.isMac()) {
		gridData.widthHint = 106;
	} else {
		gridData.widthHint = 80;
	}
	attachListeners(textBox);

	isFieldCheckBox = new Button(eltSubgroupComposite.getContainerControl(), SWT.CHECK);
	isFieldCheckBox.setEnabled(false);
	isFieldCheckBox.setText(Constants.IS_FIELD);
	attachSelectionListener(isFieldCheckBox);
	populateWidget();
}