예제 #1
0
 public void test_getDisplayName_easy() throws Exception {
   assertEquals("English", Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH));
   assertEquals("German", Locale.GERMAN.getDisplayLanguage(Locale.ENGLISH));
   assertEquals("Englisch", Locale.ENGLISH.getDisplayLanguage(Locale.GERMAN));
   assertEquals("Deutsch", Locale.GERMAN.getDisplayLanguage(Locale.GERMAN));
 }
예제 #2
0
  /**
   * Create contents of the dialog.
   *
   * @param parent
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.numColumns = 2;
    gridLayout.verticalSpacing = 5;
    gridLayout.horizontalSpacing = 5;
    gridLayout.marginHeight = 5;
    gridLayout.marginWidth = 5;

    Composite compositeLeftBtn = new Composite(container, SWT.NONE);
    compositeLeftBtn.setLayout(new GridLayout(1, false));

    Button button = new Button(compositeLeftBtn, SWT.NONE);
    button.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    button.setImage(
        ResourceManager.getPluginImage(
            BrowserActivator.ID, "resources/TadpoleOverView.png")); // $NON-NLS-1$

    compositeLogin = new Composite(container, SWT.NONE);
    compositeLogin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    compositeLogin.setLayout(new GridLayout(3, false));

    lblEmail = new Label(compositeLogin, SWT.NONE);
    lblEmail.setText(Messages.get().LoginDialog_1);

    textEMail = new Text(compositeLogin, SWT.BORDER);
    textEMail.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
              if (!"".equals(textPasswd.getText())) okPressed(); // $NON-NLS-1$
              else textPasswd.setFocus();
            }
          }
        });
    textEMail.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    btnCheckButton = new Button(compositeLogin, SWT.CHECK);
    btnCheckButton.setText(Messages.get().LoginDialog_9); // $NON-NLS-1$

    lblPassword = new Label(compositeLogin, SWT.NONE);
    lblPassword.setText(Messages.get().LoginDialog_4);

    textPasswd = new Text(compositeLogin, SWT.BORDER | SWT.PASSWORD);
    textPasswd.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
              okPressed();
            }
          }
        });
    textPasswd.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnLogin = new Button(compositeLogin, SWT.NONE);
    btnLogin.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            okPressed();
          }
        });
    btnLogin.setText(Messages.get().LoginDialog_15);

    lblLanguage = new Label(compositeLogin, SWT.NONE);
    lblLanguage.setText(Messages.get().LoginDialog_lblLanguage_text);

    comboLanguage = new Combo(compositeLogin, SWT.READ_ONLY);
    comboLanguage.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            changeUILocale();
          }
        });
    comboLanguage.add(Locale.ENGLISH.getDisplayLanguage());
    comboLanguage.add(Locale.KOREAN.getDisplayLanguage());

    comboLanguage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    comboLanguage.setData(Locale.ENGLISH.getDisplayLanguage(), Locale.ENGLISH);
    comboLanguage.setData(Locale.KOREAN.getDisplayLanguage(), Locale.KOREAN);

    //		comboLanguage.select(0);

    // ---------------------  Registered database
    // ----------------------------------------------------
    //		try {
    //			listDBMart = getDBMart();
    //			if(!listDBMart.isEmpty()) {
    //				Group grpSponser = new Group(container, SWT.NONE);
    //				GridLayout gl_grpSponser = new GridLayout(1, false);
    //				gl_grpSponser.verticalSpacing = 0;
    //				gl_grpSponser.horizontalSpacing = 0;
    //				gl_grpSponser.marginHeight = 0;
    //				gl_grpSponser.marginWidth = 0;
    //				grpSponser.setLayout(gl_grpSponser);
    //				grpSponser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    //				grpSponser.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLUE));
    //				grpSponser.setText(Messages.get().LoginDialog_grpSponser_text);
    //
    //				makeBarChart(grpSponser, listDBMart);
    //			}
    //		} catch(Exception e) {
    //			logger.error("get initdata", e); //$NON-NLS-1$
    //		}

    compositeLetter = new Group(container, SWT.NONE);
    compositeLetter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    GridLayout gl_compositeLetter = new GridLayout(2, false);
    compositeLetter.setLayout(gl_compositeLetter);
    compositeLetter.setText(Messages.get().LoginDialog_grpShowInformation_text);

    lblSite = new Label(compositeLetter, SWT.NONE);
    lblSite.setText(Messages.get().LoginDialog_lblSite_text);

    Label lblNewLabel = new Label(compositeLetter, SWT.NONE);
    lblNewLabel.setText(
        "<a href='"
            + Messages.get().LoginDialog_lblNewLabel_text_1
            + "' target='_blank'>"
            + Messages.get().LoginDialog_lblNewLabel_text_1
            + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    lblNewLabel.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    lblUserGuide = new Label(compositeLetter, SWT.NONE);
    lblUserGuide.setText(Messages.get().LoginDialog_lblUserGuide_text);

    Composite compositeUserGide = new Composite(compositeLetter, SWT.NONE);
    compositeUserGide.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_compositeUserGide = new GridLayout(3, false);
    gl_compositeUserGide.verticalSpacing = 1;
    gl_compositeUserGide.horizontalSpacing = 1;
    gl_compositeUserGide.marginHeight = 1;
    gl_compositeUserGide.marginWidth = 1;
    compositeUserGide.setLayout(gl_compositeUserGide);

    Label lblUserKor = new Label(compositeUserGide, SWT.NONE);
    lblUserKor.setText(
        "<a href='https://tadpoledbhub.atlassian.net/wiki/pages/viewpage.action?pageId=20578325' target='_blank'>(Korean)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserKor.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblUserEng = new Label(compositeUserGide, SWT.NONE);
    lblUserEng.setText(
        "<a href='https://github.com/hangum/TadpoleForDBTools/wiki/RDB-User-Guide-Eng' target='_blank'>(English)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserEng.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblUserIndonesia = new Label(compositeUserGide, SWT.NONE);
    lblUserIndonesia.setText(
        "<a href='https://github.com/hangum/TadpoleForDBTools/wiki/RDB-User-Guide-ID' target='_blank'>(Indonesia)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserIndonesia.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    //		Label lblIssues = new Label(compositeLetter, SWT.NONE);
    //		lblIssues.setText(Messages.get().LoginDialog_lblIssues_text);
    //
    //		Label lblIssue = new Label(compositeLetter, SWT.NONE);
    //		lblIssue.setText("<a href='https://github.com/hangum/TadpoleForDBTools/issues'
    // target='_blank'>https://github.com/hangum/TadpoleForDBTools/issues</a>"); //$NON-NLS-1$
    // //$NON-NLS-2$
    //		lblIssue.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    lblContact = new Label(compositeLetter, SWT.NONE);
    lblContact.setText(Messages.get().LoginDialog_lblContact_text_1);

    Label lblContactUrl = new Label(compositeLetter, SWT.NONE);
    try {
      UserDAO systemUserDao = TadpoleApplicationContextManager.getSystemAdmin();
      lblContactUrl.setText(
          String.format(
              "<a href='mailto:%s'>%s(%s)</a>",
              systemUserDao.getEmail(),
              systemUserDao.getName(),
              systemUserDao.getEmail())); // $NON-NLS-1$ //$NON-NLS-2$
    } catch (Exception e1) {
      lblContactUrl.setText(
          "<a href='mailto:[email protected]'>Admin([email protected])</a>"); //$NON-NLS-1$
      // //$NON-NLS-2$
    }
    lblContactUrl.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblDonation = new Label(compositeLetter, SWT.NONE);
    //		lblDonation.setText(Messages.get().LoginDialog_lblDonation_text);

    Browser browser = new Browser(compositeLetter, SWT.NONE);
    browser.setLayoutData(new GridData(SWT.FILL, SWT.RIGHT, false, false, 1, 1));
    browser.setText(strPaypal);

    AnalyticCaller.track("login"); // $NON-NLS-1$

    initUI();

    return compositeLogin;
  }