コード例 #1
0
ファイル: UnlockClientView.java プロジェクト: frankggyy/YUEP
  @Override
  protected JComponent createContentPane() {
    SwingFactory swingFactory = ClientCoreContext.getSwingFactory();

    JLabel userLabel =
        swingFactory.getLabel(
            new LabelDecorator(ClientCoreContext.getString("smmanager.unlock.user")));
    JLabel pwdLabel =
        swingFactory.getLabel(
            new LabelDecorator(ClientCoreContext.getString("smmanager.unlock.password")));

    userField = swingFactory.getXEditor(new StringEditorDecorator("user"));
    userField.setEditable(false);
    pwdTextField = swingFactory.getXEditor(new PasswordEditorDecorator("password"));

    double[][] ds =
        new double[][] {
          {5, 100, 5, TableLayout.FILL, 5}, swingFactory.getTableLayoutRowParam(2, 1, 1)
        };
    JPanel pane = swingFactory.getPanel(new TableLayout(ds));
    pane.add(userLabel, "1,1,f,c");
    pane.add(userField, "3,1,f,c");
    pane.add(pwdLabel, "1,3,f,c");
    pane.add(pwdTextField, "3,3,f,c");

    // init data : current user
    SmCoreClientService smCoreClientService =
        ClientCoreContext.getLocalService("smCoreClientService", SmCoreClientService.class);
    userField.setText(smCoreClientService.getCurrentUser());
    return pane;
  }
コード例 #2
0
ファイル: UnlockClientView.java プロジェクト: frankggyy/YUEP
  @SuppressWarnings("unchecked")
  @Override
  public List<Object> collectData() {
    // 读取用户名,密码
    String pwd = new String(pwdTextField.getPassword());
    String user = userField.getText();
    if (StringUtils.isEmpty(pwd) || StringUtils.isEmpty(user)) {
      DialogUtils.showErrorDialog(this.getWindow(), "smmanager.modifyselfpassword.input is null");
      return null;
    }

    List datas = new ArrayList();
    datas.add(user);
    // 加密传输
    String encryptPwd = EncryptUtils.setEncrypt(pwd, EncryptUtils.MAGIC_KEY_CLIENT);
    datas.add(encryptPwd);
    return datas;
  }