本文整理汇总了Java中org.eclipse.swt.widgets.Text.setTextLimit方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setTextLimit方法的具体用法?Java Text.setTextLimit怎么用?Java Text.setTextLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Text
的用法示例。
在下文中一共展示了Text.setTextLimit方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGridComposite
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
@Override
protected GridComposite createGridComposite(Composite parent) {
GridComposite gridComposite = new GridComposite(parent) {
@Override
protected void createContents() {
GridTextInput hostGridTextInput = new GridTextInput(this, GridTextInput.Type.VALUE_REQUIRED,
CONTROL_NAME_HOST_TEXT, "&Host:", ZooKeeperServerDescriptor.DEFAULT_HOST);
addGridTextInput(hostGridTextInput);
Text hostText = hostGridTextInput.getText();
hostText.selectAll();
hostText.setTextLimit(500);
GridTextInput portGridTextInput = new GridTextInput(this, GridTextInput.Type.INTEGER_VALUE_REQUIRED,
CONTROL_NAME_PORT_TEXT, "&Port:", String.valueOf(ZooKeeperServerDescriptor.DEFAULT_PORT));
addGridTextInput(portGridTextInput);
Text portText = portGridTextInput.getText();
portText.selectAll();
}
};
return gridComposite;
}
示例2: GridTextInput
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param parent The parent {@link Composite}.
* @param type The {@link Type}.
* @param name The {@link GridTextInput} name.
* @param labelText The {@link Label} text.
* @param labelStyle The {@link Label} style.
* @param labelLayoutData The {@link Label} {@link GridData layout data}.
* @param textText The {@link Text} text.
* @param textStyle The {@link Text} style.
* @param textLayoutData The {@link Text} {@link GridData layout data}.
*/
public GridTextInput(Composite parent, Type type, String name, String labelText, int labelStyle,
GridData labelLayoutData, String textText, int textStyle, GridData textLayoutData) {
_Type = type;
_DefaultTextValue = textText;
if (_DefaultTextValue != null && _Type.isInteger()) {
if (!isValidIntegerText(_DefaultTextValue)) {
throw new IllegalArgumentException("Invalid integer value: " + _DefaultTextValue);
}
}
_Name = name;
if (labelText != null) {
_Label = new Label(parent, labelStyle);
_Label.setText(labelText);
_Label.setLayoutData(labelLayoutData);
_Label.pack();
}
_Text = new Text(parent, textStyle);
if (textText != null) {
_Text.setText(textText);
}
_Text.setLayoutData(textLayoutData);
if (_Type.isInteger()) {
_Text.setTextLimit(10);
}
_Text.setData(this);
}
示例3: createPageContent
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
@Override
protected void createPageContent(@NonNull SectionComposite sectionComposite) {
Composite parent = sectionComposite.getContent();
Composite composite = new Composite(parent, SWT.BORDER);
composite.setLayout(new GridLayout(2, false));
Label lblDev = new Label(composite, SWT.NONE);
lblDev.setText("Developer");
developer = new Text(composite, SWT.BORDER);
Label lblObjectId = new Label(composite, SWT.NONE);
lblObjectId.setText("Process ID");
objectId = new Text(composite, SWT.BORDER);
objectId.setTextLimit(10);
Label lblprocType = new Label(composite, SWT.NONE);
lblprocType.setText("Process Type");
procType = new Text(composite, SWT.BORDER);
procType.setTextLimit(4);
Label lblstatus = new Label(composite, SWT.NONE);
lblstatus.setText("Status");
status = new Text(composite, SWT.BORDER);
Label lblPrio = new Label(composite, SWT.NONE);
lblPrio.setText("Priority");
priority = new Text(composite, SWT.BORDER);
priority.setTextLimit(1);
}
示例4: getListener
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
@Override
public Listener getListener(
PropertyDialogButtonBar propertyDialogButtonBar,
ListenerHelper helpers, Widget... widgets) {
final Widget[] widgetList = widgets;
if (helpers != null) {
txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
characterLimit = (int) helpers.get(HelperType.CHARACTER_LIMIT);
}
Listener listener=new Listener() {
@Override
public void handleEvent(Event event) {
Text text = (Text)widgetList[0];
text.setTextLimit(characterLimit);
String string=event.text;
Matcher matchs=Pattern.compile("[\\d]*").matcher(string);
if(!matchs.matches()){
txtDecorator.setDescriptionText(Messages.FIELDBATCH);
txtDecorator.show();
event.doit=false;
}else
txtDecorator.hide();
}
};
return listener;
}
示例5: getListener
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
@Override
public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers,
Widget... widgets) {
final Widget[] widgetList = widgets;
if (helpers != null) {
txtDecorator = (ControlDecoration) helpers.get(HelperType.CONTROL_DECORATION);
characterLimit = (int) helpers.get(HelperType.CHARACTER_LIMIT);
}
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
Text text = (Text) widgetList[0];
text.setTextLimit(characterLimit);
String value = ((Text) widgets[0]).getText().trim();
Matcher matchs = Pattern.compile(Constants.PARAMETER_REGEX).matcher(value);
if ((!matchs.matches())) {
txtDecorator.setDescriptionText(Messages.FIELDCHARACTER);
txtDecorator.show();
event.doit = false;
} else if (matchs.matches()) {
txtDecorator.hide();
}
}
};
return listener;
}
示例6: createConsoleBufferWidget
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Create console buffer widget
* @param bufferSize
*/
private void createConsoleBufferWidget(String bufferSize){
HydroGroup hydroGroup = new HydroGroup(this, SWT.NONE);
hydroGroup.setHydroGroupText(Messages.HYDROGRAPH_CONSOLE_PREFERANCE_PAGE_GROUP_NAME);
hydroGroup.setLayout(new GridLayout(1, false));
hydroGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
hydroGroup.getHydroGroupClientArea().setLayout(new GridLayout(2, false));
Label label = new Label(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
label.setText(Messages.PREFERANCE_CONSOLE_BUFFER_SIZE);
textWidget = new Text(hydroGroup.getHydroGroupClientArea(), SWT.BORDER);
textWidget.setText(bufferSize);
textWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
textWidget.setTextLimit(6);
attachConsoleBufferValidator();
Composite purgeComposite = new Composite(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
purgeComposite.setLayout(new GridLayout(2, false));
purgeComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
Label lblNote = new Label(purgeComposite, SWT.TOP | SWT.WRAP);
lblNote.setText(Messages.PREFERANCE_PAGE_NOTE);
FontData fontData = lblNote.getFont().getFontData()[0];
Font font = new Font(purgeComposite.getDisplay(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
lblNote.setFont(font);
Label lblmsg = new Label(purgeComposite, SWT.TOP | SWT.WRAP);
lblmsg.setText(Messages.UI_PERFORMANCE_NOTE_IN_CASE_OF_CHANGE_IN_BUFFER_SIZE);
}
示例7: createAssitTextBox
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
private void createAssitTextBox(Point cursorRelativePosition) {
assistText = new Text((Composite) graphicControl, SWT.BORDER);
assistText.setLocation(cursorRelativePosition.x, cursorRelativePosition.y - assistText.getLineHeight());
assistText.setSize(200, assistText.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
assistText.setTextLimit(51);
assistText.setFocus();
}
示例8: attachToPropertySubGroup
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {
ELTDefaultSubgroupComposite eltDefaultSubgroupComposite = new ELTDefaultSubgroupComposite(
container.getContainerControl());
eltDefaultSubgroupComposite.createContainerWidget();
AbstractELTWidget eltDefaultLable = new ELTDefaultLable(NAME);
eltDefaultSubgroupComposite.attachWidget(eltDefaultLable);
setPropertyHelpWidget((Control) eltDefaultLable.getSWTWidgetControl());
AbstractELTWidget eltDefaultTextBox = new ELTDefaultTextBox().defaultText("Hello")
.grabExcessHorizontalSpace(true);
eltDefaultSubgroupComposite.attachWidget(eltDefaultTextBox);
text = (Text) eltDefaultTextBox.getSWTWidgetControl();
text.setFocus();
text.setTextLimit(256);
firstTextWidget = text;
txtDecorator = WidgetUtility.addDecorator(text, Messages.FIELD_LABEL_ERROR);
txtDecorator.setMarginWidth(3);
ListenerHelper listenerHelper = new ListenerHelper();
listenerHelper.put(HelperType.CONTROL_DECORATION, txtDecorator);
listenerHelper.put(HelperType.CURRENT_COMPONENT, getComponent());
try {
listener = (ELTVerifyComponentNameListener) ListenerFactory.Listners.VERIFY_COMPONENT_NAME.getListener();
listener.setNames((ArrayList<String>) super.componentMiscellaneousProperties
.getComponentMiscellaneousProperty(COMPONENT_NAMES));
eltDefaultTextBox.attachListener(listener, propertyDialogButtonBar, listenerHelper,
eltDefaultTextBox.getSWTWidgetControl());
focusOutListener = (ELTNormalFocusOutListener) ListenerFactory.Listners.NORMAL_FOCUS_OUT.getListener();
listener.setNames((ArrayList<String>) super.componentMiscellaneousProperties
.getComponentMiscellaneousProperty(COMPONENT_NAMES));
eltDefaultTextBox.attachListener(focusOutListener, propertyDialogButtonBar, listenerHelper,
eltDefaultTextBox.getSWTWidgetControl());
} catch (Exception exception) {
logger.error("Exception occured", exception);
}
populateWidget();
}
示例9: addTextEditor
import org.eclipse.swt.widgets.Text; //导入方法依赖的package包/类
/**
* Adds the text editor.
*
* @param table
* the table
* @param cellEditor
* the cell editor
* @param position
* the position
*/
protected void addTextEditor(Table table, CellEditor[] cellEditor, Map<String, Integer> columns, String columnsName){
cellEditor[columns.get(columnsName)]=new TextCellEditor(table);
if(columnsName.equals(Messages.PRECISION) || columnsName.equals(Messages.SCALE)){
TextCellEditor editor = (TextCellEditor) cellEditor[columns.get(columnsName)];
Text txt = (Text) editor.getControl();
txt.setTextLimit(2);
}
}