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

The following are Jave code examples for showing how to use getData() 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: FilterHelper.java   View Source Code Vote up 7 votes
/**
 * Gets the text box value 1 listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the text box value 1 listener
 */
public  Listener getTextBoxValue1Listener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	Listener listener = new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)event.widget;
			int index = (int) text.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			filterConditions.setValue1(text.getText());
			validateText(text, filterConditions.getFieldName(), fieldsAndTypes, filterConditions.getConditionalOperator());
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 2
Project: Hydrograph   File: FilterHelper.java   View Source Code Vote up 6 votes
/**
 * Gets the text box value 2 listener.
 * 
 * @param conditionsList
 *            the conditions list
 * @param fieldsAndTypes
 *            the fields and types
 * @param fieldNames
 *            the field names
 * @param saveButton
 *            the save button
 * @param displayButton
 *            the display button
 * @return the text box value 2 listener
 */
public  Listener getTextBoxValue2Listener(final List<Condition> conditionsList, 
		final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
	Listener listener = new Listener() {
		
		@Override
		public void handleEvent(Event event) {
			Text text = (Text)event.widget;
			int index = (int) text.getData(FilterConstants.ROW_INDEX);
			Condition filterConditions = conditionsList.get(index);
			filterConditions.setValue2(text.getText());
			validateText(text, filterConditions.getFieldName(), fieldsAndTypes,filterConditions.getConditionalOperator());
			toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
		}
	};
	return listener;
}
 
Example 3
Project: Hydrograph   File: ExecutionTrackingPreferanceComposite.java   View Source Code Vote up 6 votes
/**
 * Checks if all values are correct and enable/disable ok button
 */
private void checkState() {
	if (editorList != null) {
		int size = editorList.size();
		for (int i = 0; i < size; i++) {
			Text fieldEditor = editorList.get(i);
			String errorMessage = (String) fieldEditor.getData(ERROR_KEY);
			if (StringUtils.isNotBlank(errorMessage)) {
				executionTrackPreference.setErrorMessage(errorMessage);
				executionTrackPreference.setValid(false);
				break;
			} else {
				executionTrackPreference.setErrorMessage(null);
				executionTrackPreference.setValid(true);
			}
		}
	}
}
 
Example 4
Project: Hydrograph   File: EmptyTextListener.java   View Source Code Vote up 5 votes
@Override
public void modifyText(ModifyEvent event) {
	Text textBox = (Text)event.getSource();
	Button btnRemoteMode = (Button)textBox.getData(RunConfigDialog.SELECTION_BUTTON_KEY);
	String txt= textBox.getText();

	if (StringUtils.isBlank(txt)) {
		if(errorDecorator==null){
		errorDecorator = WidgetUtility.addDecorator(textBox,Messages.bind(Messages.EMPTY_FIELD, fieldName));
		}
		if(btnRemoteMode!=null){
			if(btnRemoteMode.getSelection()){
				errorDecorator.show();
			}else
				errorDecorator.hide();
		}else{
			errorDecorator.show();
		}
		errorDecorator.setMarginWidth(3);

	} else {
		if(errorDecorator!=null)
			errorDecorator.hide();

	}

}