Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
* Copyright (c) 2003, 2010 s IT Solutions AT Spardat GmbH .
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* s IT Solutions AT Spardat GmbH - initial API and implementation
*******************************************************************************/
// @(#) $Id: $
package at.spardat.xma.page.messagebox.test;
import java.io.InputStream;
import java.util.Locale;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import at.spardat.xma.page.messagebox.DetailedMessageBox;
import at.spardat.xma.page.messagebox.LocalizedMessageBox;
/**
* GUI Test Class to test LocalizedMessageBox and DetailedMessageBox
* @author s3945
* @since 2.1.2
*/
public class XmaMessageBoxTestGui {
private Display display;
private Shell shell;
private Button open, openLmb;
private Button en, de, hu, cs, hr, sk, ro, ru;
public static void main(String[] args) {
XmaMessageBoxTestGui main = new XmaMessageBoxTestGui();
main.invoke();
}
private void invoke() {
display = new Display();
shell = new Shell(display);
shell.setSize(212, 300);
shell.setText("XmaMessageBoxTestGui");
InputStream copyResource = DetailedMessageBox.class.getClassLoader().getResourceAsStream("at/spardat/xma/page/messagebox/test/imc16x16.gif");
shell.setImage(new Image(display, copyResource));
createWidgets();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
private Locale getLocale() {
if (en.getSelection()) {
return new Locale("en", "EN");
} else if (de.getSelection()){
return new Locale("de", "DE");
} else if (hu.getSelection()){
return new Locale("hu", "HU");
} else if (cs.getSelection()){
return new Locale("cs", "CS");
} else if (hr.getSelection()){
return new Locale("hr", "HR");
} else if (sk.getSelection()){
return new Locale("sk", "SK");
} else if (ro.getSelection()){
return new Locale("ro", "RO");
} else if (ru.getSelection()){
return new Locale("ru", "RU");
}
return new Locale("en", "EN");
}
private void createWidgets() {
Group radioButtonGroup = new Group(shell, SWT.NONE);
radioButtonGroup.setText("Sprache");
radioButtonGroup.setBounds(2, 0, 200, 180);
en = new Button(radioButtonGroup, SWT.RADIO);
en.setText("English (default)");
en.setBounds(2, 15, 195, 20);
de = new Button(radioButtonGroup, SWT.RADIO);
de.setText("German (de)");
de.setBounds(2, 35, 195, 20);
hu = new Button(radioButtonGroup, SWT.RADIO);
hu.setText("Hungarian (hu)");
hu.setBounds(2, 55, 195, 20);
cs = new Button(radioButtonGroup, SWT.RADIO);
cs.setText("Czech (cs)");
cs.setBounds(2, 75, 195, 20);
hr = new Button(radioButtonGroup, SWT.RADIO);
hr.setText("Croatian (hr)");
hr.setBounds(2, 95, 195, 20);
sk = new Button(radioButtonGroup, SWT.RADIO);
sk.setText("Slovak (sk)");
sk.setBounds(2, 115, 195, 20);
ro = new Button(radioButtonGroup, SWT.RADIO);
ro.setText("Romanian (ro)");
ro.setBounds(2, 135, 195, 20);
ru = new Button(radioButtonGroup, SWT.RADIO);
ru.setText("Russian (ru)");
ru.setBounds(2, 155, 195, 20);
open = new Button(shell, SWT.PUSH);
open.setText("Open Detailed Messagebox ...");
open.setBounds(2, 215, 200, 25);
open.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) { }
// @SuppressWarnings("null")
public void widgetSelected(SelectionEvent e) {
try {
try {
String s = null;
s.toString(); //NOPMD
} catch (Exception ex) {
throw new RuntimeException("Ja ja, ein Nullpointer kostet ein Bier", ex);
}
} catch (Exception e2) {
int style = SWT.APPLICATION_MODAL | SWT.RESIZE| SWT.ICON_ERROR | SWT.YES | SWT.NO;
DetailedMessageBox msg = new DetailedMessageBox(shell, getLocale(), e2, style);
msg.setText("This is the title of the Messagebox.");
msg.setMessage("The client type change to SME could lead to a different rating for client XXXXXXX (anonymous) because the ownership support through owner XXXXXX (somebody else) would not apply anymore. The client type change to SME could lead to a different rating for client XXXXX (the same again) because the ownership support through owner xxxxxxx (yet another) would not apply anymore.");
//msg.setMessage("Short message");
msg.addAdditionalInformation("User = " + System.getProperty("user.name"));
msg.open();
}
}
});
openLmb = new Button(shell, SWT.PUSH);
openLmb.setText("Open Localized Messagebox...");
openLmb.setBounds(2, 240, 200, 25);
openLmb.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) { }
public void widgetSelected(SelectionEvent e) {
LocalizedMessageBox msg = new LocalizedMessageBox(shell, getLocale(), SWT.YES | SWT.NO | SWT.ICON_QUESTION | SWT.RESIZE);
// msg.setMessage("Refreshing the soft fact model replaces the existing model with a newer one. All so far inputted soft fact answers are deleted. Do you want to proceed?");
msg.setMessage("Refreshing the soft fact model replaces the existing model with a newer one. All so far inputted soft fact answers are deleted. Do you want to?");
msg.open();
// MessageBox box = new MessageBox(shell, SWT.OK | SWT.IGNORE);
// box.setMessage("supa");
// box.open();
}
});
}
}