Browse Source

REPORT-9423 去掉isLocal判断

master
ju 7 years ago
parent
commit
dacbab4a25
  1. 7
      designer-base/src/com/fr/design/env/RemoteWorkspace.java
  2. 93
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java

7
designer-base/src/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,6 +1,7 @@
package com.fr.design.env;
import com.fr.env.operator.decision.DecisionOperator;
import com.fr.locale.InterProviderFactory;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceClient;
@ -28,6 +29,12 @@ public class RemoteWorkspace implements Workspace {
return address;
}
@Override
public String getDescription() {
return InterProviderFactory.getProvider().getLocText("Fine-Designer_Basic_Remote_Env");
}
@Override
public boolean isWarDeploy() {

93
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -41,7 +41,6 @@ import com.fr.file.FileNodeFILE;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
@ -84,13 +83,21 @@ import java.util.Iterator;
import java.util.List;
public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener {
public static final String DESIGNER_FRAME_NAME = "designer_frame";
public static final Dimension MIN_SIZE = new Dimension(100, 100);
private static final long serialVersionUID = -8732559571067484460L;
private static final int LEFT_ALIGN_GAP = -5;
private static final int MENU_HEIGHT = 26;
private static final Integer SECOND_LAYER = new Integer(100);
private static final Integer TOP_LAYER = new Integer((200));
private static java.util.List<App<?>> appList = new java.util.ArrayList<App<?>>();
private List<DesignerOpenedListener> designerOpenedListenerList = new ArrayList<>();
@ -100,18 +107,28 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private DesktopCardPane centerTemplateCardPane;
private JPanel toolbarPane;
private JComponent toolbarComponent;
private JPanel menuPane;
private JMenuBar menuBar;
private JPanel eastCenterPane;
private UIToolbar combineUp;
private NewTemplatePane newWorkBookPane = null;
private Icon closeMode = UIConstants.CLOSE_OF_AUTHORITY;
private JLayeredPane layeredPane = this.getLayeredPane();
private JPanel basePane = new JPanel();
// 上面的虚线
private DottedLine upDottedLine;
// 下面的虚线
private DottedLine downDottedLine;
@ -122,15 +139,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private DottedLine rightDottedLine;
private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth());
private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight());
private WindowAdapter windowAdapter = new WindowAdapter() {
public void windowOpened(WindowEvent e) {
}
@Override
public void windowClosing(WindowEvent e) {
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true);
// 只有一个文件未保存时
if (HistoryTemplateListPane.getInstance().getHistoryCount() == 1) {
@ -148,7 +168,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
};
private JComponent closeButton = new JComponent() {
protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillArc(0, 0, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH,
0, 360);
@ -157,25 +179,30 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
};
private MouseListener closeMouseListener = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
closeMode = UIConstants.CLOSE_PRESS_AUTHORITY;
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.repaint();
}
public void mouseExited(MouseEvent e) {
closeMode = UIConstants.CLOSE_OF_AUTHORITY;
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.repaint();
}
public void mouseMoved(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.repaint();
}
public void mouseReleased(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) {
BaseUtils.setAuthorityEditing(false);
WestRegionContainerPane.getInstance().replaceDownPane(
@ -190,11 +217,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public void mouseEntered(MouseEvent e) {
closeMode = UIConstants.CLOSE_OVER_AUTHORITY;
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.repaint();
}
};
private ProgressDialog progressDialog;
public DesignerFrame(ToolBarMenuDock ad) {
@ -209,7 +238,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// the content pane
basePane.setLayout(new BorderLayout());
toolbarPane = new JPanel() {
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
// dim.height = TOOLBAR_HEIGHT;
return dim;
@ -252,7 +283,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.addWindowListeners(getFrameListeners());
this.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
reCalculateFrameSize();
if (BaseUtils.isAuthorityEditing()) {
doResize();
@ -260,8 +293,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
});
this.addDesignerOpenedListener(new DesignerOpenedListener() {
@Override
public void designerOpened() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite();
reCalculateFrameSize();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize();
@ -282,6 +317,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param app 注册app.
*/
public static void registApp(App<?> app) {
if (app != null) {
appList.add(app);
}
@ -298,6 +334,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 注册"设计器初始化完成"的监听
*/
public void addDesignerOpenedListener(DesignerOpenedListener listener) {
designerOpenedListenerList.add(listener);
}
@ -305,12 +342,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 触发"设计器初始化完成"事件
*/
public void fireDesignerOpened() {
for (DesignerOpenedListener listener : designerOpenedListenerList) {
listener.designerOpened();
}
}
protected DesktopCardPane getCenterTemplateCardPane() {
return centerTemplateCardPane;
}
@ -318,6 +357,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 初始menuPane的方法 方便OEM时修改该组件
*/
protected void initMenuPane() {
menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH);
menuPane.add(initNorthEastPane(ad), BorderLayout.EAST);
@ -355,6 +395,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) {
northEastPane.removeAll();
northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
northEastPane.add(LogMessageBar.getInstance());
@ -370,6 +411,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public void initTitleIcon() {
try {
@SuppressWarnings("unchecked")
List<BufferedImage> image = ICODecoder.read(DesignerFrame.class
@ -382,12 +424,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
private void addWindowListeners(ArrayList<WindowListener> listeners) {
for (WindowListener listener : listeners) {
this.addWindowListener(listener);
}
}
protected ArrayList<WindowListener> getFrameListeners() {
ArrayList<WindowListener> arrayList = new ArrayList<WindowListener>();
arrayList.add(windowAdapter);
return arrayList;
@ -395,11 +439,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
protected void laoyoutWestPane() {
basePane.add(WestRegionContainerPane.getInstance(), BorderLayout.WEST);
}
// 调整windows大小
private void reCalculateFrameSize() {
contentHeight = layeredPane.getHeight();
contentWidth = layeredPane.getWidth();
layeredPane.remove(basePane);
@ -412,6 +458,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 更新
*/
public void populateAuthorityArea() {
int centerWidth = contentWidth - WestRegionContainerPane.getInstance().getContainerWidth()
- EastRegionContainerPane.getInstance().getContainerWidth();
// 上面的虚线
@ -436,6 +483,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
private void addDottedLine() {
layeredPane.add(upDottedLine, SECOND_LAYER);
layeredPane.add(downDottedLine, SECOND_LAYER);
layeredPane.add(leftDottedLine, SECOND_LAYER);
@ -444,6 +492,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
private void removeDottedLine() {
layeredPane.remove(upDottedLine);
layeredPane.remove(downDottedLine);
layeredPane.remove(leftDottedLine);
@ -452,6 +501,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public JLayeredPane getContentFrame() {
return layeredPane;
}
@ -459,6 +509,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 刷新
*/
public void refreshDottedLine() {
if (BaseUtils.isAuthorityEditing()) {
populateAuthorityArea();
populateCloseButton();
@ -473,6 +524,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 刷新DottedLine
*/
public void doResize() {
removeDottedLine();
populateAuthorityArea();
populateCloseButton();
@ -497,6 +549,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 退出权限编辑时将所有的做过权限编辑的状态作为一个状态赋给报报表主体
*/
private void fireAuthorityStateToNomal() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) {
// 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表
@ -507,10 +560,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public void setCloseMode(Icon closeMode) {
this.closeMode = closeMode;
}
private UIToolbar combineUpTooBar(JComponent[] toolbar4Form) {
combineUp = new UIToolbar(FlowLayout.LEFT);
combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR));
combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2));
@ -537,6 +592,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
private void addExtraButtons() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jt == null) {
return;
@ -553,6 +609,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
private void addShareButton() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (jt == null) {
return;
@ -572,6 +629,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param al 组件名称
*/
public void checkCombineUp(boolean flag, ArrayList<String> al) {
combineUp.checkComponentsByNames(flag, al);
}
@ -580,6 +638,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 刷新工具条.
*/
public void refreshToolbar() {
this.ad.updateToolBarDef();
}
@ -589,6 +648,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param plus 工具条中相关信息
*/
public void resetToolkitByPlus(ToolBarMenuDockPlus plus) {
if (plus == null) {
plus = ToolBarMenuDock.NULLAVOID;
}
@ -621,6 +681,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public JComponent getToolbarComponent() {
return this.toolbarComponent;
}
@ -636,6 +697,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 检查工具条.
*/
private void checkToolbarMenuEnable() {
if (this.ad != null) {
this.ad.updateMenuDef();
this.ad.updateToolBarDef();
@ -646,6 +708,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 设置标题
*/
public void setTitle() {
JTemplate<?, ?> editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
StringBuilder defaultTitleSB = new StringBuilder();
defaultTitleSB.append(ProductConstants.PRODUCT_NAME);
@ -655,13 +718,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// james:标识登录的用户和登录的ENV
String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
Workspace workspace = WorkContext.getCurrent();
if (workspace != null) {
if (workspace.isLocal()) {
defaultTitleSB.append("@").append(envName).append("[").append(InterProviderFactory.getProvider().getLocText("FR-Engine-Local_Workspace")).append("]");
} else {
DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
defaultTitleSB.append(info.getName()).append("@").append(envName).append("[").append(InterProviderFactory.getProvider().getLocText("Fine-Designer_Basic_Remote_Env")).append("]");
}
defaultTitleSB.append(info.getName()).append("@").append(envName).append("[").append(workspace.getDescription()).append("]");
if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath();
if (!editingTemplate.getEditingFILE().exists()) {
@ -672,7 +730,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
defaultTitleSB.append(" " + path);
}
}
setTitle(defaultTitleSB.toString());
}
@ -724,6 +781,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 返回选中的模板.
*/
public JTemplate<?, ?> getSelectedJTemplate() {
return this.centerTemplateCardPane.getSelectedJTemplate();
}
@ -732,6 +790,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/
public void saveCurrentEditingTemplate() {
JTemplate<?, ?> editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate == null) {
return;
@ -766,6 +825,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* 添加新建模板, 并激活.
*/
public void addAndActivateJTemplate() {
addAndActivateJTemplate(ad.createNewTemplate());
layeredPane.repaint();
}
@ -810,6 +870,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param e 事件
*/
public void targetModified(TargetModifiedEvent e) {
this.checkToolbarMenuEnable();
}
@ -819,6 +880,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板
*/
public void templateClosed(JTemplate<?, ?> jt) {
}
/**
@ -827,6 +889,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板
*/
public void templateOpened(JTemplate<?, ?> jt) {
}
/**
@ -835,6 +898,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @param jt 模板
*/
public void templateSaved(JTemplate<?, ?> jt) {
this.checkToolbarMenuEnable();
}
@ -883,6 +947,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @date 2014-10-14-下午6:30:37
*/
private boolean inValidDesigner(JTemplate jt) {
return jt.isOldDesigner() || (!jt.isJWorkBook() && jt.isNewDesigner());
}
@ -893,6 +958,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* @date 2014-10-14-下午6:31:05
*/
private void openFile(FILE tplFile) {
String fileName = tplFile.getName();
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT);
if (indexOfLastDot < 0) {
@ -960,9 +1026,12 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
* Exit退出
*/
public void exit() {
Thread thread = new Thread() {
@Override
public void run() {
DesignerEnvManager.doEndMapSaveWorkersIndesign();
}
};
@ -1003,18 +1072,22 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
@Override
public void dragEnter(DropTargetDragEvent event) {
}
@Override
public void dragExit(DropTargetEvent event) {
}
@Override
public void dragOver(DropTargetDragEvent event) {
}
@Override
public void dropActionChanged(DropTargetDragEvent event) {
if (!isDragAcceptable(event)) {
event.rejectDrag();
return;
@ -1024,6 +1097,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
@SuppressWarnings("unchecked")
@Override
public void drop(DropTargetDropEvent event) {
if (!isDropAcceptable(event)) {
event.rejectDrop();
return;
@ -1051,15 +1125,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
public boolean isDragAcceptable(DropTargetDragEvent event) {
return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0;
}
public boolean isDropAcceptable(DropTargetDropEvent event) {
return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0;
}
}
public ProgressDialog getProgressDialog() {
return progressDialog;
}
}
Loading…
Cancel
Save