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

The following are Jave code examples for showing how to use setEnabled() 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.
Example 1
Project: Hydrograph   File: GroupCombineExpressionComposite.java   Source Code and License Vote up 7 votes
/**
 * @param isParam
 * @param isWholeOperationParameter
 */
private void disabledWidgetsifWholeExpressionIsParameterForAggregateCumulate(Button isParam,
		boolean isWholeOperationParameter) {
	if (isWholeOperationParameter) {
		Text textAccumulator = (Text) isParam.getData(Messages.TEXT_ACCUMULATOR);
		Button isParamAccumulator = (Button) isParam.getData(Messages.ISPARAM_ACCUMULATOR);
		Combo comboDataTypes = (Combo) isParam.getData(Messages.COMBODATATYPES);
		Button button =(Button) isParam.getData(Constants.EXPRESSION_EDITOR_BUTTON1);
	    button.setEnabled(false);
		textAccumulator.setEnabled(false);
		isParamAccumulator.setEnabled(false);
		comboDataTypes.setEnabled(false);
		super.disabledWidgetsifWholeExpressionIsParameter(isParamAccumulator, isWholeOperationParameter);
	}

}
 
Example 2
Project: Hydrograph   File: LoadTypeConfigurationDialog.java   Source Code and License Vote up 6 votes
/**
 * The Function will call to disable the widgets
 * @param textbox1
 * @param textbox2
 * @param buttonWidgets
 * @return Selection Adapter
 */
private SelectionAdapter buttonSelectionListener( Text textbox2,Widget... buttonWidgets){
	Supplier<Stream<Widget>> streamSupplier = () -> Stream.of(buttonWidgets);
	SelectionAdapter adapter = new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			newTableRadioButton.setSelection(false);
			textbox2.setEnabled(false);
			streamSupplier.get().forEach((Widget widgets) ->{((Button)widgets).setEnabled(false);});
			if(OSValidator.isMac()){
				((Button)event.getSource()).setFocus();
			}
			propertyDialogButtonBar.enableApplyButton(true);
		}
	};
	return adapter;
}
 
Example 3
Project: Hydrograph   File: AbstractExpressionComposite.java   Source Code and License Vote up 6 votes
/**
 * @param isParam
 * @param isWholeOperationParameter
 */
protected void disabledWidgetsifWholeExpressionIsParameter(Button isParam, boolean isWholeOperationParameter) {
	if (isWholeOperationParameter) {
		TableViewer tableViewer = (TableViewer) isParam.getData(Constants.INPUT_FIELD_TABLE);
		Button addButton = (Button) isParam.getData(Constants.ADD_BUTTON);
		Button deleteButton = (Button) isParam.getData(Constants.DELETE_BUTTON);
		Text expressionIdTextBox = (Text) isParam.getData(Constants.EXPRESSION_ID_TEXT_BOX);
		Button browseButton = (Button) isParam.getData(Constants.EXPRESSION_EDITOR_BUTTON);
		Text outputFieldTextBox = (Text) isParam.getData(Constants.OUTPUT_FIELD_TEXT_BOX);
		tableViewer.getTable().setEnabled(false);
		addButton.setEnabled(false);
		deleteButton.setEnabled(false);
		expressionIdTextBox.setEnabled(false);
		browseButton.setEnabled(false);
		outputFieldTextBox.setEnabled(false);
	}
}
 
Example 4
Project: Hydrograph   File: UpdateByKeysWidget.java   Source Code and License Vote up 6 votes
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget subGroup) {
	
	logger.debug("Starting {} button creation");
	ELTDefaultSubgroupComposite selectUpdateKeysComposite = new ELTDefaultSubgroupComposite(subGroup.getContainerControl());
	selectUpdateKeysComposite.createContainerWidget();
	
	ELTDefaultLable defaultLable1 = new ELTDefaultLable(Messages.LABEL_UPDATE_BY_KEYS);
	selectUpdateKeysComposite.attachWidget(defaultLable1);
	setPropertyHelpWidget((Control) defaultLable1.getSWTWidgetControl());
	
	ELTDefaultTextBox defaultUpdateByKeysTextBox = new ELTDefaultTextBox();
	selectUpdateKeysComposite.attachWidget(defaultUpdateByKeysTextBox);
	 updateByKeysTextBox=(Text)defaultUpdateByKeysTextBox.getSWTWidgetControl();
	 updateByKeysTextBox.setEnabled(false);
	setPropertyHelpWidget((Control) defaultUpdateByKeysTextBox.getSWTWidgetControl());
	
	ELTDefaultButton eltDefaultButton = new ELTDefaultButton(Messages.LABEL_SELECT_KEYS);
	selectUpdateKeysComposite.attachWidget(eltDefaultButton);
	selectKeysButton=(Button)eltDefaultButton.getSWTWidgetControl();
	
	updateByKeysTextBoxDecorator = WidgetUtility.addDecorator(updateByKeysTextBox, Messages.bind(Messages.EMPTY_FIELD, "JDBC Driver \n Class"));
	updateByKeysTextBoxDecorator.setMarginWidth(3);

	if(StringUtils.isNotEmpty(propertyValue)){
		updateByKeysTextBox.setText(propertyValue);
		updateByKeysTextBoxDecorator.hide();
	}
	
	attachButtonListner(selectKeysButton);
	
	
	updateByKeysTextBox.addModifyListener(new ModifyListener() {
		
		@Override
		public void modifyText(ModifyEvent event) {
			Text textBox=(Text)event.widget;
			if(StringUtils.isBlank(textBox.getText())){
				updateByKeysTextBoxDecorator.show();
			}else{
				updateByKeysTextBoxDecorator.hide();
			}
		}
	});
	
}
 
Example 5
Project: gw4e.project   File: GeneratorChoiceComposite.java   Source Code and License Vote up 5 votes
private void createNewMode() {
	btnCreateNewRadioButton = new Button(this, SWT.RADIO);
	btnCreateNewRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	btnCreateNewRadioButton.setText(MessageUtil.getString("standalone_mode"));
	btnCreateNewRadioButton.setSelection(false);
	btnCreateNewRadioButton.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			switch (e.type) {
			case SWT.Selection:
				updateUI();
				break;
			}
		}
	});
	btnCreateNewRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_CHECKBOX);

	Composite composite = new Composite(this, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	composite.setLayout(new GridLayout(12, false));

	lblNewClassnameLabel = new Label(composite, SWT.NONE);
	lblNewClassnameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblNewClassnameLabel.setText("Class name");
	lblNewClassnameLabel.setEnabled(false);

	newClassnameText = new Text(composite, SWT.BORDER);
	newClassnameText.setEnabled(false);
	newClassnameText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			listener.handleEvent(null);
		}
	});
	newClassnameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	newClassnameText.setEnabled(false);
	newClassnameText.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_TEXT);
}
 
Example 6
Project: Hydrograph   File: TextGridRowBuilder.java   Source Code and License Vote up 5 votes
public Composite addRaw(){
	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(textGridRow.getNumberOfColumn() + 1, false);
	gl_composite.horizontalSpacing = 7;
	gl_composite.marginWidth = 1;
	gl_composite.marginHeight = 0;
	gl_composite.verticalSpacing = 1;
	composite.setLayout(gl_composite);
		
	Button rowSelection = new Button(composite, SWT.CHECK);
	rowSelection.setEnabled(enabled);
	
	Map<Integer, TextGridColumnLayout> columns = textGridRow.getTextGridColumns();
	for(int columnNumber:columns.keySet()){
		Text text = new Text(composite, SWT.BORDER);
		if(!columns.get(columnNumber).grabHorizantalAccessSpace()){
			GridData gd_text = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
			gd_text.widthHint = columns.get(columnNumber).getColumnWidth();
			text.setLayoutData(gd_text);
			
			text.setEditable(columns.get(columnNumber).isEditable());
			text.setEnabled(columns.get(columnNumber).isEnabled());
		}else{
			text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			text.setBounds(0, 0, 76, 21);
			text.setFocus();
			
			text.setEditable(columns.get(columnNumber).isEditable());
			text.setEnabled(columns.get(columnNumber).isEnabled());
		}
		
		if(rowData!=null)
			text.setText(rowData.get(columnNumber));
	}
	
	return composite;
}
 
Example 7
Project: Hydrograph   File: FunctionsUpperComposite.java   Source Code and License Vote up 5 votes
private void createSearchTextBox(Composite headerComposite) {
	functionSearchTextBox = new Text(headerComposite, SWT.BORDER);
	GridData gd_searchTextBox = new GridData(SWT.RIGHT, SWT.CENTER, true, true, 0, 0);
	gd_searchTextBox.widthHint = 150;
	functionSearchTextBox.setLayoutData(gd_searchTextBox);
	functionSearchTextBox.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 128, 128, 128));
	functionSearchTextBox.setText(Constants.DEFAULT_SEARCH_TEXT);
	functionSearchTextBox.setEnabled(false);
	addListnersToSearchTextBox();
	ExpressionEditorUtil.INSTANCE.addFocusListenerToSearchTextBox(functionSearchTextBox);
}
 
Example 8
Project: Hydrograph   File: FTPProtocolWidget.java   Source Code and License Vote up 5 votes
private void validateTextWidget(Text text, boolean isEnable, ControlDecoration controlDecoration, Color color){
	text.setText("");
	text.setEnabled(isEnable);
	if(!isEnable){
		controlDecoration.hide();
	}
	text.setBackground(color);
}
 
Example 9
Project: Hydrograph   File: AggregateCumulateExpressionComposite.java   Source Code and License Vote up 5 votes
/**
 * @param isParam
 * @param isWholeOperationParameter
 */
private void disabledWidgetsifWholeExpressionIsParameterForAggregateCumulate(Button isParam,
		boolean isWholeOperationParameter) {
	if (isWholeOperationParameter) {
		Text textAccumulator = (Text) isParam.getData(Messages.TEXT_ACCUMULATOR);
		Button isParamAccumulator = (Button) isParam.getData(Messages.ISPARAM_ACCUMULATOR);
		Combo comboDataTypes = (Combo) isParam.getData(Messages.COMBODATATYPES);
		textAccumulator.setEnabled(false);
		isParamAccumulator.setEnabled(false);
		comboDataTypes.setEnabled(false);
		super.disabledWidgetsifWholeExpressionIsParameter(isParamAccumulator, isWholeOperationParameter);
	}

}
 
Example 10
Project: Hydrograph   File: OperationClassComposite.java   Source Code and License Vote up 5 votes
private void disabledWidgetsifWholeOperationIsParameter(Button isParam,boolean isWholeOperationParameter) 
{
	if (isWholeOperationParameter) {
		Button text = (Button) isParam;
		Text parameterTextBox = (Text) text.getData(PARAMETER_TEXT_BOX);
		TableViewer operationInputFieldTableViewer = (TableViewer) text.getData(OPERATION_INPUT_FIELD_TABLE_VIEWER);
		TableViewer operationalOutputFieldTableViewer = (TableViewer) text.getData(OPERATION_OUTPUT_FIELD_TABLE_VIEWER);
		Text operationClassTextBox = (Text) text.getData(OPERATION_CLASS_TEXT_BOX);
		Text operationIDTextBox = (Text) text.getData(OPERATION_ID_TEXT_BOX);
		Button btnNewButton = (Button) text.getData(BTN_NEW_BUTTON);
		Button inputAdd = (Button) text.getData(INPUT_ADD_BUTTON);

		Button inputDelete = (Button) text.getData(INPUT_DELETE_BUTTON);
		Button outputAdd = (Button) text.getData(OUTPUT_ADD_BUTTON);
		Button outputDelete = (Button) text.getData(OUTPUT_DELETE_BUTTON);
		parameterTextBox.setEnabled(true);

		operationInputFieldTableViewer.getTable().setEnabled(false);

		operationalOutputFieldTableViewer.getTable().setEnabled(false);
		operationClassTextBox.setEnabled(false);

		operationIDTextBox.setEnabled(false);

		btnNewButton.setEnabled(false);
		inputAdd.setEnabled(false);
		inputDelete.setEnabled(false);

		outputAdd.setEnabled(false);
		outputDelete.setEnabled(false);

	}
}
 
Example 11
Project: Hydrograph   File: TextBoxWithLabelWidget.java   Source Code and License 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 12
Project: Hydrograph   File: DebugDataViewer.java   Source Code and License Vote up 5 votes
private void createPageNumberDisplay(Composite composite_3) {
	Text pageNumberDisplayTextBox = new Text(composite_3, SWT.BORDER | SWT.CENTER);
	pageNumberDisplayTextBox.setEnabled(false);
	pageNumberDisplayTextBox.setEditable(false);
	GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_text.widthHint = 178;
	pageNumberDisplayTextBox.setLayoutData(gd_text);

	windowControls.put(ControlConstants.PAGE_NUMBER_DISPLAY, pageNumberDisplayTextBox);
}
 
Example 13
Project: gw4e.project   File: GeneratorChoiceComposite.java   Source Code and License Vote up 4 votes
private void createExtendMode() {
	btnExtendRadioButton = new Button(this, SWT.RADIO);
	btnExtendRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	btnExtendRadioButton.setText(MessageUtil.getString("extending_class"));
	btnExtendRadioButton.setSelection(false);
	btnExtendRadioButton.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			switch (e.type) {
			case SWT.Selection:
				updateUI();
				break;
			}
		}
	});
	btnExtendRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_EXTEND_CHECKBOX);

	Composite composite = new Composite(this, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	composite.setLayout(new GridLayout(12, false));

	lblExtendedLabel = new Label(composite, SWT.NONE);
	lblExtendedLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblExtendedLabel.setText(MessageUtil.getString("class_extended"));
	lblExtendedLabel.setEnabled(false);

	comboExtendedClassnameViewer = new AncestorViewer(composite);
	comboExtendedClassnameViewer.initialize(GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST, false);
	comboExtendedClassnameViewer.getCombo().setData(GW4E_CONVERSION_WIDGET_ID, GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST);
	
	Combo combo = comboExtendedClassnameViewer.getCombo();
	combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	combo.setEnabled(false);

	lblExtendingLabel = new Label(composite, SWT.NONE);
	lblExtendingLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblExtendingLabel.setText(MessageUtil.getString("classname"));
	lblExtendingLabel.setEnabled(false);

	extendingClassnameText = new Text(composite, SWT.BORDER);
	extendingClassnameText.setEnabled(false);
	extendingClassnameText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			listener.handleEvent(null);
		}
	});
	extendingClassnameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	extendingClassnameText.setEnabled(false);
	extendingClassnameText.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_EXTEND_CLASS_TEXT);
}