Search in sources :

Example 6 with Browser

use of org.eclipse.swt.browser.Browser in project tdi-studio-se by Talend.

the class LoginAgreementPage method createControl.

@Override
public void createControl(Composite parentCtrl) {
    Composite container = new Composite(parentCtrl, SWT.NONE);
    container.setLayout(new FormLayout());
    Label titleLabel = new Label(container, SWT.WRAP);
    titleLabel.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    titleLabel.setText(Messages.getString("LoginAgreementPage.title"));
    FormData titleLabelFormData = new FormData();
    titleLabelFormData.left = new FormAttachment(0, 0);
    titleLabelFormData.top = new FormAttachment(0, 0);
    titleLabel.setLayoutData(titleLabelFormData);
    acceptButton = new Button(container, SWT.CENTER);
    acceptButton.setBackground(backgroundColor);
    acceptButton.setFont(LoginDialogV2.fixedFont);
    //$NON-NLS-1$
    acceptButton.setText(Messages.getString("LoginAgreementPage.accept"));
    FormData acceptButtonFormLayoutData = new FormData();
    acceptButtonFormLayoutData.bottom = new FormAttachment(100, 0);
    acceptButtonFormLayoutData.right = new FormAttachment(100, 0);
    acceptButtonFormLayoutData.left = new FormAttachment(100, -1 * LoginDialogV2.getNewButtonSize(acceptButton).x);
    acceptButton.setLayoutData(acceptButtonFormLayoutData);
    boolean haveHtmlDesc = false;
    FileInputStream licenseInputStream = null;
    String licenseFileBasePath = Platform.getInstallLocation().getURL().getPath();
    if (Boolean.parseBoolean(System.getProperty("USE_BROWSER"))) {
        //$NON-NLS-1$
        File htmlFile = new File(licenseFileBasePath + LICENSE_FILE_PATH_HTML);
        if (htmlFile.exists()) {
            try {
                licenseInputStream = new FileInputStream(htmlFile);
                if (licenseInputStream != null) {
                    haveHtmlDesc = true;
                }
            } catch (FileNotFoundException e) {
                CommonExceptionHandler.process(e);
            }
        }
    }
    if (licenseInputStream == null) {
        try {
            licenseInputStream = new FileInputStream(licenseFileBasePath + LICENSE_FILE_PATH);
        } catch (FileNotFoundException e) {
            CommonExceptionHandler.process(e);
        }
    }
    FormData clufLayoutData = new FormData();
    clufLayoutData.top = new FormAttachment(titleLabel, LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.BOTTOM);
    clufLayoutData.left = new FormAttachment(0, 0);
    clufLayoutData.right = new FormAttachment(100, 0);
    clufLayoutData.bottom = new FormAttachment(acceptButton, -1 * LoginDialogV2.TAB_VERTICAL_PADDING_LEVEL_1, SWT.TOP);
    if (haveHtmlDesc) {
        clufBrowser = new Browser(container, SWT.BORDER);
        clufBrowser.setText(getLicense(licenseInputStream));
        clufBrowser.setLayoutData(clufLayoutData);
    } else {
        clufText = new Text(container, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL | SWT.LEFT | SWT.BORDER);
        clufText.setBackground(new Color(null, 255, 255, 255));
        //$NON-NLS-1$
        Font font = new Font(DisplayUtils.getDisplay(), "courier", 10, SWT.NONE);
        clufText.setFont(font);
        clufText.setEditable(false);
        clufText.setText(getLicense(licenseInputStream));
        clufText.setLayoutData(clufLayoutData);
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) Label(org.eclipse.swt.widgets.Label) FileNotFoundException(java.io.FileNotFoundException) Text(org.eclipse.swt.widgets.Text) FileInputStream(java.io.FileInputStream) Font(org.eclipse.swt.graphics.Font) Button(org.eclipse.swt.widgets.Button) File(java.io.File) FormAttachment(org.eclipse.swt.layout.FormAttachment) Browser(org.eclipse.swt.browser.Browser)

Example 7 with Browser

use of org.eclipse.swt.browser.Browser in project tdi-studio-se by Talend.

the class ImportDemoProjectItemsPage method createDescriptionIn.

/**
     * DOC Administrator Comment method "createDescriptionIn".
     * 
     * @param composite
     */
public void createDescriptionIn(Composite composite) {
    if (TalendPropertiesUtil.isEnabledUseBrowser()) {
        descriptionBrowser = new Browser(composite, SWT.BORDER);
        //$NON-NLS-1$
        descriptionBrowser.setText("");
        GridData gd = new GridData(GridData.FILL_BOTH);
        gd.widthHint = 200;
        descriptionBrowser.setLayoutData(gd);
    } else {
        descriptionText = new Text(composite, SWT.BORDER | SWT.WRAP);
        //$NON-NLS-1$
        descriptionText.setText("");
        GridData gd = new GridData(GridData.FILL_BOTH);
        gd.widthHint = 200;
        descriptionText.setLayoutData(gd);
    }
}
Also used : GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text) Browser(org.eclipse.swt.browser.Browser)

Example 8 with Browser

use of org.eclipse.swt.browser.Browser in project tdi-studio-se by Talend.

the class ImportDemoProjectPage method createDescriptionIn.

/**
     * DOC Administrator Comment method "createDescriptionIn".
     * 
     * @param composite
     */
public void createDescriptionIn(Composite composite) {
    if (TalendPropertiesUtil.isEnabledUseBrowser()) {
        descriptionBrowser = new Browser(composite, SWT.BORDER);
        //$NON-NLS-1$
        descriptionBrowser.setText("");
        GridData gd = new GridData(GridData.FILL_BOTH);
        gd.widthHint = 200;
        descriptionBrowser.setLayoutData(gd);
    } else {
        descriptionText = new Text(composite, SWT.BORDER | SWT.WRAP);
        //$NON-NLS-1$
        descriptionText.setText("");
        GridData gd = new GridData(GridData.FILL_BOTH);
        gd.widthHint = 200;
        descriptionText.setLayoutData(gd);
    }
}
Also used : GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text) Browser(org.eclipse.swt.browser.Browser)

Example 9 with Browser

use of org.eclipse.swt.browser.Browser in project tesb-studio-se by Talend.

the class EsbStartingBrowser method createPartControl.

@Override
public void createPartControl(Composite parent) {
    try {
        browser = new Browser(parent, SWT.NONE);
        browser.setText(EsbStartingHelper.getHelper().getHtmlContent());
        browser.addLocationListener(new BrowserDynamicPartLocationListener());
    } catch (IOException e) {
        ExceptionHandler.process(e);
    } catch (Throwable t) {
        Exception ex = new Exception("The internal web browser can not be access,the starting page won't be displayed");
        ExceptionHandler.process(ex);
    }
}
Also used : BrowserDynamicPartLocationListener(org.talend.commons.ui.html.BrowserDynamicPartLocationListener) IOException(java.io.IOException) IOException(java.io.IOException) Browser(org.eclipse.swt.browser.Browser) StartingBrowser(org.talend.rcp.intro.starting.StartingBrowser)

Example 10 with Browser

use of org.eclipse.swt.browser.Browser in project cubrid-manager by CUBRID.

the class BrowserEditorPart method initBrowser.

private void initBrowser(Composite parent) {
    browser = new Browser(parent, SWT.None);
    browser.setLayoutData(createGridData(FILL_BOTH, 3, 1, -1, -1));
    // Add location change listener
    browser.addLocationListener(new LocationListener() {

        public void changing(LocationEvent e) {
            location.setText(e.location);
        }

        public void changed(LocationEvent e) {
            noOp();
        }
    });
    // Add loading listener
    browser.addProgressListener(new ProgressListener() {

        // Set stopItem and progress bar status
        public void changed(ProgressEvent e) {
            if (!stopItem.isEnabled() && e.total != e.current) {
                stopItem.setEnabled(true);
            }
        }

        // Set stopItem,backItem,forwardItem and progress bar status
        public void completed(ProgressEvent e) {
            stopItem.setEnabled(false);
            backItem.setEnabled(browser.isBackEnabled());
            forwardItem.setEnabled(browser.isForwardEnabled());
        }
    });
}
Also used : ProgressListener(org.eclipse.swt.browser.ProgressListener) LocationListener(org.eclipse.swt.browser.LocationListener) ProgressEvent(org.eclipse.swt.browser.ProgressEvent) LocationEvent(org.eclipse.swt.browser.LocationEvent) Browser(org.eclipse.swt.browser.Browser)

Aggregations

Browser (org.eclipse.swt.browser.Browser)19 GridData (org.eclipse.swt.layout.GridData)10 Composite (org.eclipse.swt.widgets.Composite)10 GridLayout (org.eclipse.swt.layout.GridLayout)7 Label (org.eclipse.swt.widgets.Label)5 IOException (java.io.IOException)4 URL (java.net.URL)4 LocationEvent (org.eclipse.swt.browser.LocationEvent)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 Button (org.eclipse.swt.widgets.Button)4 FillLayout (org.eclipse.swt.layout.FillLayout)3 Text (org.eclipse.swt.widgets.Text)3 PartInitException (org.eclipse.ui.PartInitException)3 LocationAdapter (org.eclipse.swt.browser.LocationAdapter)2 LocationListener (org.eclipse.swt.browser.LocationListener)2 IWebBrowser (org.eclipse.ui.browser.IWebBrowser)2 IWorkbenchBrowserSupport (org.eclipse.ui.browser.IWorkbenchBrowserSupport)2 JpmPreferences (bndtools.preferences.JpmPreferences)1 HttpResponse (com.microsoft.azure.hdinsight.sdk.common.HttpResponse)1