use of de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor in project janrufmonitor by tbrandt77.
the class GoogleContactsCallerManager method createFieldEditors.
protected void createFieldEditors() {
super.createFieldEditors();
BooleanFieldEditor bfe = new BooleanFieldEditor(getConfigNamespace() + SEPARATOR + "keepextension", this.m_i18n.getString(this.getNamespace(), "keepextension", "label", this.m_language), this.getFieldEditorParent());
addField(bfe);
final StringFieldEditor u = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "user", this.m_i18n.getString(this.getNamespace(), "user", "label", this.m_language), this.getFieldEditorParent());
u.setEmptyStringAllowed(false);
addField(u);
final StringFieldEditor p = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "password", this.m_i18n.getString(this.getNamespace(), "password", "label", this.m_language), this.getFieldEditorParent());
p.getTextControl(this.getFieldEditorParent()).setEchoChar('*');
addField(p);
final FieldEditor ffe = new FieldEditor("check-button", "", this.getFieldEditorParent()) {
public Button up;
protected void adjustForNumColumns(int arg0) {
}
protected void doFillIntoGrid(Composite c, int numCols) {
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = numCols - 1;
gd.widthHint = 200;
final II18nManager i18 = PIMRuntime.getInstance().getI18nManagerFactory().getI18nManager();
final String l = PIMRuntime.getInstance().getConfigManagerFactory().getConfigManager().getProperty(IJAMConst.GLOBAL_NAMESPACE, IJAMConst.GLOBAL_LANGUAGE);
String text = i18.getString("ui.jface.configuration.pages.GoogleContactsCallerManager", "check", "label", l);
up = new Button(c, SWT.PUSH);
// new Label(c, SWT.NONE);
up.setText(text);
up.pack();
up.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ICallerManager cm = getRuntime().getCallerManagerFactory().getCallerManager(de.janrufmonitor.repository.GoogleContactsCallerManager.ID);
if (cm != null && cm instanceof de.janrufmonitor.repository.GoogleContactsCallerManager) {
try {
((de.janrufmonitor.repository.GoogleContactsCallerManager) cm).checkAuthentication(user, password);
MessageDialog.openInformation(new Shell(DisplayManager.getDefaultDisplay()), i18.getString("ui.jface.configuration.pages.GoogleContactsCallerManager", "success", "label", l), i18.getString("ui.jface.configuration.pages.GoogleContactsCallerManager", "success", "description", l));
return;
} catch (GoogleContactsLoginException ex) {
}
}
MessageDialog.openError(new Shell(DisplayManager.getDefaultDisplay()), i18.getString("ui.jface.configuration.pages.GoogleContactsCallerManager", "error", "label", l), i18.getString("ui.jface.configuration.pages.GoogleContactsCallerManager", "error", "description", l));
}
});
}
protected void doLoad() {
}
protected void doLoadDefault() {
}
protected void doStore() {
}
public int getNumberOfControls() {
return 1;
}
public void setEnabled(boolean enabled, Composite parent) {
super.setEnabled(enabled, parent);
if (up != null)
up.setEnabled(enabled);
}
};
ffe.setEnabled(false, getFieldEditorParent());
addField(ffe);
p.getTextControl(this.getFieldEditorParent()).addKeyListener(new KeyAdapter() {
public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
password = p.getStringValue();
user = u.getStringValue();
ffe.setEnabled((user != null && password != null && user.length() > 0 && password.length() > 0), getFieldEditorParent());
}
});
u.getTextControl(this.getFieldEditorParent()).addKeyListener(new KeyAdapter() {
public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
user = u.getStringValue();
password = p.getStringValue();
ffe.setEnabled((user != null && password != null && user.length() > 0 && password.length() > 0), getFieldEditorParent());
}
});
ComboFieldEditor cfe = new ComboFieldEditor(getConfigNamespace() + SEPARATOR + "mode", this.m_i18n.getString(this.getNamespace(), "mode", "label", this.m_language), new String[][] { { this.m_i18n.getString(this.getNamespace(), "mode1", "label", this.m_language), "1" }, { this.m_i18n.getString(this.getNamespace(), "mode2", "label", this.m_language), "2" } }, this.getFieldEditorParent());
addField(cfe);
bfe = new BooleanFieldEditor(getConfigNamespace() + SEPARATOR + "syncstart", this.m_i18n.getString(this.getNamespace(), "syncstart", "label", this.m_language), this.getFieldEditorParent());
addField(bfe);
}
use of de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor in project janrufmonitor by tbrandt77.
the class FritzBoxVoip 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);
sfe = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "boxip", this.m_i18n.getString(this.getNamespace(), "boxip", "label", this.m_language), this.getFieldEditorParent());
sfe.setEmptyStringAllowed(false);
addField(sfe);
}
mode = new ComboFieldEditor(getConfigNamespace() + SEPARATOR + "boxloginmode", this.m_i18n.getString(this.getNamespace(), "boxloginmode", "label", this.m_language), new String[][] { { this.m_i18n.getString(this.getNamespace(), "userpassword", "label", this.m_language), "0" }, { this.m_i18n.getString(this.getNamespace(), "password_only", "label", this.m_language), "1" } }, this.getFieldEditorParent());
addField(mode);
this.user = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "boxuser", this.m_i18n.getString(this.getNamespace(), "boxuser", "label", this.m_language), this.getFieldEditorParent());
addField(this.user);
String state = this.getPreferenceStore().getString(getConfigNamespace() + SEPARATOR + "boxloginmode");
if (state.equalsIgnoreCase("1")) {
this.user.setEnabled(false, this.getFieldEditorParent());
this.user.getTextControl(getFieldEditorParent()).setBackground(new Color(DisplayManager.getDefaultDisplay(), 190, 190, 190));
this.user.setStringValue("");
}
sfe = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "boxpassword", this.m_i18n.getString(this.getNamespace(), "boxpassword", "label", this.m_language), this.getFieldEditorParent());
sfe.getTextControl(this.getFieldEditorParent()).setEchoChar('*');
addField(sfe);
if (isExpertMode()) {
IntegerFieldEditor ife = new IntegerFieldEditor(getConfigNamespace() + SEPARATOR + "retrymax", this.m_i18n.getString(this.getNamespace(), "retrymax", "label", this.m_language), this.getFieldEditorParent());
ife.setTextLimit(3);
addField(ife);
ife = new IntegerFieldEditor(getConfigNamespace() + SEPARATOR + "retrytimeouts", this.m_i18n.getString(this.getNamespace(), "retrytimeouts", "label", this.m_language), this.getFieldEditorParent());
ife.setTextLimit(3);
addField(ife);
bfe = new BooleanFieldEditor(getConfigNamespace() + SEPARATOR + "tr064off", this.m_i18n.getString(this.getNamespace(), "tr064off", "label", this.m_language), this.getFieldEditorParent());
addField(bfe);
new Label(this.getFieldEditorParent(), SWT.NULL);
new Label(this.getFieldEditorParent(), SWT.NULL);
ComboFieldEditor cfe = new ComboFieldEditor(getConfigNamespace() + SEPARATOR + "boxclickdial", this.m_i18n.getString(this.getNamespace(), "boxclickdial", "label", this.m_language), new String[][] { { this.m_i18n.getString(this.getNamespace(), "manual", "label", this.m_language), "0" }, { this.m_i18n.getString(this.getNamespace(), "all_analog", "label", this.m_language), "9" }, { this.m_i18n.getString(this.getNamespace(), "all_isdn", "label", this.m_language), "50" }, { "FON 1", "1" }, { "FON 2", "2" }, { "FON 3", "3" }, { "ISDN 1", "51" }, { "ISDN 2", "52" }, { "ISDN 3", "53" }, { "ISDN 4", "54" }, { "ISDN 5", "55" }, { "ISDN 6", "56" }, { "ISDN 7", "57" }, { "ISDN 8", "58" }, { "ISDN 9", "59" }, { "DECT 610", "60" }, { "DECT 611", "61" }, { "DECT 612", "62" }, { "DECT 613", "63" }, { "DECT 614", "64" }, { "DECT 615", "65" } }, this.getFieldEditorParent());
addField(cfe);
sfe = new StringFieldEditor(getConfigNamespace() + SEPARATOR + "dialprefixes", this.m_i18n.getString(this.getNamespace(), "dialprefixes", "label", this.m_language), this.getFieldEditorParent());
sfe.setEmptyStringAllowed(true);
addField(sfe);
new Label(this.getFieldEditorParent(), SWT.NULL);
new Label(this.getFieldEditorParent(), SWT.NULL);
}
IMonitor fbMonitor = this.getRuntime().getMonitorListener().getMonitor("FritzBoxMonitor");
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);
}
}
}
new Label(this.getFieldEditorParent(), SWT.NULL);
Label statusl = new Label(this.getFieldEditorParent(), 0);
statusl.setText(this.m_i18n.getString(this.getNamespace(), "status", "label", this.m_language));
Label status_observer = new Label(this.getFieldEditorParent(), SWT.NULL);
status_observer.setText(this.m_i18n.getString(this.getNamespace(), "statuso", "label", this.m_language) + ((fbMonitor != null && fbMonitor.isStarted()) ? "OK" : "---"));
new Label(this.getFieldEditorParent(), SWT.NULL);
FirmwareManager fwm = FirmwareManager.getInstance();
fwm.startup();
if (fwm.isLoggedIn() && !fwm.isInstance(TR064FritzBoxFirmware.class)) {
Label status_sync = new Label(this.getFieldEditorParent(), SWT.NULL);
status_sync.setText(this.m_i18n.getString(this.getNamespace(), "statuss", "label", this.m_language) + (fwm.isLoggedIn() ? "OK" : "---"));
new Label(this.getFieldEditorParent(), SWT.NULL);
if (fbMonitor != null && fbMonitor.isStarted() && fwm.isLoggedIn()) {
// set icon to colored
IService tray = this.getRuntime().getServiceFactory().getService("TrayIcon");
try {
Method m = tray.getClass().getMethod("setIconStateActive", new Class[] {});
if (m != null) {
m.invoke(tray, new Object[] {});
}
} catch (Exception ex) {
}
}
if ((fbMonitor == null || !fbMonitor.isStarted()) && !fwm.isLoggedIn()) {
// set icon to colored
IService tray = this.getRuntime().getServiceFactory().getService("TrayIcon");
try {
Method m = tray.getClass().getMethod("setIconStateInactive", new Class[] {});
if (m != null) {
m.invoke(tray, new Object[] {});
}
} catch (Exception ex) {
}
}
}
}
use of de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor in project janrufmonitor by tbrandt77.
the class Reject method createContents.
protected Control createContents(Composite parent) {
this.setTitle(this.m_i18n.getString(this.getNamespace(), "title", "label", this.m_language));
Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(1, false));
String label = this.m_i18n.getString(this.getNamespace(), "enabled", "label", this.m_language);
if (label.length() < 150)
for (int i = 150; i > label.length(); i--) {
label += " ";
}
this.active = new Button(c, SWT.CHECK);
this.active.setText(label);
this.active.setSelection(this.getPreferenceStore().getBoolean(this.getConfigNamespace() + SEPARATOR + "enabled"));
bfe = new BooleanFieldEditor(this.getConfigNamespace() + SEPARATOR + "allclir", this.m_i18n.getString(this.getNamespace(), "allclir", "label", this.m_language), c);
bfe.setPreferenceStore(this.getPreferenceStore());
bfe.doLoad();
Composite c1 = new Composite(c, SWT.NONE);
c1.setLayout(new GridLayout(3, false));
Composite c11 = new Composite(c1, SWT.NONE);
c11.setLayout(new GridLayout(1, false));
new Label(c11, SWT.NONE).setText(this.m_i18n.getString(this.getNamespace(), "areacodes", "label", this.m_language));
tv = new TableViewer(c11);
tv.setContentProvider(new AcContentProvider());
tv.setLabelProvider(new AcLabelProvider());
Table t = tv.getTable();
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL_BOTH;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 150;
gd.heightHint = 100;
t.setLayoutData(gd);
TableColumn tc = new TableColumn(t, SWT.LEFT);
tc.getText();
tv.setInput(this.getDataList());
for (int i = 0, n = t.getColumnCount(); i < n; i++) {
t.getColumn(i).pack();
t.getColumn(i).setWidth(140);
}
t.setLinesVisible(false);
Composite c12 = new Composite(c1, SWT.NONE);
c12.setLayout(new GridLayout(1, false));
Button add = new Button(c12, SWT.PUSH);
add.setText(this.m_i18n.getString(this.getNamespace(), "add", "label", this.m_language));
Button remove = new Button(c12, SWT.PUSH);
remove.setText(this.m_i18n.getString(this.getNamespace(), "remove", "label", this.m_language));
Composite c13 = new Composite(c1, SWT.NONE);
c13.setLayout(new GridLayout(1, false));
new Label(c13, SWT.NONE).setText(this.m_i18n.getString(this.getNamespace(), "edit", "label", this.m_language));
final Text ip = new Text(c13, SWT.BORDER);
gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 100;
ip.setLayoutData(gd);
ip.setText("");
add.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (ip.getText().length() > 0 && !dataList.contains(ip.getText())) {
ICaller c = Identifier.identifyDefault(getRuntime(), getRuntime().getCallerFactory().createPhonenumber(PhonenumberAnalyzer.getInstance(getRuntime()).normalize(ip.getText())));
if (c != null) {
dataList.add(Formatter.getInstance(getRuntime()).parse(IJAMConst.GLOBAL_VARIABLE_CALLERNUMBER, c.getPhoneNumber()));
}
// dataList.add(ip.getText());
tv.setInput(dataList);
for (int i = 0, n = tv.getTable().getColumnCount(); i < n; i++) {
tv.getTable().getColumn(i).pack();
}
}
}
});
remove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
StructuredSelection s = (StructuredSelection) tv.getSelection();
if (!s.isEmpty()) {
String o = (String) s.getFirstElement();
ip.setText(o);
dataList.remove(o);
tv.setInput(dataList);
for (int i = 0, n = tv.getTable().getColumnCount(); i < n; i++) {
tv.getTable().getColumn(i).pack();
}
}
}
});
return c;
}
use of de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor in project janrufmonitor by tbrandt77.
the class MsnManager method createContents.
protected Control createContents(Composite parent) {
this.setTitle(this.m_i18n.getString(this.getNamespace(), "title", "label", this.m_language));
Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(1, false));
tv = new TableViewer(c);
tv.setSorter(new MsnViewerSorter());
tv.setContentProvider(new MsnContentProvider());
tv.setLabelProvider(new MsnLabelProvider());
Table t = tv.getTable();
t.setLayoutData(new GridData(GridData.FILL_BOTH));
TableColumn tc = new TableColumn(t, SWT.LEFT);
tc.setText(this.m_i18n.getString(this.getNamespace(), "msn", "label", this.m_language));
tc.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
((MsnViewerSorter) tv.getSorter()).doSort(0);
tv.refresh();
}
});
tc = new TableColumn(t, SWT.LEFT);
tc.setText(this.m_i18n.getString(this.getNamespace(), "alias", "label", this.m_language));
tc.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
((MsnViewerSorter) tv.getSorter()).doSort(1);
tv.refresh();
}
});
tv.setInput(this.getMsnList());
for (int i = 0, n = t.getColumnCount(); i < n; i++) {
t.getColumn(i).pack();
}
t.setHeaderVisible(true);
t.setLinesVisible(true);
this.createPopupMenu();
allMsns = new BooleanFieldEditor(IJAMConst.GLOBAL_NAMESPACE + SEPARATOR + "detectallmsn", this.m_i18n.getString(this.getNamespace(), "detectallmsn", "label", this.m_language), c);
allMsns.setPreferenceStore(this.getPreferenceStore());
allMsns.doLoad();
this.resizeTable(tv.getTable());
return c;
}
use of de.janrufmonitor.ui.jface.configuration.controls.BooleanFieldEditor in project janrufmonitor by tbrandt77.
the class ExpertMode method createFieldEditors.
protected void createFieldEditors() {
this.setTitle(this.m_i18n.getString(this.getNamespace(), "title", "label", this.m_language));
this.noDefaultAndApplyButton();
BooleanFieldEditor sfe = new BooleanFieldEditor(this.getConfigNamespace() + SEPARATOR + IJAMConst.GLOBAL_CONFIG_EXPERT_MODE, this.m_i18n.getString(this.getNamespace(), IJAMConst.GLOBAL_CONFIG_EXPERT_MODE, "label", this.m_language), this.getFieldEditorParent());
addField(sfe);
}
Aggregations