daniel 8 years ago
parent
commit
48ecf5af59
  1. 18
      designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
  2. 1
      designer_base/src/com/fr/design/actions/file/PreferenceAction.java
  3. 38
      designer_base/src/com/fr/design/actions/file/PreferencePane.java
  4. 18
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  5. 9
      designer_base/src/com/fr/design/editor/ValueEditorPane.java
  6. 5
      designer_base/src/com/fr/design/extra/PluginHelper.java
  7. 13
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  8. 15
      designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java
  9. 1
      designer_base/src/com/fr/design/locale/designer.properties
  10. 1
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  11. 1
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  12. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  13. 78
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  14. 31
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  15. 0
      sonar-dev-project.properties

18
designer/src/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

@ -8,12 +8,14 @@ import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.extra.WebDialog; import com.fr.design.extra.WebDialog;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.env.RemoteEnv;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.page.ReportPageAttrProvider; import com.fr.page.ReportPageAttrProvider;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
@ -211,13 +213,13 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
JPanel freezePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel freezePanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
//自适应插件 //自适应插件
JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Attention")); if (shouldShowTip()) {
JPanel infoPane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Attention"));
BoxCenterAligmentPane actionLabel = getURLActionLabel(Inter.getLocText("FR-Designer_Form-Fit-Tip")); BoxCenterAligmentPane actionLabel = getURLActionLabel(Inter.getLocText("FR-Designer_Form-Fit-Tip"));
infoPane.add(actionLabel, BorderLayout.SOUTH); infoPane.add(actionLabel, BorderLayout.SOUTH);
this.add(infoPane, BorderLayout.SOUTH);
}
outfreezePanel.add(freezePanel); outfreezePanel.add(freezePanel);
this.add(infoPane, BorderLayout.SOUTH);
// 重复打印部分 // 重复打印部分
// 重复打印标题的起始行 // 重复打印标题的起始行
JPanel labelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel labelPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
@ -241,6 +243,10 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
initWriteListener(); initWriteListener();
} }
private boolean shouldShowTip() {
return !(FRContext.getCurrentEnv() instanceof RemoteEnv) && FRContext.isChineseEnv();
}
protected void initWriteListener() { protected void initWriteListener() {
// 填报重复冻结行 // 填报重复冻结行
useWriteFrozenCCheckBox.addChangeListener(useWriteFrozenCListener); useWriteFrozenCCheckBox.addChangeListener(useWriteFrozenCListener);

1
designer_base/src/com/fr/design/actions/file/PreferenceAction.java

@ -38,6 +38,7 @@ public class PreferenceAction extends UpdateAction {
DesignerEnvManager.getEnvManager().saveXMLFile(); DesignerEnvManager.getEnvManager().saveXMLFile();
JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jt.refreshToolArea(); jt.refreshToolArea();
preferencePane.showRestartDialog();
} }
}); });

38
designer_base/src/com/fr/design/actions/file/PreferencePane.java

@ -83,6 +83,8 @@ public class PreferencePane extends BasicPane {
}; };
private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言 private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言
private boolean languageChanged; // 是否修改了设计器语言设置
//设置是否支持undo //设置是否支持undo
private UICheckBox supportUndoCheckBox; private UICheckBox supportUndoCheckBox;
//设置最大撤销次数 //设置最大撤销次数
@ -627,25 +629,35 @@ public class PreferencePane extends BasicPane {
return l; return l;
} }
// 如果语言设置改变了,则显示重启对话框
public void showRestartDialog() {
if (!languageChanged) {
return;
}
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer_Language_Change_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();
}
}
@Override @Override
public BasicDialog showWindow(Window window) { public BasicDialog showWindow(Window window) {
return showWindow(window, new DialogActionAdapter() { return showWindow(window, new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
if (languageComboBox.getSelectedIndex() != designerEnvLanguageIndex) { if (languageComboBox.getSelectedIndex() != designerEnvLanguageIndex) {
int rv = JOptionPane.showOptionDialog( languageChanged = true;
null, } else {
Inter.getLocText("FR-Designer_Language_Change_Successful"), languageChanged = false;
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();
}
} }
} }
}); });

18
designer_base/src/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -11,13 +11,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SwingWorker;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
@ -45,6 +39,7 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManager;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -119,8 +114,13 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
// 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table
initconnectionTableProcedurePane(); initconnectionTableProcedurePane();
this.setLayout(new BorderLayout(4, 4)); this.setLayout(new BorderLayout(4, 4));
this.add(connectionTableProcedurePane, BorderLayout.WEST); connectionTableProcedurePane.setMinimumSize(new Dimension(155, 500));
this.add(sqlSplitPane, BorderLayout.CENTER); box.setMinimumSize(new Dimension(310, 400));
// 使用SplitPane
JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane);
mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER);
} }
private void initconnectionTableProcedurePane() { private void initconnectionTableProcedurePane() {

9
designer_base/src/com/fr/design/editor/ValueEditorPane.java

@ -106,6 +106,15 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName
return currentEditor; return currentEditor;
} }
public int getCurrentEditorIndex() {
for (int i = 0;i < cards.length; i++){
if (cards[i].getClass() == currentEditor.getClass()){
return i;
}
}
return 0;
}
public void setCurrentEditor(int i) { public void setCurrentEditor(int i) {
this.add(arrowButton, BorderLayout.WEST); this.add(arrowButton, BorderLayout.WEST);
currentEditor = this.cards[i]; currentEditor = this.cards[i];

5
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -48,9 +48,6 @@ public class PluginHelper {
* @param p 下载百分比处理 * @param p 下载百分比处理
*/ */
public static void downloadPluginFile(String id, String username, String password, Process<Double> p) throws Exception { public static void downloadPluginFile(String id, String username, String password, Process<Double> p) throws Exception {
if (!PluginHelper.invalidUser(id, username, password)) {
return;
}
HttpClient httpClient = new HttpClient(getDownloadPath(id, username, password)); HttpClient httpClient = new HttpClient(getDownloadPath(id, username, password));
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
int totalSize = httpClient.getContentLength(); int totalSize = httpClient.getContentLength();
@ -353,4 +350,4 @@ public class PluginHelper {
} }
private static final int TIME_OUT = 5000; private static final int TIME_OUT = 5000;
} }

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

@ -529,17 +529,6 @@ public class PluginWebBridge {
return LoginWebBridge.getHelper().pluginManageLogin(username, password, uiLabel); 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授权页面 * 弹出QQ授权页面
*/ */
@ -556,4 +545,4 @@ public class PluginWebBridge {
DesignerEnvManager.getEnvManager().setInShowBBsName(StringUtils.EMPTY); DesignerEnvManager.getEnvManager().setInShowBBsName(StringUtils.EMPTY);
uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn")); uiLabel.setText(Inter.getLocText("FR-Base_UnSignIn"));
} }
} }

15
designer_base/src/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -91,6 +91,15 @@ public class FRTreeComboBox extends UIComboBox {
return this.tree; return this.tree;
} }
/**
* 自定义那些那些node可以选中默认情况下所有node节点都可以选中
* @param node
* @return
*/
protected boolean customSelectable(DefaultMutableTreeNode node){
return true;
}
public void setTree(JTree tree) { public void setTree(JTree tree) {
this.tree = tree; this.tree = tree;
if (tree != null) { if (tree != null) {
@ -403,6 +412,12 @@ public class FRTreeComboBox extends UIComboBox {
if (comboBox.onlyLeafSelectable && !node.isLeaf()) { if (comboBox.onlyLeafSelectable && !node.isLeaf()) {
return; return;
} }
//自定义node是否可选择
if (!comboBox.customSelectable(node)){
return;
}
comboBox.setSelectedItem(treePath); comboBox.setSelectedItem(treePath);
togglePopup(); togglePopup();
MenuSelectionManager.defaultManager().clearSelectedPath(); MenuSelectionManager.defaultManager().clearSelectedPath();

1
designer_base/src/com/fr/design/locale/designer.properties

@ -357,7 +357,6 @@ FR-Designer_KeyPoint=KeyPoint
FR-Designer_loadedTreeModel=loadedTreeModel FR-Designer_loadedTreeModel=loadedTreeModel
FR-Designer-Failed_to_load_the_plugin=Failed to load the plugin\uFF0Cplease update the plugin\: FR-Designer-Failed_to_load_the_plugin=Failed to load the plugin\uFF0Cplease update the plugin\:
FR-Designer-Plugin_Please_Update_Jar= FR-Designer-Plugin_Please_Update_Jar=
FR-Designer-Invalid_Page_Number=Invalid Page Number
FR-Designer_XMLA_Database=Database FR-Designer_XMLA_Database=Database
FR-Designer_XMLA_UserName=User name FR-Designer_XMLA_UserName=User name
FR-Designer_XMLA_Password=Password FR-Designer_XMLA_Password=Password

1
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -358,7 +358,6 @@ FR-Designer_KeyPoint=KeyPoint
FR-Designer_loadedTreeModel=loadedTreeModel FR-Designer_loadedTreeModel=loadedTreeModel
FR-Designer-Failed_to_load_the_plugin=Failed to load the plugin\uFF0Cplease update the plugin\: FR-Designer-Failed_to_load_the_plugin=Failed to load the plugin\uFF0Cplease update the plugin\:
FR-Designer-Plugin_Please_Update_Jar=Please Update Jar FR-Designer-Plugin_Please_Update_Jar=Please Update Jar
FR-Designer-Invalid_Page_Number=Invalid Page Number
FR-Designer_XMLA_Database=DB FR-Designer_XMLA_Database=DB
FR-Designer_XMLA_UserName=User name FR-Designer_XMLA_UserName=User name
FR-Designer_XMLA_Password=Password FR-Designer_XMLA_Password=Password

1
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -358,7 +358,6 @@ FR-Designer_KeyPoint=\u5173\u952E\u8282\u70B9
FR-Designer_loadedTreeModel=\u52A0\u8F7D\u5931\u8D25,\u8BF7\u68C0\u67E5\u540E\u91CD\u8BD5 FR-Designer_loadedTreeModel=\u52A0\u8F7D\u5931\u8D25,\u8BF7\u68C0\u67E5\u540E\u91CD\u8BD5
FR-Designer-Failed_to_load_the_plugin=\u65E0\u6CD5\u52A0\u8F7D\u63D2\u4EF6\uFF0C\u8BF7\u66F4\u65B0\u63D2\u4EF6\uFF1A FR-Designer-Failed_to_load_the_plugin=\u65E0\u6CD5\u52A0\u8F7D\u63D2\u4EF6\uFF0C\u8BF7\u66F4\u65B0\u63D2\u4EF6\uFF1A
FR-Designer-Plugin_Please_Update_Jar=\u8BF7\u66F4\u65B0Jar\u5305, \u63D2\u4EF6\u9700\u6C42\u6700\u4F4E\u7248\u672C FR-Designer-Plugin_Please_Update_Jar=\u8BF7\u66F4\u65B0Jar\u5305, \u63D2\u4EF6\u9700\u6C42\u6700\u4F4E\u7248\u672C
FR-Designer-Invalid_Page_Number=\u65E0\u6548\u9875\u7801
FR-Designer_Get-CubeGetting=\u83B7\u53D6cube FR-Designer_Get-CubeGetting=\u83B7\u53D6cube
FR-Designer_XMLA_Database=\u6570\u636E\u5E93 FR-Designer_XMLA_Database=\u6570\u636E\u5E93
FR-Designer_XMLA_UserName=\u7528\u6237\u540D FR-Designer_XMLA_UserName=\u7528\u6237\u540D

1
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -357,7 +357,6 @@ FR-Designer_KeyPoint=\u95DC\u9375\u7BC0\u9EDE
FR-Designer_loadedTreeModel=\u52A0\u8F09\u5931\u6557,\u8ACB\u6AA2\u67E5\u5F8C\u91CD\u8A66 FR-Designer_loadedTreeModel=\u52A0\u8F09\u5931\u6557,\u8ACB\u6AA2\u67E5\u5F8C\u91CD\u8A66
FR-Designer-Failed_to_load_the_plugin=\u7121\u6CD5\u52A0\u8F09\u63D2\u4EF6\uFF0C\u8ACB\u66F4\u65B0\u63D2\u4EF6\uFF1A FR-Designer-Failed_to_load_the_plugin=\u7121\u6CD5\u52A0\u8F09\u63D2\u4EF6\uFF0C\u8ACB\u66F4\u65B0\u63D2\u4EF6\uFF1A
FR-Designer-Plugin_Please_Update_Jar=\u8ACB\u66F4\u65B0Jar\u5305, \u63D2\u4EF6\u9700\u6C42\u6700\u4F4E\u7248\u672C FR-Designer-Plugin_Please_Update_Jar=\u8ACB\u66F4\u65B0Jar\u5305, \u63D2\u4EF6\u9700\u6C42\u6700\u4F4E\u7248\u672C
FR-Designer-Invalid_Page_Number=\u7121\u6548\u9801\u78BC
FR-Designer_Get-CubeGetting=\u7372\u53D6cube FR-Designer_Get-CubeGetting=\u7372\u53D6cube
FR-Designer_XMLA_Database=\u8CC7\u6599\u5EAB FR-Designer_XMLA_Database=\u8CC7\u6599\u5EAB
FR-Designer_XMLA_UserName=\u5E33\u865F FR-Designer_XMLA_UserName=\u5E33\u865F

78
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -60,6 +60,13 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
if (comp == null){ if (comp == null){
return false; return false;
} }
//参数面板内的组件不允许拖往绝对布局中
if (creator.getParent() != null && ((XCreator)creator.getParent()).acceptType(XWParameterLayout.class)){
Rectangle rec = creator.getBounds();
rec.y = creator.getParent().getHeight() - rec.height;
creator.setBounds(rec);
return false;
}
//判断下组件能不能拖入绝对布局 //判断下组件能不能拖入绝对布局
if (!creator.canEnterIntoAbsolutePane()){ if (!creator.canEnterIntoAbsolutePane()){
return false; return false;
@ -67,38 +74,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator)comp).getTopLayout();
if(topLayout != null){ if(topLayout != null){
if (topLayout.isEditable()){ if (topLayout.isEditable()){
//判断有没有和当前控件重叠 return topLayoutAccept(creator, x, y, topLayout);
//先计算当前控件的位置
int creatorX, creatorY;
if (XCreatorUtils.getParentXLayoutContainer(creator) != null) {
Rectangle creatorRectangle = ComponentUtils.getRelativeBounds(creator);
creatorX = creatorRectangle.x;
creatorY = creatorRectangle.y;
} else {
int w = creator.getWidth() / 2;
int h = creator.getHeight() / 2;
creatorX = x - w;
creatorY = y - h;
}
//再判断和布局中其他控件重叠
Rectangle curRec = new Rectangle(creatorX, creatorY, creator.getWidth(), creator.getHeight());
WAbsoluteLayout wAbsoluteLayout = (WAbsoluteLayout)topLayout.toData();
for (int i = 0, count = wAbsoluteLayout.getWidgetCount(); i < count; i++) {
WAbsoluteLayout.BoundsWidget temp = (WAbsoluteLayout.BoundsWidget) wAbsoluteLayout.getWidget(i);
Rectangle rectangle = temp.getBounds();
if (curRec.intersects(rectangle)){
return false;
}
}
if (creatorX < 0
|| creatorX + creator.getWidth() > container.getWidth()
|| creatorY < 0
|| creatorY + creator.getHeight() > container.getHeight()) {
return false;
}
return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight()
&& creator.getWidth() <= container.getWidth();
} }
//绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局 //绝对布局嵌套,处于内层,不可编辑,不添加,topLayout只能获取到最外层可编辑的布局
else if (((XLayoutContainer)topLayout.getParent()).acceptType(XWAbsoluteLayout.class)) { else if (((XLayoutContainer)topLayout.getParent()).acceptType(XWAbsoluteLayout.class)) {
@ -115,6 +91,42 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
return false; return false;
} }
//toplayout假如可以编辑的话就往里面添加组件
private boolean topLayoutAccept(XCreator creator, int x, int y, XLayoutContainer topLayout) {
//判断有没有和当前控件重叠
//先计算当前控件的位置
int creatorX, creatorY;
if (XCreatorUtils.getParentXLayoutContainer(creator) != null) {
Rectangle creatorRectangle = ComponentUtils.getRelativeBounds(creator);
creatorX = creatorRectangle.x;
creatorY = creatorRectangle.y;
} else {
int w = creator.getWidth() / 2;
int h = creator.getHeight() / 2;
creatorX = x - w;
creatorY = y - h;
}
//再判断和布局中其他控件重叠
Rectangle curRec = new Rectangle(creatorX, creatorY, creator.getWidth(), creator.getHeight());
WAbsoluteLayout wAbsoluteLayout = (WAbsoluteLayout)topLayout.toData();
for (int i = 0, count = wAbsoluteLayout.getWidgetCount(); i < count; i++) {
WAbsoluteLayout.BoundsWidget temp = (WAbsoluteLayout.BoundsWidget) wAbsoluteLayout.getWidget(i);
Rectangle rectangle = temp.getBounds();
if (curRec.intersects(rectangle)){
return false;
}
}
if (creatorX < 0 || creatorX + creator.getWidth() > container.getWidth()) {
return false;
}
if (creatorY < 0 || creatorY + creator.getHeight() > container.getHeight()){
return false;
}
return x >= 0 && y >= 0 && creator.getHeight() <= container.getHeight()
&& creator.getWidth() <= container.getWidth();
}
/** /**
* 判断是否鼠标在组件的三等分区域如果组件在布局管理器中间上下左右都可能会三等分 * 判断是否鼠标在组件的三等分区域如果组件在布局管理器中间上下左右都可能会三等分
* @param parentComp 鼠标所在区域的组件 * @param parentComp 鼠标所在区域的组件
@ -156,6 +168,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
return !ComparatorUtils.equals(trisectAreaDirect, 0); return !ComparatorUtils.equals(trisectAreaDirect, 0);
} }
//当前绝对布局不可编辑,就当成一个控件,组件添加在周围
private boolean acceptWidget(XCreator creator, int x, int y){ private boolean acceptWidget(XCreator creator, int x, int y){
isFindRelatedComps = false; isFindRelatedComps = false;
//拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域 //拖入组件判断时,先判断是否为交叉点区域,其次三等分区域,再次平分区域
@ -235,6 +248,7 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
} }
XWAbsoluteLayout layout = (XWAbsoluteLayout) container; XWAbsoluteLayout layout = (XWAbsoluteLayout) container;
layout.updateBoundsWidget(creator); layout.updateBoundsWidget(creator);
updateCreatorBackBound();
LayoutUtils.layoutRootContainer(container); LayoutUtils.layoutRootContainer(container);
}else{ }else{
fixAbsolute(creator, x, y); fixAbsolute(creator, x, y);

31
designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -96,7 +96,6 @@ public class XWAbsoluteLayout extends XLayoutContainer {
if(screenValue != FormArea.DEFAULT_SLIDER){ if(screenValue != FormArea.DEFAULT_SLIDER){
this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER); this.setContainerPercent(screenValue / FormArea.DEFAULT_SLIDER);
} }
widget.setDesigningResolution(scrnsize);
} }
/** /**
@ -208,7 +207,33 @@ public class XWAbsoluteLayout extends XLayoutContainer {
} }
} }
} }
/**
* 更新子组件的Bound
* 这边主要用于绝对布局子组件在适应区域选项时
* 涉及到的不同分辨率下缩放
* @param minHeight 最小高度
*/
@Override
public void updateChildBound(int minHeight) {
double prevContainerPercent = FRScreen.getByDimension(toData().getDesigningResolution()).getValue() / FormArea.DEFAULT_SLIDER;
if (toData().getCompState() == 0 && prevContainerPercent != containerPercent) {
for (int i = 0; i < this.getComponentCount(); i++) {
XCreator creator = getXCreator(i);
Rectangle rec = new Rectangle(creator.getBounds());
rec.x = (int)(rec.x / prevContainerPercent * containerPercent);
rec.y = (int)(rec.y / prevContainerPercent * containerPercent);
rec.height = (int)(rec.height / prevContainerPercent * containerPercent);
rec.width = (int)(rec.width / prevContainerPercent * containerPercent);
BoundsWidget wgt = toData().getBoundsWidget(creator.toData());
wgt.setBounds(rec);
creator.setBounds(rec);
creator.updateChildBound(minHeight);
}
}
toData().setDesigningResolution(Toolkit.getDefaultToolkit().getScreenSize());
}
/** /**
* 增加对齐线 * 增加对齐线
* @param connector 对齐线 * @param connector 对齐线
@ -418,7 +443,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
); );
g2d.setColor(Color.BLACK); g2d.setColor(Color.BLACK);
//画编辑文字 //画编辑文字
g2d.drawString(Inter.getLocText("Edit"), x + w / 2 - 2, y + h / 2 + 5); g2d.drawString(Inter.getLocText("FR-Designer_Edit"), x + w / 2 - 2, y + h / 2 + 5);
} }
} }

0
sonar-project.properties → sonar-dev-project.properties

Loading…
Cancel
Save