Browse Source

Merge pull request #1460 in BA/design from ~PAUL/design:master to master

* commit 'b9a71f722ac64ccec9b13fafa0c9275a2c2b5100':
  REPORT-5409 【难还原】表单组件在拖动过程中body的自适应布局失效 REPORT-4225 打开高版本cpt,弹出的报错框异常
  REPORT-5591 设计器https远程连接
  REPORT-5666 【9.0三轮回归】按钮控件,属性面板设置了控件大小无法保存,如图
  REPORT-4729 决策报表自适应布局控件复用粘贴问题
  rt
  控件名遍历
  rt
  REPORT-5659 [9.0三轮回归]单元格格式日期型,无法保存
  REPORT-5659 [9.0三轮回归]单元格格式日期型,无法保存
  rt
  rt
  遍历控件名问题
  enter键问题
master
superman 7 years ago
parent
commit
3edf2ea9ce
  1. 10
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  2. 10
      designer_base/src/com/fr/design/actions/UpdateAction.java
  3. 1
      designer_base/src/com/fr/design/dialog/InformationWarnPane.java
  4. 7
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  5. 1
      designer_base/src/com/fr/design/locale/designer.properties
  6. 1
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  7. 1
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  8. 1
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  9. 1
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  10. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  11. 1
      designer_base/src/com/fr/env/EnvListPane.java
  12. 35
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  13. 117
      designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java
  14. 1
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

10
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -676,7 +676,7 @@ public class AlphaFineDialog extends UIDialog {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1);
} else if (e.getKeyCode() == KeyEvent.VK_UP) {
searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() - 1);
} else escAlphaFine(e);
} else escAlphaFineDialog(e);
}
});
@ -888,7 +888,7 @@ public class AlphaFineDialog extends UIDialog {
*
* @param e
*/
private void escAlphaFine(KeyEvent e) {
private void escAlphaFineDialog(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) {
AlphaFineDialog.this.setVisible(false);
@ -896,6 +896,10 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.setText(null);
removeSearchResult();
}
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (searchResultList.getModel().getSize() > 1) {
dealWithSearchResult(searchResultList.getSelectedValue());
}
}
}
@ -969,7 +973,7 @@ public class AlphaFineDialog extends UIDialog {
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
escAlphaFine(e);
escAlphaFineDialog(e);
}
});

10
designer_base/src/com/fr/design/actions/UpdateAction.java

@ -504,10 +504,12 @@ public abstract class UpdateAction extends ShortCut implements Action {
} else if (component instanceof JComboBox) {
for (int i = 0; i < ((JComboBox) component).getItemCount(); i++) {
text.append(((JComboBox) component).getItemAt(i));
String title = String.valueOf(((JComboBox) component).getItemAt(i));
handleSearchText(separator, text, pinyin, shortPinyin, title);
Object componentName = ((JComboBox) component).getItemAt(i);
if (componentName instanceof String && StringUtils.isNotBlank(String.valueOf(componentName))) {
String title = String.valueOf(componentName);
text.append(title);
handleSearchText(separator, text, pinyin, shortPinyin, title);
}
}
} else if (component instanceof JTabbedPane) {
getTabPaneTexts((JTabbedPane) component, separator, text, pinyin, shortPinyin);

1
designer_base/src/com/fr/design/dialog/InformationWarnPane.java

@ -143,7 +143,6 @@ public class InformationWarnPane extends JPanel{
contentPane.add(InformationWarnPane.this);
contentPane.add(this.createControlButtonPane());
this.setModal(true);
this.pack();
GUICoreUtils.centerWindow(this);
}

7
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -258,12 +258,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
private void setPatternComboBoxAndList(int formatStyle, String pattern) {
this.typeComboBox.setSelectedItem(formatStyle);
int i = isArrayContainPattern(FormatField.getInstance().getFormatArray(formatStyle), pattern);
if (i == -1) {
this.textField.setSelectedItem(pattern);
} else {
this.textField.setSelectedIndex(i);
}
this.textField.setSelectedItem(pattern);
}
private boolean isTimeType(String pattern) {

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

@ -2147,3 +2147,4 @@ FR-Designer_Print_Background=
FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect.

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

@ -2146,3 +2146,4 @@ FR-Designer_Print_Background=
FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect.

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

@ -2147,3 +2147,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=Sheet\u30E9\u30D9\u30EB\u30DA\u30F
FR-Designer_Provide_Choose_All=\u5168\u9078\u629E\u53EF\u80FD
FR-Designer_Decimal_Places=\u5C0F\u6570\u67A0\u6570:
FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9
FR-Designer_Env_Des_Https=

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

@ -2147,3 +2147,4 @@ FR-Designer_Decimal_Places=\uC18C\uC218\uC218\uB7C9:
FR-Base-Load_Resource_File=\uB85C\uB529\uAD6C\uC131\uD30C\uC77C
FR-Designer_Export_Background=
FR-Designer_Print_Background=
FR-Designer_Env_Des_Https=

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

@ -2147,3 +2147,4 @@ FR-Designer_Print_Background=
FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=\u82E5\u542F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8BC1\u4E66\u8DEF\u5F84\u3001https\u79D8\u94A5\uFF09\uFF0C\u5FC5\u987B\u91CD\u542F\u8BBE\u8BA1\u5668\u624D\u80FD\u751F\u6548\u3002

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

@ -2146,3 +2146,4 @@ FR-Designer_Print_Background=
FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=\u82E5\u555F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8B49\u66F8\u8DEF\u5F91\u3001https\u7955\u9470\uFF09\uFF0C\u5FC5\u9808\u91CD\u555F\u8A2D\u8A08\u5668\u624D\u80FD\u751F\u6548\u3002

1
designer_base/src/com/fr/env/EnvListPane.java vendored

@ -377,6 +377,7 @@ public class EnvListPane extends JListControlPane {
previewTextArea.setText(Inter.getLocText("Env-Des2"));
try {
previewTextArea.getDocument().insertString(previewTextArea.getText().length(), Inter.getLocText("Env_Des"), this.getRedSytleAttribute());
previewTextArea.getDocument().insertString(previewTextArea.getText().length(), "\n" + Inter.getLocText("FR-Designer_Env_Des_Https"), this.getRedSytleAttribute());
} catch (BadLocationException e) {
FRContext.getLogger().error(e.getMessage(), e);
}

35
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -722,7 +722,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
protected void delete(XCreator creator, int creatorWidth, int creatorHeight) {
int x = creator.getX();
int y = creator.getY();
recalculateChildrenSize(x, y, creatorWidth, creatorHeight);
recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true);
}
/**
@ -734,6 +734,19 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
* @param creatorHeight 删除的组件之前所在布局的高度
*/
public void recalculateChildrenSize(int x, int y, int creatorWidth, int creatorHeight) {
recalculateChildrenSize(x, y, creatorWidth, creatorHeight, false);
}
/**
* 重新计算内部组件大小
*
* @param x 坐标x
* @param y 坐标y
* @param creatorWidth 删除的组件之前所在布局的宽度
* @param creatorHeight 删除的组件之前所在布局的高度
* @param isDel 删除操作
*/
public void recalculateChildrenSize(int x, int y, int creatorWidth, int creatorHeight, boolean isDel) {
if (container.getComponentCount() == 0) {
return;
} else {
@ -744,11 +757,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
if (!rightComps.isEmpty() && getAllHeight(rightComps) == height) {
calculateRightRelatComponent(x, width + actualVal);
} else if (!leftComps.isEmpty() && getAllHeight(leftComps) == height) {
calculateLefttRelatComponent(width + actualVal);
calculateLefttRelatComponent(width + actualVal, isDel);
} else if (!downComps.isEmpty() && getAllWidth(downComps) == width) {
calculateDownRelatComponent(y, height + actualVal);
} else if (!upComps.isEmpty() && getAllWidth(upComps) == width) {
calculateUpRelatComponent(height + actualVal);
calculateUpRelatComponent(height + actualVal, isDel);
} else {
// 由于布局三等分的存在,可能会出现删除组件时,找不到关联的组件填充,此时特殊处理
calculateNoRelatedComponent(x, y, width, height);
@ -823,7 +836,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return;
}
}
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height);
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height, true);
}
private void calculateNoRelatedWhileRightBott(Rectangle bound, Component rcomp) {
@ -858,7 +871,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return;
}
}
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height);
recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height, true);
}
private int getMinWidth(List<Component> comps) {
@ -1095,7 +1108,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
* 删除或拉伸控件左边框时 调整左侧的组件位置大小
*/
protected boolean calculateLefttRelatComponent(int objWidth) {
if (isBeyondAdjustWidthScope(objWidth)) {
return calculateLefttRelatComponent(objWidth, false);
}
protected boolean calculateLefttRelatComponent(int objWidth, boolean isDel) {
if (!isDel && isBeyondAdjustWidthScope(objWidth)) {
return false;
}
int count = leftComps.size();
@ -1153,7 +1170,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
* 删除或拉伸上边框 调整上方的组件位置大小
*/
protected boolean calculateUpRelatComponent(int objHeight) {
if (isBeyondAdjustHeightScope(objHeight)) {
return calculateUpRelatComponent(objHeight, false);
}
protected boolean calculateUpRelatComponent(int objHeight, boolean isDel) {
if (!isDel && isBeyondAdjustHeightScope(objHeight)) {
return false;
}
int count = upComps.size();

117
designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

@ -5,24 +5,45 @@ import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.AbstractLayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import java.awt.*;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 表单选中工具类
*
* @author yaoh.wu
* @version 2017年11月15日13点51分
* @since 8.0
*/
public class FormSelectionUtils {
//组件复制时坐标偏移
/**
* 组件复制时坐标偏移
*/
private static final int DELAY_X_Y = 20;
//组件重命名后缀
/**
* 组件重命名后缀
*/
private static final String POSTFIX = "_c";
private FormSelectionUtils() {
@ -47,6 +68,25 @@ public class FormSelectionUtils {
Toolkit.getDefaultToolkit().beep();
}
public static void rebuildSelection(FormDesigner designer) {
ArrayList<XCreator> newSelection = new ArrayList<>();
List<Widget> widgetList = new ArrayList<>();
for (XCreator comp : designer.getSelectionModel().getSelection().getSelectedCreators()) {
widgetList.add(comp.toData());
}
designer.getSelectionModel().setSelectedCreators(
rebuildSelection(designer.getRootComponent(), widgetList, newSelection));
}
public static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, Widget[] selectWidgets) {
List<Widget> selectionWidget = new ArrayList<>();
if (selectWidgets != null) {
selectionWidget.addAll(Arrays.asList(selectWidgets));
}
return FormSelectionUtils.rebuildSelection(rootComponent, selectionWidget, new ArrayList<XCreator>());
}
/**
* 绝对布局粘贴
*/
@ -92,26 +132,15 @@ public class FormSelectionUtils {
designer.getSelectionModel().getSelection().reset();
for (XCreator creator : clipboard.getSelectedCreators()) {
try {
Widget copied = copyWidget(designer, creator);
XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize());
if (adapter.getClass().equals(FRTabFitLayoutAdapter.class)) {
if (!adapter.accept(copiedCreator, x - tabContainerRect.x, y - tabContainerRect.y)) {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
return;
}
} else {
if (!adapter.accept(copiedCreator, x, y)) {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
return;
}
}
boolean addSuccess = adapter.addBean(copiedCreator, x, y);
if (addSuccess) {
designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator);
if (creator instanceof XWScaleLayout) {
//XWScaleLayout封装了在自适应布局中需要保持默认高度的控件,由于自适应粘贴时会再次包装,因此复制时要进行解包
Component[] innerComponents = creator.getComponents();
for (Component innerComponent : innerComponents) {
XCreator innerXCreator = (XCreator) innerComponent;
relativePasteXCreator(designer, innerXCreator, adapter, tabContainerRect, x, y);
}
} catch (CloneNotSupportedException e) {
FRContext.getLogger().error(e.getMessage(), e);
} else {
relativePasteXCreator(designer, creator, adapter, tabContainerRect, x, y);
}
}
rebuildSelection(designer);
@ -119,6 +148,31 @@ public class FormSelectionUtils {
designer.getSelectionModel().getSelection().getSelectedCreator(), DesignerEvent.CREATOR_PASTED);
}
private static void relativePasteXCreator(FormDesigner designer, XCreator creator, LayoutAdapter adapter, Rectangle tabContainerRect, int x, int y) {
try {
Widget copied = copyWidget(designer, creator);
XCreator copiedXCreator = XCreatorUtils.createXCreator(copied, creator.getSize());
if (adapter.getClass().equals(FRTabFitLayoutAdapter.class)) {
if (!adapter.accept(copiedXCreator, x - tabContainerRect.x, y - tabContainerRect.y)) {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
return;
}
} else {
if (!adapter.accept(copiedXCreator, x, y)) {
designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Small_To_Paste"));
return;
}
}
boolean addSuccess = adapter.addBean(copiedXCreator, x, y);
if (addSuccess) {
designer.getSelectionModel().getSelection().addSelectedCreator(copiedXCreator);
}
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error(e.getMessage(), e);
}
}
/**
* 组件复用绝对布局获取粘贴组件位置
*/
@ -182,23 +236,6 @@ public class FormSelectionUtils {
return name.toString();
}
public static void rebuildSelection(FormDesigner designer) {
ArrayList<XCreator> newSelection = new ArrayList<>();
List<Widget> widgetList = new ArrayList<>();
for (XCreator comp : designer.getSelectionModel().getSelection().getSelectedCreators()) {
widgetList.add(comp.toData());
}
designer.getSelectionModel().setSelectedCreators(
rebuildSelection(designer.getRootComponent(), widgetList, newSelection));
}
public static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, Widget[] selectWidgets) {
List<Widget> selectionWidget = new ArrayList<>();
if (selectWidgets != null) {
selectionWidget.addAll(Arrays.asList(selectWidgets));
}
return FormSelectionUtils.rebuildSelection(rootComponent, selectionWidget, new ArrayList<XCreator>());
}
private static ArrayList<XCreator> rebuildSelection(XCreator rootComponent, List<Widget> selectionWidget,
ArrayList<XCreator> newSelection) {

1
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -91,6 +91,7 @@ public class WidgetBoundPane extends BasicPane {
if (bounds.height != h) {
limitHeight(wabs, h, bounds, rec);
}
creator.setBounds(bounds);
}

Loading…
Cancel
Save