Browse Source

merge

master
Fangjie Hu 8 years ago
parent
commit
1ffd0ecd7c
  1. 5
      designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java
  2. 73
      designer_base/src/com/fr/design/actions/file/LocalePane.java
  3. 19
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  4. 11
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  5. 49
      designer_base/src/com/fr/design/extra/exe/PluginLoginExecutor.java
  6. 1
      designer_base/src/com/fr/design/file/HistoryTemplateListPane.java
  7. 10
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  8. 8
      designer_form/src/com/fr/design/mainframe/FormArea.java

5
designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -18,6 +18,7 @@ import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -99,7 +100,9 @@ public class UserInfoLabel extends UILabel{
}
});
//PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
if (StableUtils.getMajorJavaVersion() == 8) {
PluginWebBridge.getHelper().setUILabel(UserInfoLabel.this);
}
QQLoginWebBridge.getHelper().setUILabelInPlugin(UserInfoLabel.this);
UserLoginContext.addLoginContextListener(new LoginContextListener() {

73
designer_base/src/com/fr/design/actions/file/LocalePane.java

@ -8,13 +8,7 @@ import java.awt.BorderLayout;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.Vector;
import java.util.*;
import javax.swing.JTable;
import javax.swing.RowFilter;
@ -31,10 +25,7 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.dialog.BasicPane;
import com.fr.file.filetree.FileNode;
import com.fr.general.FRLogger;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.general.*;
import com.fr.stable.ArrayUtils;
import com.fr.stable.project.ProjectConstants;
@ -43,12 +34,6 @@ import com.fr.stable.project.ProjectConstants;
* @since : 8.0
*/
public class LocalePane extends BasicPane {
private static final String FR = "fr.properties";
private static final String US = "fr_en_US.properties";
private static final String CN = "fr_zh_CN.properties";
private static final String JP = "fr_ja_JP.properties";
private static final String TW = "fr_zh_TW.properties";
private static final String KR = "fr_ko_KR.properties";
private static final String PREFIX = "fr_";
private static final int LOCALE_NAME_LEN = 5;
@ -124,39 +109,35 @@ public class LocalePane extends BasicPane {
}
private void initPredefinedProperties() {
Properties fr = loadLocaleProperties(FR);
Properties us = loadLocaleProperties(US);
Properties cn = loadLocaleProperties(CN);
Properties jp = loadLocaleProperties(JP);
Properties tw = loadLocaleProperties(TW);
Properties kr = loadLocaleProperties(KR);
Set<String> keys = fr.stringPropertyNames();
List<String> sortKeys = new ArrayList<String>(keys);
Map<Locale, LocalePackage> map = Inter.getPredefinedPackageMap();
LocalePackage chinese = map.get(Locale.SIMPLIFIED_CHINESE);
List<String> sortKeys = new ArrayList<String>();
Set<ResourceBundle> bundles = chinese.getKindsOfResourceBundle();
for (ResourceBundle bundle : bundles) {
sortKeys.addAll(bundle.keySet());
}
Collections.sort(sortKeys);
Vector<String> keyVector = new Vector<String>();
Vector<String> valueVector = new Vector<String>();
Vector<String> usVector = new Vector<String>();
Vector<String> cnVector = new Vector<String>();
Vector<String> jpVector = new Vector<String>();
Vector<String> twVector = new Vector<String>();
Vector<String> krVector = new Vector<String>();
Map<Locale, Vector<String>> data = new HashMap<Locale, Vector<String>>();
for (Map.Entry<Locale, LocalePackage> entry : map.entrySet()) {
Vector<String> column = new Vector<String>();
for (String key : sortKeys) {
keyVector.add(key);
valueVector.add(fr.getProperty(key));
usVector.add(us.getProperty(key));
cnVector.add(cn.getProperty(key));
jpVector.add(jp.getProperty(key));
twVector.add(tw.getProperty(key));
krVector.add(kr.getProperty(key));
column.add(entry.getValue().getLocText(key));
}
data.put(entry.getKey(), column);
}
Vector<String> keyVector = new Vector<String>();
keyVector.addAll(sortKeys);
predefineTableModel.addColumn(Inter.getLocText("Key"), keyVector);
predefineTableModel.addColumn(Inter.getLocText("Value"), valueVector);
predefineTableModel.addColumn("en_US", usVector);
predefineTableModel.addColumn("zh_CN", cnVector);
predefineTableModel.addColumn("ja_JP", jpVector);
predefineTableModel.addColumn("zh_TW", twVector);
predefineTableModel.addColumn("ko_KR", krVector);
for (Map.Entry<Locale, Vector<String>> entry : data.entrySet()) {
predefineTableModel.addColumn(entry.getKey().getDisplayName(), entry.getValue());
}
}
private void initCustomProperties() throws Exception {

19
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -118,14 +118,13 @@ public class LoginWebBridge {
if(!StringUtils.isEmpty(this.userName)){
updateMessageCount();
}
DesignerEnvManager.getEnvManager().setBBSName(userName);
this.userName = userName;
}
/**
* 定时取后台论坛消息
*/
private void updateMessageCount(){
public void updateMessageCount(){
//启动获取消息更新的线程
//登陆状态, 根据存起来的用户名密码, 每1分钟发起一次请求, 更新消息条数.
Thread updateMessageThread = new Thread(new Runnable() {
@ -171,7 +170,7 @@ public class LoginWebBridge {
}
this.messageCount = count;
StringBuilder sb = new StringBuilder();
sb.append(StringUtils.BLANK).append(this.userName)
sb.append(StringUtils.BLANK).append(DesignerEnvManager.getEnvManager().getBBSName())
.append("(").append(this.messageCount)
.append(")").append(StringUtils.BLANK);
DesignerEnvManager.getEnvManager().setInShowBBsName(sb.toString());
@ -244,7 +243,7 @@ public class LoginWebBridge {
* @param uiLabel 两边的label显示
* @return 登录信息标志
*/
private String login(String username, String password, UILabel uiLabel) {
public String login(String username, String password, UILabel uiLabel) {
if (!StringUtils.isNotBlank(username) && !StringUtils.isNotBlank(password)) {
return LOGIN_INFO_EMPTY;
}
@ -253,7 +252,7 @@ public class LoginWebBridge {
}
String loginResult = login(username, password);
if (loginResult.equals(LOGININ)) {
updateUserInfo(username, password);
updateUserInfo(username);
loginSuccess(username, uiLabel);
setUserName(username, uiLabel);
}
@ -275,10 +274,7 @@ public class LoginWebBridge {
* @param username 用户名
* @param password 密码
*/
public void updateUserInfo(String username,String password) {
DesignerEnvManager.getEnvManager().setBBSName(username);
DesignerEnvManager.getEnvManager().setBBSPassword(password);
DesignerEnvManager.getEnvManager().setInShowBBsName(username);
public void updateUserInfo(String username) {
this.userName = username;
}
@ -309,7 +305,7 @@ public class LoginWebBridge {
});
}
public String login(String username, String password) {
private String login(String username, String password) {
try {
Client uc = new Client();
String result = uc.uc_user_login(username, password);
@ -319,6 +315,9 @@ public class LoginWebBridge {
int $uid = Integer.parseInt(list.get(0));
if ($uid > 0) {
DesignerEnvManager.getEnvManager().setBbsUid($uid);
DesignerEnvManager.getEnvManager().setBBSName(username);
DesignerEnvManager.getEnvManager().setInShowBBsName(username);
DesignerEnvManager.getEnvManager().setBBSPassword(password);
return LOGININ;//登录成功,0
} else if ($uid == -1) {
return USERNAME_NOT_EXSIT;//用户名不存在,-1

11
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -529,6 +529,17 @@ public class PluginWebBridge {
return LoginWebBridge.getHelper().pluginManageLogin(username, password, uiLabel);
}
/**
* 插件管理部分的登陆的回调处理
* @param username
* @param password
* @param callback
*/
public void defaultLogin(String username, String password, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password, uiLabel));
new Thread(task).start();
}
/**
* 弹出QQ授权页面
*/

49
designer_base/src/com/fr/design/extra/exe/PluginLoginExecutor.java

@ -0,0 +1,49 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.LoginWebBridge;
import com.fr.design.extra.Process;
import com.fr.design.gui.ilable.UILabel;
/**
* Created by Slpire on 2016/11/7.
*/
public class PluginLoginExecutor implements Executor {
private String result = "[]";
private String username;
private String password;
private UILabel uiLabel;
public PluginLoginExecutor(String username, String password, UILabel uiLabel) {
this.username = username;
this.password = password;
this.uiLabel = uiLabel;
}
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[] {
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
String loginResult = LoginWebBridge.getHelper().login(username, password, uiLabel);
if (Integer.valueOf(loginResult) == 0) {
LoginWebBridge.getHelper().updateMessageCount();
}
result = loginResult;
}
}
};
}
}

1
designer_base/src/com/fr/design/file/HistoryTemplateListPane.java

@ -9,7 +9,6 @@ import java.util.logging.Level;
import javax.swing.*;
import com.fr.design.constants.UIConstants;
import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager;

10
designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java

@ -42,4 +42,14 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
public void setEditable(boolean isEditable) {
super.setEditable(true);
}
/**
* 该组件是否可以拖拽(表单中绝对布局不可以拖拽)
*
* @return 是则返回true
*/
@Override
public boolean isSupportDrag() {
return false;
}
}

8
designer_form/src/com/fr/design/mainframe/FormArea.java

@ -433,17 +433,17 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
if (rec.width <= dWidth&&rec.x < getHorizontalValue()) {
//在边界内部且x位置小于水平滚动条的值
horScrollBar.setValue(rec.x);
} else if (rec.x+rec.width > dWidth) {
} else if (rec.x + rec.width > dWidth + horizontalValue) {
//超出边界宽度
horScrollBar.setValue(rec.x+rec.width-dWidth);
horScrollBar.setValue(rec.x + rec.width - dWidth);
}
int dHeight = getDesignerHeight();
if (rec.height < dHeight && rec.y < getVerticalValue()) {
//在边界内部且y位置小于竖直滚动条的值
verScrollBar.setValue(rec.y);
} else if (rec.y+rec.height > dHeight) {
} else if (rec.y + rec.height > dHeight + verticalValue) {
//超出边界高度
verScrollBar.setValue(rec.y+rec.height-dHeight);
verScrollBar.setValue(rec.y + rec.height - dHeight);
}
}

Loading…
Cancel
Save