Search in sources :

Example 1 with AbstractForm

use of org.talend.metadata.managment.ui.wizard.AbstractForm in project tdi-studio-se by Talend.

the class FTPPage method createControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
     */
@Override
public void createControl(Composite parent) {
    ftpForm = new FTPForm(parent, connectionItem, existingNames, this);
    ftpForm.setReadOnly(!isRepositoryObjectEditable);
    AbstractForm.ICheckListener listener = new AbstractForm.ICheckListener() {

        @Override
        public void checkPerformed(final AbstractForm source) {
            if (source.isStatusOnError()) {
                FTPPage.this.setPageComplete(false);
                setErrorMessage(source.getStatus());
            } else {
                FTPPage.this.setPageComplete(isRepositoryObjectEditable);
                setErrorMessage(null);
                setMessage(source.getStatus(), source.getStatusLevel());
            }
        }
    };
    ftpForm.setListener(listener);
    setControl(ftpForm);
    if (connectionItem.getProperty().getLabel() != null && !connectionItem.getProperty().getLabel().equals("")) {
        //$NON-NLS-1$
        ftpForm.checkFieldsValue();
    }
}
Also used : FTPForm(org.talend.repository.ftp.ui.wizards.forms.FTPForm) AbstractForm(org.talend.metadata.managment.ui.wizard.AbstractForm)

Example 2 with AbstractForm

use of org.talend.metadata.managment.ui.wizard.AbstractForm in project tdi-studio-se by Talend.

the class JSONFileWizardPage method createControl.

/**
     * 
     * @see IDialogPage#createControl(Composite)
     */
public void createControl(final Composite parent) {
    currentComposite = null;
    if (step == 1) {
        currentComposite = new JSONFileStep1Form(creation, parent, connectionItem, existingNames, (JSONWizard) getWizard());
    } else if (step == 2) {
        currentComposite = new JSONFileStep2Form(parent, connectionItem, (JSONWizard) getWizard());
    } else if (step == 3) {
        MetadataTable metadataTable = ConnectionHelper.getTables(connectionItem.getConnection()).toArray(new MetadataTable[0])[0];
        currentComposite = new JSONFileStep3Form(parent, connectionItem, metadataTable, (JSONWizard) getWizard(), TableHelper.getTableNames(((JSONFileConnection) connectionItem.getConnection()), metadataTable.getLabel()));
    }
    currentComposite.setReadOnly(!isRepositoryObjectEditable);
    currentComposite.setPage(this);
    AbstractForm.ICheckListener listener = new AbstractForm.ICheckListener() {

        public void checkPerformed(final AbstractForm source) {
            if (source.isStatusOnError()) {
                JSONFileWizardPage.this.setPageComplete(false);
                setErrorMessage(source.getStatus());
            } else {
                JSONFileWizardPage.this.setPageComplete(isRepositoryObjectEditable);
                setErrorMessage(null);
                setMessage(source.getStatus());
            }
        }
    };
    currentComposite.setListener(listener);
    setControl((Composite) currentComposite);
}
Also used : JSONFileConnection(org.talend.repository.model.json.JSONFileConnection) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) AbstractForm(org.talend.metadata.managment.ui.wizard.AbstractForm)

Example 3 with AbstractForm

use of org.talend.metadata.managment.ui.wizard.AbstractForm in project tdi-studio-se by Talend.

the class JSONFileOutputWizardPage method createControl.

public void createControl(final Composite parent) {
    currentComposite = null;
    if (step == 1) {
        currentComposite = new JSONFileOutputStep1Form(creation, parent, connectionItem, existingNames);
    } else if (step == 2) {
        currentComposite = new JSONFileOutputStep2Form(creation, parent, connectionItem);
    } else if (step == 3) {
        MetadataTable metadataTable = (MetadataTable) ConnectionHelper.getTables((JSONFileConnection) connectionItem.getConnection()).toArray(new MetadataTable[0])[0];
        currentComposite = new JSONFileOutputStep3Form(parent, connectionItem, metadataTable, TableHelper.getTableNames(((JSONFileConnection) connectionItem.getConnection()), metadataTable.getLabel()));
    }
    currentComposite.setReadOnly(!isRepositoryObjectEditable);
    currentComposite.setPage(this);
    AbstractForm.ICheckListener listener = new AbstractForm.ICheckListener() {

        public void checkPerformed(final AbstractForm source) {
            if (source.isStatusOnError()) {
                JSONFileOutputWizardPage.this.setPageComplete(false);
                setErrorMessage(source.getStatus());
            } else {
                JSONFileOutputWizardPage.this.setPageComplete(isRepositoryObjectEditable);
                setErrorMessage(null);
                setMessage(source.getStatus());
            }
        }
    };
    currentComposite.setListener(listener);
    setControl((Composite) currentComposite);
}
Also used : JSONFileConnection(org.talend.repository.model.json.JSONFileConnection) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) AbstractForm(org.talend.metadata.managment.ui.wizard.AbstractForm)

Example 4 with AbstractForm

use of org.talend.metadata.managment.ui.wizard.AbstractForm in project tdi-studio-se by Talend.

the class FileJSONTableWizardPage method createControl.

/**
     * Create the first composite, addComponentsAndControls and initialize TableWizardPage.
     * 
     * @see IDialogPage#createControl(Composite)
     */
public void createControl(final Composite parent) {
    final AbstractForm.ICheckListener listener = new AbstractForm.ICheckListener() {

        public void checkPerformed(final AbstractForm source) {
            if (source.isStatusOnError()) {
                FileJSONTableWizardPage.this.setPageComplete(false);
                setErrorMessage(source.getStatus());
            } else {
                FileJSONTableWizardPage.this.setPageComplete(isRepositoryObjectEditable);
                setErrorMessage(null);
                setMessage(source.getStatus(), source.getStatusLevel());
            }
        }
    };
    Composite theForm = null;
    Connection connection = null;
    if (metadataTable.getNamespace() != null) {
        if (metadataTable.getNamespace() instanceof Package) {
            Package pkg = (Package) metadataTable.getNamespace();
            if (!pkg.getDataManager().isEmpty()) {
                connection = (Connection) pkg.getDataManager().get(0);
            }
        }
    }
    theForm = (Composite) new JsonSwitch() {

        public Object caseJSONFileConnection(final JSONFileConnection object) {
            JSONFileConnection jsonFileConnection = (JSONFileConnection) connectionItem.getConnection();
            boolean isInputModel = jsonFileConnection.isInputModel();
            if (isInputModel) {
                JSONFileStep3Form xmlFileStep3Form = new JSONFileStep3Form(parent, connectionItem, metadataTable, null, TableHelper.getTableNames(object, metadataTable.getLabel()));
                xmlFileStep3Form.setReadOnly(!isRepositoryObjectEditable);
                xmlFileStep3Form.setListener(listener);
                return xmlFileStep3Form;
            } else {
                JSONFileOutputStep3Form xmlFileOutputStep3Form = new JSONFileOutputStep3Form(parent, connectionItem, metadataTable, TableHelper.getTableNames(object, metadataTable.getLabel()));
                xmlFileOutputStep3Form.setReadOnly(!isRepositoryObjectEditable);
                xmlFileOutputStep3Form.setListener(listener);
                return xmlFileOutputStep3Form;
            }
        }
    }.doSwitch(connection);
    setControl(theForm);
}
Also used : JSONFileConnection(org.talend.repository.model.json.JSONFileConnection) Composite(org.eclipse.swt.widgets.Composite) JsonSwitch(org.talend.repository.model.json.util.JsonSwitch) JSONFileConnection(org.talend.repository.model.json.JSONFileConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) AbstractForm(org.talend.metadata.managment.ui.wizard.AbstractForm) Package(orgomg.cwm.objectmodel.core.Package)

Aggregations

AbstractForm (org.talend.metadata.managment.ui.wizard.AbstractForm)4 JSONFileConnection (org.talend.repository.model.json.JSONFileConnection)3 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)2 Composite (org.eclipse.swt.widgets.Composite)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 FTPForm (org.talend.repository.ftp.ui.wizards.forms.FTPForm)1 JsonSwitch (org.talend.repository.model.json.util.JsonSwitch)1 Package (orgomg.cwm.objectmodel.core.Package)1