fr_shine 8 years ago
parent
commit
4aa0c801aa
  1. 2
      designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java
  2. 2
      designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java
  3. 2
      designer/src/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java
  4. 55
      designer/src/com/fr/design/mainframe/bbs/BBSDialog.java
  5. 2
      designer_base/designer_base.iml
  6. 16
      designer_base/src/com/fr/design/DesignModelAdapter.java
  7. 12
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  8. 8
      designer_base/src/com/fr/design/actions/server/PluginManagerAction.java
  9. 24
      designer_base/src/com/fr/design/data/datapane/TableDataSourceOP.java
  10. 8
      designer_base/src/com/fr/design/data/datapane/TableDataTree.java
  11. 80
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  12. 742
      designer_base/src/com/fr/design/dialog/BasicPane.java
  13. 31
      designer_base/src/com/fr/design/extra/PluginManagerPane.java
  14. 25
      designer_base/src/com/fr/design/extra/PluginShopDialog.java
  15. 4
      designer_base/src/com/fr/design/extra/PluginStatusCheckCompletePane.java
  16. 31
      designer_base/src/com/fr/design/extra/PluginTask.java
  17. 22
      designer_base/src/com/fr/design/extra/PluginUpdatePane.java
  18. 194
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  19. 33
      designer_base/src/com/fr/design/extra/PluginWebPane.java
  20. 4
      designer_base/src/com/fr/design/extra/exe/Command.java
  21. 61
      designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  22. 35
      designer_base/src/com/fr/design/extra/exe/InstallFromDiskExecutor.java
  23. 53
      designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java
  24. 36
      designer_base/src/com/fr/design/extra/exe/ModifyStatusExecutor.java
  25. 50
      designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java
  26. 47
      designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java
  27. 51
      designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java
  28. 21
      designer_base/src/com/fr/design/extra/exe/UpdateFromDiskExecutor.java
  29. 95
      designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java
  30. 22
      designer_base/src/com/fr/design/fun/TableDataTreePaneProcessor.java
  31. 15
      designer_base/src/com/fr/design/fun/impl/AbstractTDTreePaneProcessor.java
  32. 7
      designer_base/src/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java
  33. 2
      designer_base/src/com/fr/design/gui/itree/refreshabletree/UserObjectRefreshJTree.java
  34. 20
      designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java
  35. 2
      designer_base/src/com/fr/design/roleAuthority/RoleTree.java
  36. 2
      designer_form/src/com/fr/design/designer/beans/painters/FRFitLayoutPainter.java

2
designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java

File diff suppressed because one or more lines are too long

2
designer/src/com/fr/design/mainframe/AuthorityToolBarPane.java

File diff suppressed because one or more lines are too long

2
designer/src/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java

File diff suppressed because one or more lines are too long

55
designer/src/com/fr/design/mainframe/bbs/BBSDialog.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.bbs;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
@ -20,8 +21,6 @@ import netscape.javascript.JSObject;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
/**
* @author richie
@ -54,7 +53,7 @@ public class BBSDialog extends UIDialog {
}
private void disableLink(final WebEngine eng) {
try{
try {
// webView端不跳转 虽然webView可以指定本地浏览器打开某个链接,但是当本地浏览器跳转到指定链接的同时,webView也做了跳转,
// 为了避免出现在一个600*400的资讯框里加载整个网页的情况,webView不跳转到新网页
Platform.runLater(new Runnable() {
@ -63,16 +62,17 @@ public class BBSDialog extends UIDialog {
eng.executeScript("history.go(0)");
}
});
}catch(Exception e){
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
/**
* 打开资讯框
*
* @param url 资讯链接
*/
public void showWindow(final String url){
public void showWindow(final String url) {
GUICoreUtils.centerWindow(this);
this.setResizable(false);
Platform.runLater(new Runnable() {
@ -93,20 +93,19 @@ public class BBSDialog extends UIDialog {
root.getChildren().add(view);
eng.locationProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue)
{
disableLink(eng);
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
if(ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))){
return;
}
openUrlAtLocalWebBrowser(eng,newValue);
}
});
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) {
disableLink(eng);
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, SiteCenter.getInstance().acquireUrlByKind("bbs.mobile"))) {
return;
}
PluginWebBridge.getHelper().openUrlAtLocalWebBrowser(eng, newValue);
}
});
eng.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() {
@Override
public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldValue, Worker.State newValue) {
if (newValue == Worker.State.SUCCEEDED){
if (newValue == Worker.State.SUCCEEDED) {
JSObject obj = (JSObject) eng.executeScript("window");
obj.setMember("BBSWebBridge", BBSDialog.this);
setVisible(true);
@ -117,29 +116,6 @@ public class BBSDialog extends UIDialog {
});
}
// 在本地浏览器里打开url
private void openUrlAtLocalWebBrowser(WebEngine eng,String url){
if(Desktop.isDesktopSupported()){
try{
//创建一个URI实例,注意不是URL
URI uri = URI.create(url);
//获取当前系统桌面扩展
Desktop desktop = Desktop.getDesktop();
//判断系统桌面是否支持要执行的功能
if(desktop.isSupported(Desktop.Action.BROWSE)){
//获取系统默认浏览器打开链接
desktop.browse(uri);
}
}catch(NullPointerException e){
//此为uri为空时抛出异常
FRLogger.getLogger().error(e.getMessage());
}catch(IOException e){
//此为无法获取系统默认浏览器
FRLogger.getLogger().error(e.getMessage());
}
}
}
/**
* 提供给web页面调用的关闭窗口
*/
@ -147,6 +123,7 @@ public class BBSDialog extends UIDialog {
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.setVisible(false);
}
/**
*
*/

2
designer_base/designer_base.iml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../env/WebReport/WEB-INF/classes" />
<output url="file://$MODULE_DIR$/../../../env/8.0/WebReport/WEB-INF/classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>

16
designer_base/src/com/fr/design/DesignModelAdapter.java

@ -1,9 +1,5 @@
package com.fr.design;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.fr.base.Parameter;
import com.fr.base.io.IOFile;
import com.fr.data.TableDataSource;
@ -13,6 +9,10 @@ import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.stable.js.WidgetName;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* 当前的设计器模式
*
@ -29,6 +29,14 @@ public abstract class DesignModelAdapter<T extends IOFile, S extends JTemplatePr
setCurrentModelAdapter(this);
}
public S getjTemplate() {
return jTemplate;
}
public void setjTemplate(S jTemplate) {
this.jTemplate = jTemplate;
}
public T getBook() {
return (T) ((JTemplate) jTemplate).getTarget();
}

12
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -126,6 +126,16 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private DesignerEnvProcessor envProcessor;
private TableDataTreePaneProcessor tableDataTreePaneProcessor;
public TableDataTreePaneProcessor getTableDataTreePaneProcessor() {
return tableDataTreePaneProcessor;
}
public void setTableDataSourceOPProcessor(Level level, PluginSimplify simplify) {
validAPILevel(level, TableDataTreePaneProcessor.CURRENT_LEVEL, simplify.getPluginName());
tableDataTreePaneProcessor = (TableDataTreePaneProcessor) level;
}
public DesignerEnvProcessor getEnvProcessor() {
return envProcessor;
@ -797,6 +807,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
addSupportDesignApps(impl, simplify);
} else if (tagName.equals(DesignerEnvProcessor.XML_TAG)) {
setEnvProcessor(impl, simplify);
} else if (tagName.equals(TableDataTreePaneProcessor.XML_TAG)) {
setTableDataSourceOPProcessor(impl, simplify);
}
} catch (PluginInvalidLevelException e) {
PluginMessage.remindUpdate(e.getMessage());

8
designer_base/src/com/fr/design/actions/server/PluginManagerAction.java

@ -2,8 +2,10 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginManagerPane;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.PluginShopDialog;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
@ -28,8 +30,8 @@ public class PluginManagerAction extends UpdateAction {
@Override
public void actionPerformed(ActionEvent e) {
final PluginManagerPane managerPane = new PluginManagerPane();
BasicDialog dlg = managerPane.showLargeWindow(DesignerContext.getDesignerFrame(),null);
UIDialog dlg = new PluginShopDialog(DesignerContext.getDesignerFrame(),managerPane);
PluginWebBridge.getHelper().setDialogHandle(dlg);
dlg.setVisible(true);
}

24
designer_base/src/com/fr/design/data/datapane/TableDataSourceOP.java

@ -1,26 +1,22 @@
package com.fr.design.data.datapane;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.fr.general.NameObject;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
import com.fr.design.data.DesignTableDataManager;
import com.fr.data.TableDataSource;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.impl.storeproc.StoreProcedureConstants;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper;
import com.fr.design.data.tabledata.wrapper.StoreProcedureNameWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.UserObjectOP;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import java.util.*;
import java.util.Map.Entry;
/**
* 数据集树的操作
@ -41,6 +37,14 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
this.tc = tc;
}
public DesignModelAdapter<?, ?> getDesignModelAdapter() {
return tc;
}
public void setDesignModelAdapter(DesignModelAdapter<?, ?> tc) {
this.tc = tc;
}
/**
* 初始化数据集的list
*

8
designer_base/src/com/fr/design/data/datapane/TableDataTree.java

@ -31,7 +31,6 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
this.setCellRenderer(tableDataTreeCellRenderer);
this.setEditable(false);
}
// CellRenderer
private DefaultTreeCellRenderer tableDataTreeCellRenderer = new DefaultTreeCellRenderer() {
private static final long serialVersionUID = 1L;
@ -82,6 +81,13 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
}
};
public DefaultTreeCellRenderer getTableDataTreeCellRenderer() {
return tableDataTreeCellRenderer;
}
public void setTableDataTreeCellRenderer(DefaultTreeCellRenderer tableDataTreeCellRenderer) {
this.tableDataTreeCellRenderer = tableDataTreeCellRenderer;
}
protected void refreshTreeNode(ExpandMutableTreeNode eTreeNode, String childName) {
if (interceptRefresh(eTreeNode)) {

80
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -52,9 +52,9 @@ import java.util.Map;
public class TableDataTreePane extends DockingView implements ResponseDataSourceChange {
private static final int PROCEDURE_NAME_INDEX = 4;
private static final int TEMPLATE_TABLE_DATA = 0;
private static final int SERVER_TABLE_DATA = 1;
protected static final int PROCEDURE_NAME_INDEX = 4;
protected static final int TEMPLATE_TABLE_DATA = 0;
protected static final int SERVER_TABLE_DATA = 1;
private static final long serialVersionUID = -12168467370000617L;
private static TableDataTreePane singleton = new TableDataTreePane();
private String type = "";
@ -77,7 +77,7 @@ public class TableDataTreePane extends DockingView implements ResponseDataSource
return singleton;
}
private static TableDataTree dataTree;
private TableDataTree dataTree;
private TableDataSourceOP op;
private MenuDef addMenuDef;
@ -147,6 +147,74 @@ public class TableDataTreePane extends DockingView implements ResponseDataSource
checkButtonEnabled();
}
public void setDataTree(TableDataTree dataTree) {
this.dataTree = dataTree;
}
public TableDataSourceOP getOp() {
return op;
}
public void setOp(TableDataSourceOP op) {
this.op = op;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MenuDef getAddMenuDef() {
return addMenuDef;
}
public void setAddMenuDef(MenuDef addMenuDef) {
this.addMenuDef = addMenuDef;
}
public EditAction getEditAction() {
return editAction;
}
public void setEditAction(EditAction editAction) {
this.editAction = editAction;
}
public RemoveAction getRemoveAction() {
return removeAction;
}
public void setRemoveAction(RemoveAction removeAction) {
this.removeAction = removeAction;
}
public DesignModelAdapter<?, ?> getTc() {
return tc;
}
public void setTc(DesignModelAdapter<?, ?> tc) {
this.tc = tc;
}
public PreviewTableDataAction getPreviewTableDataAction() {
return previewTableDataAction;
}
public void setPreviewTableDataAction(PreviewTableDataAction previewTableDataAction) {
this.previewTableDataAction = previewTableDataAction;
}
public ConnectionTableAction getConnectionTableAction() {
return connectionTableAction;
}
public void setConnectionTableAction(ConnectionTableAction connectionTableAction) {
this.connectionTableAction = connectionTableAction;
}
private KeyAdapter getTableTreeNodeListener() {
return new KeyAdapter() {
@ -227,11 +295,11 @@ public class TableDataTreePane extends DockingView implements ResponseDataSource
/**
* 刷新
*/
public static void refresh() {
public void refresh() {
dataTree.refresh();
}
private void checkButtonEnabled() {
protected void checkButtonEnabled() {
// august:BUG 9344
addMenuDef.setEnabled(true);
connectionTableAction.setEnabled(FRContext.getCurrentEnv() != null && FRContext.getCurrentEnv().isRoot());

742
designer_base/src/com/fr/design/dialog/BasicPane.java

@ -16,380 +16,390 @@ import java.awt.*;
*/
public abstract class BasicPane extends JPanel {
/**
*显示窗口
* @param window 窗口
* @return 对话框
*/
public BasicDialog showWindow(Window window) {
return this.showWindow(window, null);
}
/**
* 显示窗口
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.DEFAULT);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
* @param window 窗口
* @param isNeedButtonsPane 是否需要确定删除按钮
* @return 对话框
*/
public BasicDialog showWindow(Window window, boolean isNeedButtonsPane) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window, isNeedButtonsPane);
} else {
dg = new DIALOG((Dialog) window, isNeedButtonsPane);
}
dg.setBasicDialogSize(BasicDialog.DEFAULT);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 图表类型选择时 弹出的按钮大小, 不适合用最大最小, 因为图表大小 默认是规定好的, 那么界面大小也是必须配合.
* 并且包括 条件显示中 多个条件的大小
* @param window 窗口
* @param l 监听器
* @return 对话框
*/
public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.CHART);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showSmallWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.SMALL);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showMediumWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.MEDIUM);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showLargeWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.LARGE);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public UIDialog showUnsizedWindow(Window window, DialogActionListener l) {
UIDialog dg;
if (window instanceof Frame) {
dg = new UnsizedDialog((Frame) window);
} else {
dg = new UnsizedDialog((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showWindow4ChartMapArray(Window window,DialogActionListener l){
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.MAP_SIZE);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
* @param window 窗口
* @return 对话框
*/
public BasicDialog showWindow4UpdateOnline(Window window){
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window,false);
} else {
dg = new DIALOG((Dialog) window,false);
}
dg.setBasicDialogSize(BasicDialog.UPDATE_ONLINE_SIZE);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
protected abstract String title4PopupWindow();
public String getTitle(){
return title4PopupWindow();
}
/**
* 作为名字面板
* @return 面板
*/
public NamePane asNamePane() {
return new NamePane(this);
}
/**
* 检查是否符合规范
/**
* 显示窗口
*
* @throws Exception 异常
*/
public void checkValid() throws Exception {
}
public static final class NamePane extends BasicPane {
private UITextField nameTextField;
private BasicPane centerPane;
private UILabel showfield;
private PropertyChangeAdapter changeListener;
private NamePane(BasicPane bPane) {
this.setLayout(new BorderLayout(4, 4));
nameTextField = new UITextField(30);
JPanel northPane = new JPanel(new BorderLayout(4, 4));
northPane.add(new UILabel(Inter.getLocText("FR-Designer-Hyperlink_Name") + ":"), BorderLayout.WEST);
northPane.add(nameTextField, BorderLayout.CENTER);
northPane.add(showfield = new UILabel(" "), BorderLayout.EAST);
showfield.setForeground(new Color(204, 0, 1));
showfield.setPreferredSize(new Dimension(220, showfield.getPreferredSize().height));
this.add(northPane, BorderLayout.NORTH);
this.centerPane = bPane;
this.add(bPane, BorderLayout.CENTER);
this.nameTextField.getDocument().addDocumentListener(new javax.swing.event.DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
doTextChanged();
}
@Override
public void removeUpdate(DocumentEvent e) {
doTextChanged();
}
@Override
public void changedUpdate(DocumentEvent e) {
doTextChanged();
}
});
}
private void doTextChanged() {
if (changeListener != null) {
changeListener.propertyChange();
}
}
public String getObjectName() {
return this.nameTextField.getText().trim();
}
public void setObjectName(String name) {
this.nameTextField.setText(name);
}
public void setShowText(String name) {
this.showfield.setText(name);
}
@Override
protected String title4PopupWindow() {
return centerPane.title4PopupWindow();
}
/**
* 检查是否符合规范
*
* @throws Exception 异常
*/
public void checkValid() throws Exception {
super.checkValid();
this.centerPane.checkValid();
}
/**
* 添加属性改变的监听器
* @param listener 监听器
*/
public void addPropertyChangeListener(PropertyChangeAdapter listener) {
this.changeListener = listener;
}
}
private class DIALOG extends BasicDialog {
public DIALOG(Frame parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Dialog parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Frame parent, boolean isNeedButtonPane) {
super(parent, BasicPane.this, isNeedButtonPane);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Dialog parent, boolean isNeedButtonPane) {
super(parent, BasicPane.this, isNeedButtonPane);
this.setTitle(BasicPane.this.title4PopupWindow());
}
/**
* init Components
*/
/**
* Check valid.
*/
public void checkValid() throws Exception {
BasicPane.this.checkValid();
}
* @param window 窗口
* @return 对话框
*/
public BasicDialog showWindow(Window window) {
return this.showWindow(window, null);
}
}
private class UnsizedDialog extends UIDialog {
/**
* 显示窗口
*
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.DEFAULT);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
*
* @param window 窗口
* @param isNeedButtonsPane 是否需要确定删除按钮
* @return 对话框
*/
public BasicDialog showWindow(Window window, boolean isNeedButtonsPane) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window, isNeedButtonsPane);
} else {
dg = new DIALOG((Dialog) window, isNeedButtonsPane);
}
dg.setBasicDialogSize(BasicDialog.DEFAULT);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 图表类型选择时 弹出的按钮大小, 不适合用最大最小, 因为图表大小 默认是规定好的, 那么界面大小也是必须配合.
* 并且包括 条件显示中 多个条件的大小
*
* @param window 窗口
* @param l 监听器
* @return 对话框
*/
public BasicDialog showWindow4ChartType(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.CHART);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
*
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showSmallWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.SMALL);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
*
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showMediumWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.MEDIUM);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
*
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showLargeWindow(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.LARGE);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
*
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public UIDialog showUnsizedWindow(Window window, DialogActionListener l) {
UIDialog dg;
if (window instanceof Frame) {
dg = new UnsizedDialog((Frame) window);
} else {
dg = new UnsizedDialog((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
*
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showWindow4ChartMapArray(Window window, DialogActionListener l) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(BasicDialog.MAP_SIZE);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
/**
* 显示窗口
*
* @param window 窗口
* @return 对话框
*/
public BasicDialog showWindow4UpdateOnline(Window window) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window, false);
} else {
dg = new DIALOG((Dialog) window, false);
}
dg.setBasicDialogSize(BasicDialog.UPDATE_ONLINE_SIZE);
GUICoreUtils.centerWindow(dg);
dg.setResizable(false);
return dg;
}
protected abstract String title4PopupWindow();
public String getTitle() {
return title4PopupWindow();
}
/**
* 作为名字面板
*
* @return 面板
*/
public NamePane asNamePane() {
return new NamePane(this);
}
public UnsizedDialog(Frame parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
/**
* 检查是否符合规范
*
* @throws Exception 异常
*/
public void checkValid() throws Exception {
}
public static final class NamePane extends BasicPane {
private UITextField nameTextField;
private BasicPane centerPane;
private UILabel showfield;
private PropertyChangeAdapter changeListener;
private NamePane(BasicPane bPane) {
this.setLayout(new BorderLayout(4, 4));
nameTextField = new UITextField(30);
JPanel northPane = new JPanel(new BorderLayout(4, 4));
northPane.add(new UILabel(Inter.getLocText("FR-Designer-Hyperlink_Name") + ":"), BorderLayout.WEST);
northPane.add(nameTextField, BorderLayout.CENTER);
northPane.add(showfield = new UILabel(" "), BorderLayout.EAST);
showfield.setForeground(new Color(204, 0, 1));
showfield.setPreferredSize(new Dimension(220, showfield.getPreferredSize().height));
this.add(northPane, BorderLayout.NORTH);
this.centerPane = bPane;
this.add(bPane, BorderLayout.CENTER);
this.nameTextField.getDocument().addDocumentListener(new javax.swing.event.DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
doTextChanged();
}
@Override
public void removeUpdate(DocumentEvent e) {
doTextChanged();
}
@Override
public void changedUpdate(DocumentEvent e) {
doTextChanged();
}
});
}
private void doTextChanged() {
if (changeListener != null) {
changeListener.propertyChange();
}
}
public String getObjectName() {
return this.nameTextField.getText().trim();
}
public void setObjectName(String name) {
this.nameTextField.setText(name);
}
public void setShowText(String name) {
this.showfield.setText(name);
}
@Override
protected String title4PopupWindow() {
return centerPane.title4PopupWindow();
}
/**
* 检查是否符合规范
*
* @throws Exception 异常
*/
public void checkValid() throws Exception {
super.checkValid();
this.centerPane.checkValid();
}
/**
* 添加属性改变的监听器
*
* @param listener 监听器
*/
public void addPropertyChangeListener(PropertyChangeAdapter listener) {
this.changeListener = listener;
}
}
private class DIALOG extends BasicDialog {
public DIALOG(Frame parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Dialog parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Frame parent, boolean isNeedButtonPane) {
super(parent, BasicPane.this, isNeedButtonPane);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Dialog parent, boolean isNeedButtonPane) {
super(parent, BasicPane.this, isNeedButtonPane);
this.setTitle(BasicPane.this.title4PopupWindow());
}
/**
* init Components
*/
/**
* Check valid.
*/
public void checkValid() throws Exception {
BasicPane.this.checkValid();
}
}
public UnsizedDialog(Dialog parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
private class UnsizedDialog extends UIDialog {
public UnsizedDialog(Frame parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public UnsizedDialog(Dialog parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public void checkValid() throws Exception {
BasicPane.this.checkValid();
}
public void checkValid() throws Exception {
BasicPane.this.checkValid();
}
}
}
}

31
designer_base/src/com/fr/design/extra/PluginManagerPane.java

@ -2,23 +2,9 @@ package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.scene.web.WebEngine;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.swing.*;
import java.awt.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
/**
@ -37,15 +23,14 @@ public class PluginManagerPane extends BasicPane {
public PluginManagerPane() {
setLayout(new BorderLayout());
// if (StableUtils.isDebug()) {
// URL url = ClassLoader.getSystemResource("");
// String installHome = url.getPath();
// PluginWebPane webPane = new PluginWebPane(installHome);
// add(webPane, BorderLayout.CENTER);
// } else {
//
// }
initTraditionalStore();
if (System.getProperty("java.version").startsWith("1.8")) {
URL url = ClassLoader.getSystemResource("");
String installHome = url.getPath();
PluginWebPane webPane = new PluginWebPane(installHome);
add(webPane, BorderLayout.CENTER);
} else {
initTraditionalStore();
}
}
private void initTraditionalStore() {

25
designer_base/src/com/fr/design/extra/PluginShopDialog.java

@ -0,0 +1,25 @@
package com.fr.design.extra;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import java.awt.*;
/**
* Created by vito on 16/4/18.
*/
public class PluginShopDialog extends UIDialog {
private static final Dimension DEFAULT_SHOP = new Dimension(900, 710);
public PluginShopDialog(Frame frame, BasicPane pane) {
super(frame, pane, false);
setSize(DEFAULT_SHOP);
GUICoreUtils.centerWindow(this);
setResizable(false);
}
@Override
public void checkValid() throws Exception {
}
}

4
designer_base/src/com/fr/design/extra/PluginStatusCheckCompletePane.java

@ -67,8 +67,8 @@ public abstract class PluginStatusCheckCompletePane extends PluginAbstractViewPa
public void setProgress(double percent) {
progressBar.setVisible(true);
progressBar.setValue((int)percent);
progressBar.setString((int)percent + "%");
progressBar.setValue((int) percent);
progressBar.setString((int) percent + "%");
progressBar.repaint();
}

31
designer_base/src/com/fr/design/extra/PluginTask.java

@ -2,6 +2,7 @@ package com.fr.design.extra;
import com.fr.design.extra.exe.Executor;
import com.fr.design.extra.exe.Command;
import com.fr.stable.StringUtils;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Task;
@ -10,6 +11,7 @@ import netscape.javascript.JSObject;
/**
* 插件安装,卸载,更新等任务
*
* @param <T>
*/
public class PluginTask<T> extends Task<T> {
@ -25,7 +27,7 @@ public class PluginTask<T> extends Task<T> {
messageProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
String fun = "(" + callback + ")('" + newValue + "')";
String fun = "(" + callback + ")(\"" + newValue + "\")";
try {
webEngine.executeScript(fun);
} catch (Exception e) {
@ -40,14 +42,35 @@ public class PluginTask<T> extends Task<T> {
Command[] commands = executor.getCommands();
for (Command command : commands) {
String message = command.getExecuteMessage();
updateMessage(message);
command.run();
if (StringUtils.isNotBlank(message)) {
updateMessage(message);
}
command.run(new Process<String>() {
@Override
public void process(String s) {
if (StringUtils.isNotBlank(s)) {
updateMessage(changText(s));
}
}
});
}
return null;
}
@Override
protected void done() {
updateMessage(executor.getTaskFinishMessage());
updateMessage(changText(executor.getTaskFinishMessage()));
}
/**
* 转换掉一些会造成错误的特殊字符
* 1 ""中的""必须转义
* 2 js字符串中的\n会导致js字符串变成多行,而js字符创不支持多行拼接
*
* @param old 原始字符串
* @return 处理之后的字符串
*/
private String changText(String old) {
return old.replaceAll("\"", "\\\\\"").replaceAll("\n", "");
}
}

22
designer_base/src/com/fr/design/extra/PluginUpdatePane.java

@ -25,7 +25,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
private PluginControlPane controlPane;
private JLabel errorMsgLabel;
private UITabbedPane tabbedPane;
private static final int PERSENT = 100;
public PluginUpdatePane(UITabbedPane tabbedPane) {
@ -35,6 +35,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
/**
* 更新pane
*
* @return 同上
*/
public JPanel createSuccessPane() {
@ -56,7 +57,6 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
}
@Override
public String textForInstallFromDiskButton() {
return Inter.getLocText("FR-Designer_Plugin_Normal_Update_From_Local");
@ -79,6 +79,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
/**
* 出错pane
*
* @return 同上
*/
@Override
@ -104,7 +105,6 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
}
@Override
public String textForInstallFromDiskButton() {
return Inter.getLocText("FR-Designer_Plugin_Normal_Update_From_Local");
@ -119,6 +119,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
/**
* 加载插件
*
* @return 所有插件
*/
public Plugin[] loadData() throws Exception {
@ -127,7 +128,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
/**
* 加载成功处理
*
*
* @param plugins 插件
*/
public void loadOnSuccess(Plugin[] plugins) {
@ -137,7 +138,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
/**
* 加载失败处理
*
*
* @param e 异常
*/
public void loadOnFailed(Exception e) {
@ -146,6 +147,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
/**
*
*
* @return
*/
@Override
@ -165,11 +167,11 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
}
private void doUpdateOnline(final PluginStatusCheckCompletePane pane) {
if (StringUtils.isEmpty(DesignerEnvManager.getEnvManager().getBBSName())){
if (StringUtils.isEmpty(DesignerEnvManager.getEnvManager().getBBSName())) {
LoginCheckContext.fireLoginCheckListener();
}
if (StringUtils.isNotEmpty(DesignerEnvManager.getEnvManager().getBBSName())){
new SwingWorker<Void, Double>(){
if (StringUtils.isNotEmpty(DesignerEnvManager.getEnvManager().getBBSName())) {
new SwingWorker<Void, Double>() {
@Override
protected Void doInBackground() throws Exception {
@ -181,7 +183,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
PluginHelper.downloadPluginFile(id,username,password, new Process<Double>() {
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() {
@Override
public void process(Double integer) {
publish(integer);
@ -264,12 +266,14 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<Plugin[], Vo
/**
* 从磁盘安装按钮的提示
*
* @return 按钮标题字符串
*/
@Override
public String textForInstallFromDiskFileButton() {
return Inter.getLocText("FR-Designer_Plugin_Normal_Update_From_Local");
}
@Override
protected String title4PopupWindow() {
return "Update";

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

@ -1,8 +1,11 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.*;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader;
import com.fr.stable.ArrayUtils;
@ -13,7 +16,11 @@ import javafx.stage.FileChooser;
import javafx.stage.Stage;
import netscape.javascript.JSObject;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@ -24,24 +31,41 @@ public class PluginWebBridge {
private static PluginWebBridge helper;
public static PluginWebBridge getHelper(WebEngine webEngine) {
private UIDialog uiDialog;
public static final String PLUGIN_SHOP = "http://192.168.101.20/ShopServer?pg=plist";
public static PluginWebBridge getHelper() {
if (helper != null) {
return helper;
}
synchronized (PluginWebBridge.class) {
if (helper == null) {
helper = new PluginWebBridge(webEngine);
helper = new PluginWebBridge();
}
return helper;
}
}
public static PluginWebBridge getHelper(WebEngine webEngine) {
getHelper();
helper.setEngine(webEngine);
return helper;
}
private WebEngine webEngine;
private PluginWebBridge(WebEngine webEngine) {
private PluginWebBridge() {
}
public void setEngine(WebEngine webEngine) {
this.webEngine = webEngine;
}
public void setDialogHandle(UIDialog uiDialog) {
this.uiDialog = uiDialog;
}
/**
* 从插件服务器上安装插件
*
@ -76,10 +100,10 @@ public class PluginWebBridge {
/**
* 从插件服务器上更新选中的插件
*
* @param pluginID 插件的ID
* @param pluginIDs 插件集合
*/
public void updatePluginOnline(String pluginID, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new UpdateOnlineExecutor(pluginID));
public void updatePluginOnline(JSObject pluginIDs, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new UpdateOnlineExecutor(jsObjectToStringArray(pluginIDs)));
new Thread(task).start();
}
@ -97,10 +121,17 @@ public class PluginWebBridge {
* 修改选中的插件的活跃状态
*
* @param pluginID 插件ID
* @param active 如果要把插件修改为激活状态,则为true,否则为false
*/
public void setPluginActive(String pluginID, boolean active, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new ModifyStatusExecutor(pluginID, active));
public void setPluginActive(String pluginID, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new ModifyStatusExecutor(pluginID));
new Thread(task).start();
}
/**
* 已安装插件检查更新
*/
public void readUpdateOnline(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new ReadUpdateOnlineExecutor());
new Thread(task).start();
}
@ -157,6 +188,7 @@ public class PluginWebBridge {
/**
* 获取已经安装的插件的数组
*
* @return 已安装的插件组成的数组
*/
public Plugin[] getInstalledPlugins() {
@ -174,4 +206,144 @@ public class PluginWebBridge {
}
return list.toArray(new String[len]);
}
/**
* 搜索在线插件
*
* @param keyword 关键字
*/
public void searchPlugin(String keyword, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new SearchOnlineExecutor(keyword));
new Thread(task).start();
}
/**
* 根据条件获取在线插件的
*
* @param category 分类
* @param seller 卖家性质
* @param fee 收费类型
* @param callback 回调函数
*/
public void getPluginFromStore(String category, String seller, String fee, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(category, seller, fee));
new Thread(task).start();
}
/**
* 展示一个重启的对话框(少用,莫名其妙会有bug)
*
* @param message 展示的消息
*/
public void showRestartMessage(String message) {
int rv = JOptionPane.showOptionDialog(
null,
message,
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")},
null
);
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
}
/**
* 关闭窗口
*/
public void closeWindow() {
if (uiDialog != null) {
uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
uiDialog.setVisible(false);
}
}
/**
* 在本地浏览器里打开url
*
* @param eng web引擎
* @param url 要打开的地址
*/
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
if (Desktop.isDesktopSupported()) {
try {
//创建一个URI实例,注意不是URL
URI uri = URI.create(url);
//获取当前系统桌面扩展
Desktop desktop = Desktop.getDesktop();
//判断系统桌面是否支持要执行的功能
if (desktop.isSupported(Desktop.Action.BROWSE)) {
//获取系统默认浏览器打开链接
desktop.browse(uri);
}
} catch (NullPointerException e) {
//此为uri为空时抛出异常
FRLogger.getLogger().error(e.getMessage());
} catch (IOException e) {
//此为无法获取系统默认浏览器
FRLogger.getLogger().error(e.getMessage());
}
}
}
public void openUrlAtLocalWebBrowser(String url) {
openUrlAtLocalWebBrowser(webEngine, url);
}
/**
* 从硬盘升级
*
* @param fileOnDisk 硬盘上的文件
*/
public void updateFileFromDisk(File fileOnDisk) {
try {
Plugin plugin = PluginHelper.readPlugin(fileOnDisk);
if (plugin == null) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return;
}
Plugin oldPlugin = PluginLoader.getLoader().getPluginById(plugin.getId());
if (oldPlugin != null) {
// 说明安装了同ID的插件,再比较两个插件的版本
if (PluginHelper.isNewThan(plugin, oldPlugin)) {
// 说明是新的插件,删除老的然后安装新的
final String[] files = PluginHelper.uninstallPlugin(FRContext.getCurrentEnv(), oldPlugin);
PluginHelper.installPluginFromUnzippedTempDir(FRContext.getCurrentEnv(), plugin, new After() {
@Override
public void done() {
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Update_Successful"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"),
Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")
},
null
);
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
// 如果不是立即重启,就把要删除的文件存放起来
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
RestartHelper.saveFilesWhichToDelete(files);
}
}
});
} else {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Version_Is_Lower_Than_Current"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
} else {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Cannot_Update_Not_Install"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e1) {
JOptionPane.showMessageDialog(null, e1.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}

33
designer_base/src/com/fr/design/extra/PluginWebPane.java

@ -1,10 +1,13 @@
package com.fr.design.extra;
import com.fr.general.FRLogger;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
@ -24,7 +27,7 @@ public class PluginWebPane extends JFXPanel {
Platform.runLater(new Runnable() {
@Override
public void run() {
Group root = new Group();
BorderPane root = new BorderPane();
Scene scene = new Scene(root);
PluginWebPane.this.setScene(scene);
WebView webView = new WebView();
@ -36,13 +39,33 @@ public class PluginWebPane extends JFXPanel {
showAlert(event.getData());
}
});
webEngine.locationProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) {
disableLink(webEngine);
PluginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue);
}
});
JSObject obj = (JSObject) webEngine.executeScript("window");
obj.setMember("PluginHelper", PluginWebBridge.getHelper(webEngine));
root.getChildren().add(webView);
root.setCenter(webView);
}
});
}
private void disableLink(final WebEngine webEngine) {
try {
Platform.runLater(new Runnable() {
@Override
public void run() {
webEngine.executeScript("history.go(0)");
}
});
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
@ -50,9 +73,5 @@ public class PluginWebPane extends JFXPanel {
JOptionPane.showMessageDialog(PluginWebPane.this, message);
}
});
// Dialog<Void> alert = new Dialog<>();
// alert.getDialogPane().setContentText(message);
// alert.getDialogPane().getButtonTypes().add(ButtonType.OK);
// alert.showAndWait();
}
}

4
designer_base/src/com/fr/design/extra/exe/Command.java

@ -1,5 +1,7 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.Process;
/**
* Created by richie on 16/3/19.
*/
@ -7,5 +9,5 @@ public interface Command {
String getExecuteMessage();
void run();
void run(Process<String> process);
}

61
designer_base/src/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java

@ -0,0 +1,61 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils;
/**
* Created by vito on 16/4/18.
* 获取插件分类信息
*/
public class GetPluginFromStoreExecutor implements Executor {
private String result = "[]";
private String category;
private String seller;
private String fee;
public GetPluginFromStoreExecutor(String category, String seller, String fee) {
this.category = category;
this.seller = seller;
this.fee = fee;
}
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
StringBuilder url = new StringBuilder(PluginWebBridge.PLUGIN_SHOP);
if (StringUtils.isNotBlank(category)) {
url.append("&cid=").append(category.split("-")[1]);
}
if (StringUtils.isNotBlank(seller)) {
url.append("&seller=").append(seller.split("-")[1]);
}
if (StringUtils.isNotBlank(fee)) {
url.append("&fee=").append(fee.split("-")[1]);
}
try {
HttpClient httpClient = new HttpClient(url.toString());
result = httpClient.getResponseText();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
};
}
}

35
designer_base/src/com/fr/design/extra/exe/InstallFromDiskExecutor.java

@ -1,5 +1,16 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.After;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.plugin.PluginVerifyException;
import javax.swing.*;
import java.io.File;
/**
* Created by richie on 16/3/19.
*/
@ -26,12 +37,8 @@ public class InstallFromDiskExecutor implements Executor {
}
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
public void run(Process<java.lang.String> process) {
}
},
new Command() {
@ -41,11 +48,19 @@ public class InstallFromDiskExecutor implements Executor {
}
@Override
public void run() {
public void run(Process<String> process) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
PluginHelper.installPluginFromDisk(new File(filePath), new After() {
@Override
public void done() {
FRLogger.getLogger().info("插件安装成功");
PluginWebBridge.getHelper().showRestartMessage(Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
}
});
} catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}

53
designer_base/src/com/fr/design/extra/exe/InstallOnlineExecutor.java

@ -1,5 +1,16 @@
package com.fr.design.extra.exe;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.extra.After;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.Inter;
import com.fr.plugin.PluginVerifyException;
import javax.swing.*;
/**
* Created by richie on 16/3/19.
*/
@ -13,7 +24,7 @@ public class InstallOnlineExecutor implements Executor {
@Override
public String getTaskFinishMessage() {
return "已成功安裝";
return "task succeed";
}
@Override
@ -26,11 +37,18 @@ public class InstallOnlineExecutor implements Executor {
}
@Override
public void run() {
public void run(final Process<String> process) {
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
PluginHelper.downloadPluginFile(pluginID, username, password, new Process<Double>() {
@Override
public void process(Double integer) {
process.process(Math.round(integer * 100) + "%");
}
});
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
},
@ -41,11 +59,32 @@ public class InstallOnlineExecutor implements Executor {
}
@Override
public void run() {
public void run(Process<String> process) {
try {
Thread.sleep(3000);
PluginHelper.installPluginFromDisk(PluginHelper.getDownloadTempFile(), new After() {
@Override
public void done() {
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Install_Successful"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")},
null
);
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
}
});
} catch (PluginVerifyException e) {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}

36
designer_base/src/com/fr/design/extra/exe/ModifyStatusExecutor.java

@ -1,5 +1,13 @@
package com.fr.design.extra.exe;
import com.fr.base.FRContext;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.Process;
import com.fr.general.Inter;
import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader;
import com.fr.stable.StringUtils;
/**
* Created by richie on 16/3/19.
*/
@ -7,19 +15,39 @@ public class ModifyStatusExecutor implements Executor {
private String pluginID;
private boolean active;
private Plugin plugin;
public ModifyStatusExecutor(String pluginID, boolean active) {
public ModifyStatusExecutor(String pluginID) {
this.pluginID = pluginID;
this.active = active;
}
@Override
public String getTaskFinishMessage() {
return "插件" + pluginID + "已更改为可用状态:" + active;
return plugin.isActive() ? Inter.getLocText("FR-Designer-Plugin_Has_Been_Actived") : Inter.getLocText("FR-Designer-Plugin_Has_Been_Disabled");
}
@Override
public Command[] getCommands() {
return new Command[0];
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
plugin = PluginLoader.getLoader().getPluginById(pluginID);
active = !plugin.isActive();
plugin.setActive(active);
try {
FRContext.getCurrentEnv().writePlugin(plugin);
PluginWebBridge.getHelper().showRestartMessage(plugin.isActive() ? Inter.getLocText("FR-Designer-Plugin_Has_Been_Actived") : Inter.getLocText("FR-Designer-Plugin_Has_Been_Disabled"));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
}
}
};
}
}

50
designer_base/src/com/fr/design/extra/exe/ReadUpdateOnlineExecutor.java

@ -0,0 +1,50 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginsReaderFromStore;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.plugin.Plugin;
import com.fr.stable.StringUtils;
/**
* Created by vito on 16/4/19.
*/
public class ReadUpdateOnlineExecutor implements Executor {
private Plugin[] plugins;
private String result;
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
try {
plugins = PluginsReaderFromStore.readPluginsForUpdate();
StringBuilder sb = new StringBuilder();
if (plugins != null) {
sb.append("[");
for (Plugin plugin : plugins) {
sb.append("{pluginid:'").append(plugin.getId()).append("'}");
}
sb.append("]");
}
result = sb.toString();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
};
}
}

47
designer_base/src/com/fr/design/extra/exe/SearchOnlineExecutor.java

@ -0,0 +1,47 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.Process;
import com.fr.general.FRLogger;
import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils;
/**
* Created by vito on 16/4/18.
*/
public class SearchOnlineExecutor implements Executor {
private String result;
private String keyword;
public SearchOnlineExecutor(String keyword) {
this.keyword = keyword;
}
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return StringUtils.EMPTY;
}
@Override
public void run(Process<String> process) {
try {
HttpClient httpClient = new HttpClient(PluginWebBridge.PLUGIN_SHOP + "&keyword=" + keyword);
result = httpClient.getResponseText();
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
};
}
}

51
designer_base/src/com/fr/design/extra/exe/UninstallExecutor.java

@ -1,5 +1,15 @@
package com.fr.design.extra.exe;
import com.fr.base.FRContext;
import com.fr.design.RestartHelper;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.Inter;
import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader;
import javax.swing.*;
/**
* Created by richie on 16/3/19.
*/
@ -18,6 +28,45 @@ public class UninstallExecutor implements Executor {
@Override
public Command[] getCommands() {
return new Command[0];
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return "删除成功";
}
@Override
public void run(Process<String> process) {
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Will_Be_Delete"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"),
Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later"),
Inter.getLocText("FR-Designer-Basic_Cancel")
},
null
);
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
return;
}
for (String pluginID : pluginIDs) {
try {
Plugin plugin = PluginLoader.getLoader().getPluginById(pluginID);
String[] filesToBeDelete = PluginHelper.uninstallPlugin(FRContext.getCurrentEnv(), plugin);
RestartHelper.saveFilesWhichToDelete(filesToBeDelete);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
}
}
};
}
}

21
designer_base/src/com/fr/design/extra/exe/UpdateFromDiskExecutor.java

@ -1,5 +1,10 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.Process;
import java.io.File;
/**
* Created by richie on 16/3/19.
*/
@ -13,11 +18,23 @@ public class UpdateFromDiskExecutor implements Executor {
@Override
public String getTaskFinishMessage() {
return "插件已更新完毕";
return "插件更新操作结束";
}
@Override
public Command[] getCommands() {
return new Command[0];
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
PluginWebBridge.getHelper().updateFileFromDisk(new File(filePath));
}
}
};
}
}

95
designer_base/src/com/fr/design/extra/exe/UpdateOnlineExecutor.java

@ -1,23 +1,106 @@
package com.fr.design.extra.exe;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.extra.After;
import com.fr.design.extra.PluginHelper;
import com.fr.design.extra.Process;
import com.fr.general.Inter;
import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLoader;
import javax.swing.*;
import java.io.File;
/**
* Created by richie on 16/3/19.
*/
public class UpdateOnlineExecutor implements Executor {
private String pluginID;
public UpdateOnlineExecutor(String pluginID) {
this.pluginID = pluginID;
private String[] pluginIDs;
private static final int PERCENT_100 = 100;
public UpdateOnlineExecutor(String[] pluginIDs) {
this.pluginIDs = pluginIDs;
}
@Override
public String getTaskFinishMessage() {
return "插件已更新完毕:" + pluginID;
return "task succeed";
}
@Override
public Command[] getCommands() {
return new Command[0];
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
for (int i = 0; i < pluginIDs.length; i++) {
Plugin plugin = PluginLoader.getLoader().getPluginById(pluginIDs[i]);
String id = null;
if (plugin != null) {
id = plugin.getId();
}
String username = DesignerEnvManager.getEnvManager().getBBSName();
String password = DesignerEnvManager.getEnvManager().getBBSPassword();
try {
PluginHelper.downloadPluginFile(id, username, password, new Process<Double>() {
@Override
public void process(Double integer) {
}
});
updateFileFromDisk(PluginHelper.getDownloadTempFile());
process.process(PERCENT_100 / pluginIDs.length * (i + 1) + "%");
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer-Plugin_Update_Successful"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"),
Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")
},
null
);
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
}
}
};
}
private void updateFileFromDisk(File fileOnDisk) {
try {
Plugin plugin = PluginHelper.readPlugin(fileOnDisk);
if (plugin == null) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Illegal_Plugin_Zip"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return;
}
Plugin oldPlugin = PluginLoader.getLoader().getPluginById(plugin.getId());
if (oldPlugin != null) {
String[] files = PluginHelper.uninstallPlugin(FRContext.getCurrentEnv(), oldPlugin);
PluginHelper.installPluginFromUnzippedTempDir(FRContext.getCurrentEnv(), plugin, new After() {
@Override
public void done() {
}
});
} else {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Cannot_Update_Not_Install"), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e1) {
JOptionPane.showMessageDialog(null, e1.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
}
}
}

22
designer_base/src/com/fr/design/fun/TableDataTreePaneProcessor.java

@ -0,0 +1,22 @@
package com.fr.design.fun;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.stable.fun.Level;
/**
* 自定义的模板服务器数据集的树样式接口 el:分组样式
* Coder: zack
* Date: 2016/4/18
* Time: 9:04
*/
public interface TableDataTreePaneProcessor extends Level {
String XML_TAG = "TableDataTreePaneProcessor";
int CURRENT_LEVEL = 1;
/**
* 创建数据集面板
* @return 数据集面板
*/
TableDataTreePane createTableDataTreePane();
}

15
designer_base/src/com/fr/design/fun/impl/AbstractTDTreePaneProcessor.java

@ -0,0 +1,15 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.TableDataTreePaneProcessor;
/**
* Coder: zack
* Date: 2016/4/18
* Time: 10:30
*/
public abstract class AbstractTDTreePaneProcessor implements TableDataTreePaneProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

7
designer_base/src/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java

@ -9,6 +9,7 @@ import javax.swing.tree.*;
import com.fr.general.NameObject;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.itooltip.UIToolTip;
import com.fr.design.gui.itree.checkboxtree.CheckBoxTree;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
@ -16,7 +17,7 @@ import com.fr.stable.StringUtils;
import java.awt.*;
import java.awt.event.MouseEvent;
public abstract class RefreshableJTree extends JTree {
public abstract class RefreshableJTree extends CheckBoxTree {
private static final int WIDTH_BETWEEN_NODES = 20; //tree父子节点之间最左侧横向像素的差
private Icon icon;
@ -31,7 +32,9 @@ public abstract class RefreshableJTree extends JTree {
public RefreshableJTree() {
this(null);
}
public boolean isCheckBoxVisible(TreePath path) {
return false;
}
public RefreshableJTree(Object rootObj) {
super(new DefaultTreeModel(new ExpandMutableTreeNode(rootObj)));
DefaultTreeModel model = (DefaultTreeModel) getModel();

2
designer_base/src/com/fr/design/gui/itree/refreshabletree/UserObjectRefreshJTree.java

@ -133,7 +133,7 @@ public abstract class UserObjectRefreshJTree<T extends UserObjectOP<?>> extends
super.setSelectionPath(treePath);
}
private MouseListener treeMouseListener = new MouseAdapter() {
protected MouseListener treeMouseListener = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
TreePath path = getPathForLocation(e.getX(), e.getY());

20
designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java

@ -1,11 +1,15 @@
package com.fr.design.mainframe;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.fun.TableDataTreePaneProcessor;
import com.fr.design.gui.icontainer.UIResizableContainer;
import com.fr.stable.Constants;
import javax.swing.*;
public class WestRegionContainerPane extends UIResizableContainer {
private static WestRegionContainerPane THIS;
@ -16,15 +20,23 @@ public class WestRegionContainerPane extends UIResizableContainer {
*/
public static final WestRegionContainerPane getInstance() {
if (THIS == null) {
THIS = new WestRegionContainerPane();
TableDataTreePane tableDataTreePane = null;
TableDataTreePaneProcessor treePaneProcessor = ExtraDesignClassManager.getInstance().getTableDataTreePaneProcessor();
if (treePaneProcessor != null) {
tableDataTreePane = treePaneProcessor.createTableDataTreePane();
} else {
tableDataTreePane = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
}
THIS = new WestRegionContainerPane(tableDataTreePane);
THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastWestRegionToolPaneY());
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth());
}
return THIS;
}
public WestRegionContainerPane() {
super(DesignerFrameFileDealerPane.getInstance(), TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()), Constants.RIGHT);
public WestRegionContainerPane(JComponent pane) {
super(DesignerFrameFileDealerPane.getInstance(), pane, Constants.RIGHT);
setContainerWidth(165);
}
}

2
designer_base/src/com/fr/design/roleAuthority/RoleTree.java

File diff suppressed because one or more lines are too long

2
designer_form/src/com/fr/design/designer/beans/painters/FRFitLayoutPainter.java

@ -93,6 +93,8 @@ public class FRFitLayoutPainter extends AbstractPainter{
int containerHeight = container.getHeight();
// 当前坐标点
Rectangle currentXY = new Rectangle(x, y, 1, 1);
hot_rec = new int[]{0, 0, 0, 0};
// 上边缘
Rectangle upEdge = new Rectangle(containerX, containerY, containerWidth, BORDER_PROPORTION);
if(upEdge.intersects(currentXY)){

Loading…
Cancel
Save