Search in sources :

Example 1 with DevelopmentStatus

use of org.talend.cwm.constants.DevelopmentStatus in project tdq-studio-se by Talend.

the class AbstractMetadataFormPage method creatMetadataSection.

protected Section creatMetadataSection(final ScrolledForm currentform, Composite parentCom) {
    Section section = createSection(currentform, topComp, getMetadataSectionTitle(), getMetadataSectionDescription());
    Composite parent = toolkit.createComposite(section);
    parent.setLayout(new GridLayout(2, false));
    // $NON-NLS-1$
    nameText = createMetadataTextFiled(DefaultMessagesImpl.getString("AbstractMetadataFormPage.name"), parent);
    // set the max number of characters to be entered in the text field
    // ADDED sgandon 16/03/2010 bug 11760
    nameText.setTextLimit(EmfHelper.getStringMaxSize(CorePackage.Literals.MODEL_ELEMENT__NAME, MAX_TEXT_FIELD_STRING_SIZE_FOR_USUAL_STRING));
    // $NON-NLS-1$
    purposeText = createMetadataTextFiled(DefaultMessagesImpl.getString("AbstractMetadataFormPage.purpose"), parent);
    // set the max number of characters to be entered in the text field
    // ADDED sgandon 16/03/2010 bug 11760
    purposeText.setTextLimit(TaggedValueHelper.getStringMaxSize(TaggedValueHelper.PURPOSE, MAX_TEXT_FIELD_STRING_SIZE_FOR_USUAL_STRING));
    // description fields
    // ADDED sgandon 16/03/2010 bug 11760
    // $NON-NLS-1$
    toolkit.createLabel(parent, DefaultMessagesImpl.getString("AbstractMetadataFormPage.description"));
    descriptionText = toolkit.createText(parent, null, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    GridDataFactory.fillDefaults().hint(META_FIELD_WIDTH, 60).applyTo(descriptionText);
    // set the max number of characters to be entered in the text field
    descriptionText.setTextLimit(TaggedValueHelper.getStringMaxSize(TaggedValueHelper.DESCRIPTION, MAX_TEXT_FIELD_STRING_SIZE_FOR_USUAL_STRING));
    // $NON-NLS-1$
    authorText = createMetadataTextFiled(DefaultMessagesImpl.getString("AbstractMetadataFormPage.author"), parent);
    // ADDED 2010-04-01 sgandon bug 11760 : author size limitation
    authorText.setTextLimit(TaggedValueHelper.getStringMaxSize(TaggedValueHelper.AUTHOR, MAX_TEXT_FIELD_STRING_SIZE_FOR_USUAL_STRING));
    // MOD 2009-09-08 yyi Feature: 8870.
    if (!ReponsitoryContextBridge.isDefautProject()) {
        authorText.setEnabled(false);
        authorText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    }
    // $NON-NLS-1$
    toolkit.createLabel(parent, DefaultMessagesImpl.getString("AbstractMetadataFormPage.status"));
    statusCombo = new CCombo(parent, SWT.BORDER);
    statusCombo.setEditable(false);
    // MOD mzhao feature 7479 2009-10-16
    String statusValue = getProperty() != null ? getProperty().getStatusCode() : DevelopmentStatus.DRAFT.getLiteral();
    List<org.talend.core.model.properties.Status> statusList = MetadataHelper.getTechnicalStatus();
    if (statusList != null && statusList.size() > 0) {
        List<String> statusArray = MetadataHelper.toArray(statusList);
        String[] tempString = new String[statusList.size()];
        statusCombo.setItems(statusArray.toArray(tempString));
        if (statusArray.contains(statusValue)) {
            statusCombo.remove(statusValue);
            statusCombo.add(statusValue, 0);
        }
    } else {
        for (DevelopmentStatus status : DevelopmentStatus.values()) {
            statusCombo.add(status.getLiteral());
        }
        // statusCombo.remove(statusValue);
        statusCombo.add(statusValue, 0);
    }
    initMetaTextFied();
    nameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            // boolean dirty = isDirty();
            if (!isRefreshText) {
                modify = true;
                setDirty(true);
                // MOD msjian 2011-7-18 23216: when changed the name of a connection to null, write a warning
                // $NON-NLS-1$
                String NAMECONNOTBEEMPTY = DefaultMessagesImpl.getString("AbstractMetadataFormPage.nameCannotBeEmpty");
                if (PluginConstant.EMPTY_STRING.equals(nameText.getText())) {
                    getManagedForm().getMessageManager().addMessage(NAMECONNOTBEEMPTY, NAMECONNOTBEEMPTY, null, IMessageProvider.ERROR, nameText);
                } else {
                    getManagedForm().getMessageManager().removeMessage(NAMECONNOTBEEMPTY, nameText);
                }
            }
        }
    });
    purposeText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setDirty(true);
        // fireTextChange();
        }
    });
    descriptionText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setDirty(true);
        // fireTextChange();
        }
    });
    authorText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setDirty(true);
        // fireTextChange();
        }
    });
    statusCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setDirty(true);
        // fireTextChange();
        }
    });
    addWhitespaceValidate(nameText, purposeText, descriptionText, authorText, purposeText);
    section.setClient(parent);
    return section;
}
Also used : DevelopmentStatus(org.talend.cwm.constants.DevelopmentStatus) Composite(org.eclipse.swt.widgets.Composite) ContextComposite(org.talend.dataprofiler.core.ui.editor.composite.ContextComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) Section(org.eclipse.ui.forms.widgets.Section) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) CCombo(org.eclipse.swt.custom.CCombo) DevelopmentStatus(org.talend.cwm.constants.DevelopmentStatus)

Example 2 with DevelopmentStatus

use of org.talend.cwm.constants.DevelopmentStatus in project tdq-studio-se by Talend.

the class MetadataWizardPage method createControl.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.wizard.PropertiesWizardPage#createControl
     * (org.eclipse.swt.widgets.Composite)
     */
public void createControl(Composite parent) {
    if (getParameter().getFolderProvider() == null || getParameter().getFolderProvider().isNull()) {
        FolderProvider defaultFolder = new FolderProvider();
        defaultFolder.setFolderResource(getStoredFolder());
        getParameter().setFolderProvider(defaultFolder);
    }
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout gdLayout = new GridLayout(2, false);
    container.setLayout(gdLayout);
    GridData data;
    // Name
    Label nameLab = new Label(container, SWT.NONE);
    // $NON-NLS-1$
    nameLab.setText(DefaultMessagesImpl.getString("MetadataWizardPage.name"));
    nameText = new Text(container, SWT.BORDER);
    nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // set the max number of characters to be entered in the text field
    // ADDED sgandon 16/03/2010 bug 11760
    nameText.setTextLimit(EmfHelper.getStringMaxSize(CorePackage.Literals.MODEL_ELEMENT__NAME, TEXT_FIELD_DEFAULT_MAX_CHAR_LIMIT));
    // Purpose
    Label purposeLab = new Label(container, SWT.NONE);
    // $NON-NLS-1$
    purposeLab.setText(DefaultMessagesImpl.getString("MetadataWizardPage.purpose"));
    purposeText = new Text(container, SWT.BORDER);
    purposeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // set the max number of characters to be entered in the text field
    // ADDED sgandon 16/03/2010 bug 11760
    purposeText.setTextLimit(TaggedValueHelper.getStringMaxSize(TaggedValueHelper.PURPOSE, TEXT_FIELD_DEFAULT_MAX_CHAR_LIMIT));
    // Description
    Label descriptionLab = new Label(container, SWT.NONE);
    // $NON-NLS-1$
    descriptionLab.setText(DefaultMessagesImpl.getString("MetadataWizardPage.description"));
    descriptionLab.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    descriptionText = new Text(container, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = 60;
    descriptionText.setLayoutData(data);
    // set the max number of characters to be entered in the text field
    descriptionText.setTextLimit(TaggedValueHelper.getStringMaxSize(TaggedValueHelper.DESCRIPTION, TEXT_FIELD_DEFAULT_MAX_CHAR_LIMIT));
    // Author
    Label authorLab = new Label(container, SWT.NONE);
    // $NON-NLS-1$
    authorLab.setText(DefaultMessagesImpl.getString("MetadataWizardPage.author"));
    authorText = new Text(container, SWT.BORDER);
    authorText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    authorText.setTextLimit(TaggedValueHelper.getStringMaxSize(TaggedValueHelper.AUTHOR, TEXT_FIELD_DEFAULT_MAX_CHAR_LIMIT));
    String author = ReponsitoryContextBridge.getAuthor();
    authorText.setText(author);
    getParameter().setAuthor(author);
    // MOD 2016-10-19 xqliu TDQ-12692 change the author field to read-only always
    // both TDQ and TOS for DQ, the author field should be read-only
    authorText.setEnabled(false);
    // Version
    // Label versionLab = new Label(container, SWT.NONE);
    // versionLab.setText("Version");
    // 
    // Composite versionContainer = new Composite(container, SWT.NONE);
    // versionContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // GridLayout versionLayout = new GridLayout(3, false);
    // versionLayout.marginHeight = 0;
    // versionLayout.marginWidth = 0;
    // versionLayout.horizontalSpacing = 0;
    // versionContainer.setLayout(versionLayout);
    // 
    // versionText = new Text(versionContainer, SWT.BORDER);
    // versionText.setEnabled(false);
    // versionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // versionText.setText(getParameter().getVersion());
    // 
    // versionMajorBtn = new Button(versionContainer, SWT.PUSH);
    // versionMajorBtn.setText("M");
    // 
    // versionMinorBtn = new Button(versionContainer, SWT.PUSH);
    // versionMinorBtn.setText("m"); //$NON-NLS-1$
    // Status
    Label statusLab = new Label(container, SWT.NONE);
    // $NON-NLS-1$
    statusLab.setText("Status");
    statusText = new CCombo(container, SWT.BORDER);
    // statusText.setText(DevelopmentStatus.DRAFT.getLiteral());
    statusText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    statusText.setEditable(false);
    // MOD mzhao feature 7479 2009-10-12
    List<org.talend.core.model.properties.Status> statusList = MetadataHelper.getTechnicalStatus();
    if (statusList != null && statusList.size() > 0) {
        String[] tempString = new String[statusList.size()];
        statusText.setItems(MetadataHelper.toArray(statusList).toArray(tempString));
    } else {
        for (DevelopmentStatus status : DevelopmentStatus.values()) {
            statusText.add(status.getLiteral());
        }
    }
    statusText.select(0);
    getParameter().setStatus(statusText.getText());
    // Path:
    Label pathLab = new Label(container, SWT.NONE);
    // $NON-NLS-1$
    pathLab.setText("Path");
    Composite pathContainer = new Composite(container, SWT.NONE);
    pathContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout pathLayout = new GridLayout(2, false);
    pathLayout.marginHeight = 0;
    pathLayout.marginWidth = 0;
    pathLayout.horizontalSpacing = 0;
    pathContainer.setLayout(pathLayout);
    pathText = new Text(pathContainer, SWT.BORDER);
    pathText.setEnabled(false);
    pathText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button = new Button(pathContainer, SWT.PUSH);
    // $NON-NLS-1$
    button.setText(DefaultMessagesImpl.getString("MetadataWizardPage.select"));
    createExtendedControl(container);
    addListeners();
    setControl(container);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) DevelopmentStatus(org.talend.cwm.constants.DevelopmentStatus) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FolderProvider(org.talend.cwm.management.api.FolderProvider) GridLayout(org.eclipse.swt.layout.GridLayout) CCombo(org.eclipse.swt.custom.CCombo) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) DevelopmentStatus(org.talend.cwm.constants.DevelopmentStatus)

Aggregations

CCombo (org.eclipse.swt.custom.CCombo)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 DevelopmentStatus (org.talend.cwm.constants.DevelopmentStatus)2 IStatus (org.eclipse.core.runtime.IStatus)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 GridData (org.eclipse.swt.layout.GridData)1 Button (org.eclipse.swt.widgets.Button)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 Section (org.eclipse.ui.forms.widgets.Section)1 FolderProvider (org.talend.cwm.management.api.FolderProvider)1 ContextComposite (org.talend.dataprofiler.core.ui.editor.composite.ContextComposite)1