java类org.eclipse.swt.widgets.Text的实例源码

FilterHelper.java 文件源码 项目:Hydrograph 阅读 32 收藏 0 点赞 0 评论 0
/**
 * 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;
}
ViewerPage.java 文件源码 项目:com.onpositive.prefeditor 阅读 25 收藏 0 点赞 0 评论 0
protected void createFilterControls(Composite con) {
    Label filterLabel = new Label(con,SWT.NONE);
    filterLabel.setText("Filter:");
    GridDataFactory.swtDefaults().applyTo(filterLabel);
    Text filterText = new Text(con, SWT.BORDER);
    filterText.setMessage("(" + PreferenceFilter.MIN_FILTER_CHARS + " chars at least)");
    filterText.addModifyListener(event -> {
        filterChanged(filterText.getText());
    });
    GridDataFactory.fillDefaults().grab(true,false).applyTo(filterText);
    Button clearBtn = new Button(con, SWT.PUSH);
    clearBtn.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(PrefEditorPlugin.PLUGIN_ID,"icons/clear.gif").createImage());
    GridDataFactory.swtDefaults().applyTo(clearBtn);
    clearBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            filterText.setText("");
            filterChanged("");
        }

    });
}
SuffixText.java 文件源码 项目:n4js 阅读 23 收藏 0 点赞 0 评论 0
@Override
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
    int width = 0;
    int height = 0;
    Point textDimension = textDimensions();
    Control[] children = composite.getChildren();
    for (Control child : children) {
        if (child instanceof Text) {
            final String textContent = ((Text) child).getText();
            textDimension = gc.textExtent(textContent);
            width += textDimension.x;
            height += textDimension.y;
        }
        if (child instanceof Label) {
            Point computedSize = child.computeSize(0, 0);
            width += computedSize.x;
        }
    }
    return new Point(width, height + 4);
}
GW4ELaunchConfigurationTab.java 文件源码 项目:gw4e.project 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Create the element that allow to select a project See the GraphWalker
 * offline command for more information
 */
private void createProjectSection(Composite parent) {
    fProjLabel = new Label(parent, SWT.NONE);
    fProjLabel.setText(MessageUtil.getString("label_project"));
    GridData gd = new GridData();
    gd.horizontalIndent = 25;
    fProjLabel.setLayoutData(gd);

    fProjText = new Text(parent, SWT.SINGLE | SWT.BORDER);
    fProjText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fProjText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent evt) {
            validatePage();
            updateConfigState();

        }
    });
    fProjText.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, GW4E_LAUNCH_CONFIGURATION_TEXT_ID_PROJECT);

}
SuperClassComponentProvider.java 文件源码 项目:n4js 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Creates a new super class component using the given model and container.
 *
 * @param model
 *            The model to bind this to
 * @param container
 *            The parent WizardComponentContainer
 */
public SuperClassComponent(N4JSClassWizardModel model, WizardComponentContainer container) {
    super(container);
    this.model = model;

    Label superClassLabel = new Label(container.getComposite(), SWT.NONE);
    superClassLabel.setText("Super class:");

    text = new Text(container.getComposite(), SWT.BORDER);
    text.setLayoutData(fillTextDefaults());

    browseButton = new Button(container.getComposite(), SWT.NONE);
    browseButton.setToolTipText("Opens a dialog to choose the super class");
    browseButton.setText("Browse...");

    setupBindings();
    setupDialog();
}
InstallNpmDependencyDialog.java 文件源码 项目:n4js 阅读 20 收藏 0 点赞 0 评论 0
private void createVersionArea(final Group parent, String versionLabel, Consumer<String> textHandler,
        Consumer<Boolean> flagHandler) {
    final Composite area = createVersionArea(parent, versionLabel);
    final Composite textArea = createVersionInputArea(area);

    final Text txtUpperVersion = getSimpleTextArea(textArea);
    txtUpperVersion.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            Text textWidget = (Text) e.getSource();
            textHandler.accept(textWidget.getText());
        }
    });

    createVersionInclsivnessArea(area, flagHandler);
}
WidgetUtility.java 文件源码 项目:Hydrograph 阅读 24 收藏 0 点赞 0 评论 0
public static void addVerifyListnerToOutputEditingSupport(JoinMappingEditingSupport outputEditingSupport) {
    ((Text)outputEditingSupport.getEditor().getControl()).addVerifyListener(new VerifyListener() {

        @Override
        public void verifyText(VerifyEvent e) {
            String text=e.text;
            Matcher matcher=Pattern.compile(Constants.REGEX).matcher(text);

            if(matcher.matches()){
                e.doit=true;
            }else{
                e.doit=false;
            }
        }
    });
}
FTPAuthenticEditorUtility.java 文件源码 项目:Hydrograph 阅读 22 收藏 0 点赞 0 评论 0
/**
 * @param container
 * @return
 */
public Control addIdKeyComposite(Composite container, FTPAuthOperationDetails authOperationDetails) {
    Composite keyFileComposite = new Composite(container, SWT.BORDER);
    keyFileComposite.setLayout(new GridLayout(3, false));
    keyFileComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));

    FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
    ftpWidgetUtility.createLabel(keyFileComposite, "User ID");
    ftpWidgetUtility.createText(keyFileComposite, "", SWT.BORDER);
    Button keyFileBrwsBtn1 = new Button(keyFileComposite, SWT.NONE);
    keyFileBrwsBtn1.setVisible(false);

    ftpWidgetUtility.createLabel(keyFileComposite, "Public/Private Key");
    Text privateKeyTxt = (Text) ftpWidgetUtility.createText(keyFileComposite, "", SWT.BORDER);
    Button keyFileBrwsBtn = new Button(keyFileComposite, SWT.NONE);
    keyFileBrwsBtn.setText("...");

    selectionListener(keyFileBrwsBtn, privateKeyTxt);

    return keyFileComposite;
}
FTPAuthenticEditorUtility.java 文件源码 项目:Hydrograph 阅读 22 收藏 0 点赞 0 评论 0
/**
 * @param control
 * @return
 */
public Control addBasicAuthKeyComposite(Composite control, FTPAuthOperationDetails authOperationDetails){
    Composite basicAuthKeyComposite = new Composite(control, SWT.BORDER);
    basicAuthKeyComposite.setLayout(new GridLayout(3, false));
    basicAuthKeyComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));

    FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
    ftpWidgetUtility.createLabel(basicAuthKeyComposite, "User ID");
    ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.BORDER);
    new Button(basicAuthKeyComposite, SWT.NONE).setVisible(false);

    ftpWidgetUtility.createLabel(basicAuthKeyComposite, "Password");
    ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.PASSWORD|SWT.BORDER);
    new Button(basicAuthKeyComposite, SWT.NONE).setVisible(false);

    ftpWidgetUtility.createLabel(basicAuthKeyComposite, "Public/Private Key");
    Text privateKeyTxt = (Text) ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.BORDER);
    Button keyFileBrwsBtn = new Button(basicAuthKeyComposite, SWT.NONE);
    keyFileBrwsBtn.setText("...");

    selectionListener(keyFileBrwsBtn, privateKeyTxt);

    return basicAuthKeyComposite;
}
ExpressionComposite.java 文件源码 项目:Hydrograph 阅读 24 收藏 0 点赞 0 评论 0
private void createSimpleIdTextBox(Composite composite_1) {
    Composite composite = new Composite(composite_1, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_composite.heightHint = 29;
    composite.setLayoutData(gd_composite);

    idTextBox = new Text(composite, SWT.BORDER);
    idTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    idTextBox.setText(expressionDataStructure.getId());
    idTextBox.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            expressionDataStructure.setId(idTextBox.getText());
            dialog.refreshErrorLogs();
        }
    });

}
ZooKeeperServerNewWizardPage1.java 文件源码 项目:eZooKeeper 阅读 18 收藏 0 点赞 0 评论 0
@Override
public boolean canFlipToNextPage() {

    ZooKeeperServerNewWizardPage2 jmxPage = (ZooKeeperServerNewWizardPage2) getNextPage();

    if (jmxPage != null) {
        GridComposite jmxPageGridComposite = jmxPage.getGridComposite();

        if (jmxPageGridComposite != null) {

            String hostPortString = getHost() + ":" + String.valueOf(ZooKeeperServerDescriptor.DEFAULT_JMX_PORT);
            String defaultJmxServiceUrlString = "service:jmx:rmi:///jndi/rmi://" + hostPortString + "/jmxrmi";

            Text jmxUrlText = (Text) jmxPageGridComposite
                    .getControl(ZooKeeperServerNewWizardPage2.CONTROL_NAME_JMX_URL_TEXT);

            if (jmxUrlText != null && !jmxUrlText.isDisposed()) {
                jmxUrlText.setText(defaultJmxServiceUrlString);
            }
        }
    }

    return super.canFlipToNextPage();
}
ZnodeNewWizardComposite1.java 文件源码 项目:eZooKeeper 阅读 18 收藏 0 点赞 0 评论 0
public Znode getZnode() throws Exception {

        byte[] data = getZnodeData();

        ZnodeModel parentZnodeModel = getParentZnodeModel();

        Text pathText = (Text) getControl(CONTROL_NAME_PATH_TEXT);
        String relativePath = pathText.getText();
        Znode parentZnode = parentZnodeModel.getData();
        String parentPath = parentZnode.getPath();
        String absolutePath = Znode.getAbsolutePath(parentPath, relativePath);

        Button sequentialCheckbox = (Button) getControl(CONTROL_NAME_CREATE_MODE_SEQUENTIAL_BUTTON);
        boolean isSequential = sequentialCheckbox.getSelection();

        Button ephemeralRadioButton = (Button) getControl(CONTROL_NAME_CREATE_MODE_EPHEMERAL_BUTTON);
        boolean isEphemeral = ephemeralRadioButton.getSelection();

        Znode znode = new Znode(absolutePath);
        znode.setSequential(isSequential);
        znode.setEphemeral(isEphemeral);
        znode.setData(data);

        return znode;
    }
ZnodeNewWizardComposite1.java 文件源码 项目:eZooKeeper 阅读 22 收藏 0 点赞 0 评论 0
@Override
public byte[] getZnodeData() throws Exception {
    Text filePathText = (Text) getControl(CONTROL_NAME_DATA_FILE_TEXT);
    String filePath = filePathText.getText();
    File file = new File(filePath);
    String fileName = file.getName();
    if (!file.exists()) {
        throw new IOException("File '" + fileName + "' does not exist.");
    }

    if (!file.isFile()) {
        throw new IOException("Path '" + filePath + "' is not a valid file.");
    }

    long length = file.length();

    if (length > Znode.MAX_DATA_SIZE) {
        throw new Exception("File '" + fileName
                + "' size is greater than the maximum allowed Znode data size (" + Znode.MAX_DATA_SIZE
                + " bytes).");
    }

    FileEditor fileEditor = new FileEditor(file);
    return fileEditor.read();
}
OperationComposite.java 文件源码 项目:Hydrograph 阅读 26 收藏 0 点赞 0 评论 0
private void createSimpleIdTextBox(Composite composite_1) {
    Composite composite = new Composite(composite_1, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_composite.heightHint = 29;
    composite.setLayoutData(gd_composite);

    idTextBox = new Text(composite, SWT.BORDER);
    idTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    idTextBox.setText(operationDataStructure.getId());
    idTextBox.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            operationDataStructure.setId(idTextBox.getText());
            dialog.refreshErrorLogs();
        }
    });

}
FilterAdvancedComposite.java 文件源码 项目:neoscada 阅读 30 收藏 0 点赞 0 评论 0
private Text createAttributeText ( final String attribute )
{
    final Text t = new Text ( this, SWT.BORDER );
    final Fields field = Fields.byField ( attribute );
    if ( field == null )
    {
        t.setEditable ( true );
        t.setMessage ( Messages.custom_field );
    }
    else
    {
        t.setEditable ( false );
        t.setText ( field.getName () );
    }
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        };
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
FilterAdvancedComposite.java 文件源码 项目:neoscada 阅读 26 收藏 0 点赞 0 评论 0
private Text createValueText ()
{
    final Text t = new Text ( this, SWT.BORDER );
    t.setMessage ( Messages.argument );
    t.addKeyListener ( new KeyAdapter () {
        @Override
        public void keyReleased ( final KeyEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 132;
    t.setLayoutData ( rowData );
    return t;
}
NewObjectWizard.java 文件源码 项目:pgcodekeeper 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void createControl(Composite parent) {
    Composite area = new Composite(parent, SWT.NONE);
    area.setLayout(new GridLayout(2, false));
    area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    new Label(area, SWT.NONE).setText(Messages.PgObject_project_name);
    viewerProject = new ComboViewer(area, SWT.READ_ONLY | SWT.DROP_DOWN);

    new Label(area, SWT.NONE).setText(Messages.PgObject_object_type);
    viewerType = new ComboViewer(area, SWT.READ_ONLY | SWT.DROP_DOWN);

    new Label(area, SWT.NONE).setText(Messages.PgObject_object_name);
    final Text txtName = new Text(area, SWT.BORDER);
    txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    txtName.addModifyListener(e -> {
        name = txtName.getText();
        getWizard().getContainer().updateButtons();
    });
    fillProjects();
    fillTypes();
    setControl(area);
}
HttpTriggerXpathEditorComposite.java 文件源码 项目:convertigo-eclipse 阅读 20 收藏 0 点赞 0 评论 0
/**
 * This method initializes this
 * 
 */
private void initialize() {
    XpathTrigger trigger = (parent.getTrigger() instanceof XpathTrigger)?(XpathTrigger)parent.getTrigger():null;
       GridData gridData2 = new GridData();
       gridData2.horizontalAlignment = GridData.FILL;
       gridData2.grabExcessHorizontalSpace = true;
       gridData2.verticalAlignment = GridData.CENTER;
       GridLayout gridLayout = new GridLayout();
       gridLayout.numColumns = 2;
       this.setLayout(gridLayout);
       xpath_label = new Label(this, SWT.NONE);
       xpath_label.setText("Waiting for Xpath");
       xpath_txt = new Text(this, SWT.BORDER);
       xpath_txt.setText( (trigger!=null)? trigger.getXPath():"");
       xpath_txt.setLayoutData(gridData2);
       xpath_txt.setSize(600, 50);
}
TextEditorComposite.java 文件源码 项目:convertigo-eclipse 阅读 29 收藏 0 点赞 0 评论 0
private void initialize() {
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    GridData gridData = new org.eclipse.swt.layout.GridData();
    gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;

    //minimum size (when dialog open)
    gridData.minimumHeight = 200;
    gridData.minimumWidth = 300;

    this.setLayout(gridLayout);
    textArea = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    textArea.setFont(new Font(null,"Tahoma",10,0));
    textArea.setLayoutData(gridData);
}
DebugDataViewer.java 文件源码 项目:Hydrograph 阅读 29 收藏 0 点赞 0 评论 0
private void createJumpPageTextBox(Composite composite_3) {
    Text jumpPageTextBox = new Text(composite_3, SWT.BORDER);
    jumpPageTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    jumpPageTextBox.addVerifyListener(new VerifyListener() {
        @Override
        public void verifyText(VerifyEvent e) {
            String currentText = ((Text) e.widget).getText();
            String pageNumberText = currentText.substring(0, e.start) + e.text + currentText.substring(e.end);
            try {
                long pageNumber = Long.valueOf(pageNumberText);
                if (pageNumber < 1) {
                    e.doit = false;
                }
            } catch (NumberFormatException ex) {
                if (!pageNumberText.equals(""))
                    e.doit = false;
            }
        }
    });

    dataViewerListeners.attachJumpPageListener(jumpPageTextBox);
    windowControls.put(ControlConstants.JUMP_TEXT, jumpPageTextBox);

}
ExecutionTrackingPreferanceComposite.java 文件源码 项目:Hydrograph 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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);
            }
        }
    }
}
ELTFocusGainedListener.java 文件源码 项目:Hydrograph 阅读 20 收藏 0 点赞 0 评论 0
@Override
public Listener getListener(
        PropertyDialogButtonBar propertyDialogButtonBar,
        ListenerHelper helper, Widget... widgets) {
    final Widget[] widgetList = widgets;
    if (helper != null) {
        txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
    }

    Listener listener = new Listener() {

        @Override
        public void handleEvent(Event event) {
            String charSet = ((Text) widgetList[0]).getText().trim();
            if (event.type == SWT.FocusIn) {
                ((Text) widgetList[0]).setText(charSet.replace("@{", "").replace("}", ""));
            }
        }
    };

    return listener;
}
SelectionDatabaseWidget.java 文件源码 项目:Hydrograph 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Applies multiple listeners to textBoxes 
 * @param widgetList
 * @return
 */
private ModifyListener attachTextModifyListner(final ArrayList<AbstractWidget> widgetList) {
    return new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent event) {
            Text text = (Text)event.getSource();
            if(((Button) tableNameRadioButton.getSWTWidgetControl()).getSelection()){
                databaseSelectionConfig.setTableName(text.getText());
            }else{
                databaseSelectionConfig.setSqlQuery(text.getText());
            }
            Utils.INSTANCE.addMouseMoveListener(sqlQueryTextBox, cursor);
            Utils.INSTANCE.addMouseMoveListener(textBoxTableName, cursor);
            showHideErrorSymbol(widgetList);
        }
    };
}
DSPMainTab.java 文件源码 项目:dsp4e 阅读 20 收藏 0 点赞 0 评论 0
private void createDebugJSonComponent(Composite parent) {
    Composite comp = new Group(parent, SWT.NONE);
    comp.setLayout(new GridLayout());
    comp.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label jsonLabel = new Label(comp, SWT.NONE);
    jsonLabel.setText("&Launch Parameters (Json):");
    jsonLabel.setLayoutData(new GridData(GridData.BEGINNING));

    jsonText = new Text(comp, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    jsonText.setLayoutData(new GridData(GridData.FILL_BOTH));
    jsonText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            updateLaunchConfigurationDialog();
        }
    });

}
UrlMappingWizardPage.java 文件源码 项目:convertigo-eclipse 阅读 20 收藏 0 点赞 0 评论 0
public void createControl(Composite parent) {
    container = new Composite(parent, SWT.NULL);
    GridLayout gridLayout = new GridLayout();
    gridLayout.verticalSpacing = 10;
    container.setLayout(gridLayout);

    Label label = new Label(container, SWT.NONE);
    label.setText("Please enter the Convertigo api path of the mapping\n");

    mappingPath = new Text(container, SWT.BORDER | SWT.SINGLE);
    mappingPath.setFont(new Font(container.getDisplay(), "Tahoma", 10, 0));
    mappingPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mappingPath.setText("/");
    mappingPath.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });

    setControl(container);
}
SuffixText.java 文件源码 项目:n4js 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Create the suffix text.
 *
 * @param parent
 *            Parent composite
 * @param style
 *            additional style configuration
 */
public SuffixText(Composite parent, int style) {
    super(parent, style);
    this.setLayout(new SuffixLayout());

    suffixText = createSuffixText();
    editableText = new Text(this, SWT.NONE);

    configureListeners();

    this.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    this.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_IBEAM));
}
FTPProtocolWidget.java 文件源码 项目:Hydrograph 阅读 24 收藏 0 点赞 0 评论 0
private void validateTextWidget(Text text, boolean isEnable, ControlDecoration controlDecoration, Color color){
    text.setText("");
    text.setEnabled(isEnable);
    if(!isEnable){
        controlDecoration.hide();
    }
    text.setBackground(color);
}
NameComponent.java 文件源码 项目:n4js 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Creates a new class name component.
 *
 * @param model
 *            The model to bind it to
 * @param container
 *            The container to place it in
 */
public NameComponent(NamedModel model, WizardComponentContainer container) {
    super(container);
    this.model = model;

    Label classNameLabel = new Label(getParentComposite(), SWT.NONE);
    classNameLabel.setText("Name:");

    nameText = new Text(getParentComposite(), SWT.BORDER);
    nameText.setLayoutData(fillTextDefaults());

    WizardComponentUtils.emptyGridCell(container.getComposite());

    setupBindings();
}
ProgressBarDialog.java 文件源码 项目:RefDiff 阅读 31 收藏 0 点赞 0 评论 0
private Control createDialogArea(Composite shell) {
       GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    shell.setLayout(layout);

    lblStep = new Label(shell, SWT.NONE);
    lblStep.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    lblStep.setText("Step 1 / 999");

    lblMessage = new Label(shell, SWT.NONE);
    lblMessage.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    lblMessage.setText("Idle");

    pbProg = new ProgressBar(shell, SWT.SMOOTH | SWT.INDETERMINATE);
    pbProg.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    pbProg.setMaximum(1000);
    pbProg.setSelection(0);
    pbProg.setSelection(256);

    final Label lblSeparator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    lblSeparator.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

    txtLog = new Text(shell, SWT.MULTI
              | SWT.BORDER
              | SWT.H_SCROLL
              | SWT.V_SCROLL);
    txtLog.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    txtLog.setEditable(false);
    txtLog.setBackground(new Color(shell.getDisplay(), 10,10,10));
    txtLog.setForeground(new Color(shell.getDisplay(), 200,200,200));

    shell.layout();

    return shell;
}
HiveInputExtractMetaStoreDialog.java 文件源码 项目:Hydrograph 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {

    getShell().setText("Credentials Required");

    Composite container = (Composite) super.createDialogArea(parent);
    container.getLayout();


    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayout(new GridLayout(4, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);

    Label lblUserName = new Label(composite, SWT.NONE);
    lblUserName.setText("User Name");
    new Label(composite, SWT.NONE);

    username = new Text(composite, SWT.BORDER);
    username.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(composite, SWT.NONE);

    Label lblPassword = new Label(composite, SWT.NONE);
    lblPassword.setText("Password");
    new Label(composite, SWT.NONE);

    password = new Text(composite, SWT.PASSWORD|SWT.BORDER);
    password.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    createErrorComposite(container);

    return container;
}


问题


面经


文章

微信
公众号

扫码关注公众号