Search in sources :

Example 11 with BooleanFieldEditor

use of de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor in project janrufmonitor by tbrandt77.

the class TwitterService method createFieldEditors.

protected void createFieldEditors() {
    super.createFieldEditors();
    BooleanFieldEditor bfe = new BooleanFieldEditor(this.getConfigNamespace() + SEPARATOR + "incoming", this.m_i18n.getString(this.getNamespace(), "incoming", "label", this.m_language), this.getFieldEditorParent());
    addField(bfe);
    StringFieldEditor sfe = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "inmessage", this.m_i18n.getString(this.getNamespace(), "inmessage", "label", this.m_language), this.getFieldEditorParent());
    sfe.setEmptyStringAllowed(false);
    sfe.setTextLimit(160);
    addField(sfe);
    bfe = new BooleanFieldEditor(this.getConfigNamespace() + SEPARATOR + "outgoing", this.m_i18n.getString(this.getNamespace(), "outgoing", "label", this.m_language), this.getFieldEditorParent());
    addField(bfe);
    sfe = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "outmessage", this.m_i18n.getString(this.getNamespace(), "outmessage", "label", this.m_language), this.getFieldEditorParent());
    sfe.setEmptyStringAllowed(false);
    sfe.setTextLimit(160);
    addField(sfe);
    if (getRuntime().getConfigManagerFactory().getConfigManager().getProperty("service.TwitterService", "auth1").length() == 0 || getRuntime().getConfigManagerFactory().getConfigManager().getProperty("service.TwitterService", "auth2").length() == 0) {
        Button authenticate = new Button(this.getFieldEditorParent(), SWT.PUSH);
        authenticate.setText(this.m_i18n.getString(this.getNamespace(), "auth", "label", this.m_language));
        authenticate.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent arg0) {
            }

            public void widgetSelected(SelectionEvent arg0) {
                ICommand c = getRuntime().getCommandFactory().getCommand("TwitterPINCommand");
                if (c != null && c.isExecutable()) {
                    try {
                        c.execute();
                    } catch (Exception ex) {
                        m_logger.log(Level.SEVERE, ex.getMessage(), ex);
                    }
                }
            }
        });
    } else {
        final Label l = new Label(this.getFieldEditorParent(), SWT.NORMAL);
        l.setText(this.m_i18n.getString(this.getNamespace(), "isauth", "label", this.m_language));
        GridData gd = new GridData();
        gd.horizontalSpan = 2;
        gd.widthHint = 500;
        l.setLayoutData(gd);
        Button unauthenticate = new Button(this.getFieldEditorParent(), SWT.PUSH);
        unauthenticate.setLayoutData(gd);
        unauthenticate.setText(this.m_i18n.getString(this.getNamespace(), "unauth", "label", this.m_language));
        unauthenticate.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent arg0) {
            }

            public void widgetSelected(SelectionEvent arg0) {
                getRuntime().getConfigManagerFactory().getConfigManager().setProperty("service.TwitterService", "auth1", "");
                getRuntime().getConfigManagerFactory().getConfigManager().setProperty("service.TwitterService", "auth2", "");
                getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration();
                l.setText(m_i18n.getString(getNamespace(), "isnotauth", "label", m_language));
            }
        });
    }
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) Button(org.eclipse.swt.widgets.Button) ICommand(de.janrufmonitor.framework.command.ICommand) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) BooleanFieldEditor(de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 12 with BooleanFieldEditor

use of de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor in project janrufmonitor by tbrandt77.

the class XTapi method createFieldEditors.

protected void createFieldEditors() {
    StringFieldEditor sfe = null;
    BooleanFieldEditor bfe = new BooleanFieldEditor(getConfigNamespace() + SEPARATOR + "activemonitor", this.m_i18n.getString(this.getNamespace(), "activemonitor", "label", this.m_language), this.getFieldEditorParent());
    addField(bfe);
    if (isExpertMode()) {
        bfe = new BooleanFieldEditor(getConfigNamespace() + SEPARATOR + "outgoing", this.m_i18n.getString(this.getNamespace(), "outgoing", "label", this.m_language), this.getFieldEditorParent());
        addField(bfe);
        bfe = new BooleanFieldEditor(getConfigNamespace() + SEPARATOR + "deviceid", this.m_i18n.getString(this.getNamespace(), "deviceid", "label", this.m_language), this.getFieldEditorParent());
        addField(bfe);
        sfe = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "festnetzalias", this.m_i18n.getString(this.getNamespace(), "festnetzalias", "label", this.m_language), this.getFieldEditorParent());
        sfe.setEmptyStringAllowed(false);
        addField(sfe);
    }
    IMonitor fbMonitor = this.getRuntime().getMonitorListener().getMonitor("XTapiMonitor");
    if (fbMonitor != null) {
        String[] fbInfos = fbMonitor.getDescription();
        Label capi_label = new Label(this.getFieldEditorParent(), 0);
        capi_label.setText(this.m_i18n.getString(this.getNamespace(), "fbinfo", "label", this.m_language));
        for (int i = 0; i < fbInfos.length; i++) {
            if (fbInfos[i].trim().length() > 0) {
                Label capi = new Label(this.getFieldEditorParent(), SWT.NULL);
                capi.setText(fbInfos[i]);
                new Label(this.getFieldEditorParent(), SWT.NULL);
            }
        }
    }
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) Label(org.eclipse.swt.widgets.Label) BooleanFieldEditor(de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor) IMonitor(de.janrufmonitor.framework.monitor.IMonitor)

Example 13 with BooleanFieldEditor

use of de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor in project janrufmonitor by tbrandt77.

the class BasicSettings method createContents.

protected Control createContents(Composite parent) {
    this.setTitle(this.m_i18n.getString(this.getNamespace(), "title", "label", this.m_language));
    final Composite c = new Composite(parent, SWT.NONE);
    c.setLayout(new GridLayout(2, false));
    clir = new StringFieldEditor(this.CONFIG_NAMESPACE + SEPARATOR + IJAMConst.GLOBAL_CLIR, this.m_i18n.getString(this.getNamespace(), IJAMConst.GLOBAL_CLIR, "label", this.m_language), 20, c);
    clir.setStringValue(this.getPreferenceStore().getString(this.CONFIG_NAMESPACE + SEPARATOR + "clir"));
    intarea = new StringFieldEditor(this.CONFIG_NAMESPACE + SEPARATOR + IJAMConst.GLOBAL_INTAREA, this.m_i18n.getString(this.getNamespace(), IJAMConst.GLOBAL_INTAREA, "label", this.m_language), 5, c);
    intarea.setStringValue(this.getPreferenceStore().getString(this.CONFIG_NAMESPACE + SEPARATOR + IJAMConst.GLOBAL_INTAREA));
    area = new StringFieldEditor(this.CONFIG_NAMESPACE + SEPARATOR + IJAMConst.GLOBAL_AREACODE, this.m_i18n.getString(this.getNamespace(), IJAMConst.GLOBAL_AREACODE, "label", this.m_language), 10, c);
    area.setStringValue(this.getPreferenceStore().getString(this.CONFIG_NAMESPACE + SEPARATOR + IJAMConst.GLOBAL_AREACODE));
    if (isExpertMode()) {
        delay = new StringFieldEditor("monitor.MonitorListener" + SEPARATOR + "delay", this.m_i18n.getString(this.getNamespace(), "delay", "label", this.m_language), 3, c);
        delay.setStringValue(this.getPreferenceStore().getString("monitor.MonitorListener" + SEPARATOR + "delay"));
        hina = new BooleanFieldEditor("service.HibernateDetect" + SEPARATOR + "enabled", this.m_i18n.getString(this.getNamespace(), "hina_enabled", "label", this.m_language), 1, c);
        hina.setPreferenceStore(this.getPreferenceStore());
        hina.doLoad();
    }
    return c;
}
Also used : StringFieldEditor(org.eclipse.jface.preference.StringFieldEditor) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) BooleanFieldEditor(de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor)

Aggregations

BooleanFieldEditor (de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor)13 StringFieldEditor (org.eclipse.jface.preference.StringFieldEditor)8 Label (org.eclipse.swt.widgets.Label)7 GridData (org.eclipse.swt.layout.GridData)5 Composite (org.eclipse.swt.widgets.Composite)5 ComboFieldEditor (org.eclipse.jface.preference.ComboFieldEditor)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 GridLayout (org.eclipse.swt.layout.GridLayout)4 IMonitor (de.janrufmonitor.framework.monitor.IMonitor)3 IntegerFieldEditor (org.eclipse.jface.preference.IntegerFieldEditor)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 Button (org.eclipse.swt.widgets.Button)3 TableViewer (org.eclipse.jface.viewers.TableViewer)2 Color (org.eclipse.swt.graphics.Color)2 Table (org.eclipse.swt.widgets.Table)2 TableColumn (org.eclipse.swt.widgets.TableColumn)2 Text (org.eclipse.swt.widgets.Text)2 ICaller (de.janrufmonitor.framework.ICaller)1 ICommand (de.janrufmonitor.framework.command.ICommand)1 II18nManager (de.janrufmonitor.framework.i18n.II18nManager)1