Browse Source

Merge pull request #4981 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '444fef6b2676637c6bd4bc73f9fc6c0eb626631e':
  REPORT-55149 【组件背景分离】组件复用-图表块没看到内边距设置项
  REPORT-55214 【组件背景分离】组件复用-组件编辑状态,蓝色实线边框感觉不太明显,和交互图预期效果不太一样;阴影效果看起来正常
  REPORT-55228 【组件背景分离】组件复用-打开其他模板 工具栏会留在设计页面上
  REPORT-55212 【组件背景分离】组件复用-tab里的图表块和报表块无法通过点击原本的编辑按钮和双击触发编辑状态 工具栏的编辑按钮可以触发 && REPORT-55228 【组件背景分离】组件复用 打开其他模板 工具栏会留在设计页面上
  REPORT-55187【组件背景分离】组件复用-body和参数面板里的控件(frm参面和body 以及 cpt参面),应该也有只显示锁按钮的工具栏,现在是没有工具栏的
  REPORT-53175 【10.0.18】组件背景分离为标题/背景/边框
  REPORT-55211【组件背景分离】组件复用-图表块取消勾选标题可见,设置的主体背景(颜色/渐变色/图片),在设计界面里会遮盖住图表,可见图。web效果正常
  REPORT-53175 【10.0.18】组件背景分离为标题/背景/边框
  REPORT-55188 【组件背景分离】组件复用-设计器右侧组件目录树选中组件应也触发绝对布局下组件的工具栏 update
  REPORT-55188 【组件背景分离】组件复用-设计器右侧组件目录树选中组件应也触发绝对布局下组件的工具栏
  REPORT-55178 【组件背景分离】组件复用-设计界面,现在需要点两下选中组件才能出现工具栏
  无jira任务 代码质量
  REPORT-52641 文件数据集需要限制目录
feature/10.0
superman 3 years ago
parent
commit
741d594ce6
  1. 24
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  2. 10
      designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java
  3. 3
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  4. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  5. 49
      designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java
  6. 11
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  7. 27
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java

24
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -26,6 +26,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -612,7 +613,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private void setTextField(FileTableData ob) {
if (ob.getFilePath() != null) {
if (ob.getFilePath().indexOf("http") != -1) {
if (ob.getFilePath().contains("http")) {
urlRadioSelectAction();
urlText.setText(ob.getFilePath());
} else {
@ -625,6 +626,15 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
@Override
public FileTableData updateBean() {
String filePath = getFilePathFromUrlOrLocal();
// 安全要求禁止 file 协议访问本地磁盘
if (FileTableData.isInvalidFilePath(filePath)) {
FineJOptionPane.showMessageDialog(this,
Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"),
Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"),
JOptionPane.ERROR_MESSAGE);
// 阻止对话框关闭
throw new RuntimeException(Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"));
}
if (StringUtils.isNotBlank(filePath)) {
this.params = getEditorPaneParameter().length == 0 ? null : getEditorPaneParameter();
if (fileTypeComboBox.getSelectedIndex() == EXCEL) {
@ -786,6 +796,14 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
if (this.fileTableData == null) {
return;
}
String filePath = getFilePathFromUrlOrLocal();
if (FileTableData.isInvalidFilePath(filePath)) {
FineJOptionPane.showMessageDialog(this,
Toolkit.i18nText("Fine-Design_File_Table_Data_Path_Invalid"),
Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip"),
JOptionPane.ERROR_MESSAGE);
return;
}
PreviewTablePane.previewTableData(this.updateBean());
}
@ -802,7 +820,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
xmlNodeTree = new XMLNodeTree();
this.add(new JScrollPane(xmlNodeTree));
keyPointLaber = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Key_Point") + ":");
keyPointLaber = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Key_Point") + ":");
refreshAction = new RefreshParameterAction();
ToolBarDef toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(refreshAction);
@ -820,7 +838,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private class RefreshParameterAction extends UpdateAction {
public RefreshParameterAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"));
this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh"));
this.setMnemonic('r');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
}

10
designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java

@ -86,9 +86,15 @@ public class DesignerEditor<T extends JComponent> implements PropertyChangeListe
int horizonMargin = marginLeft + marginRight;
int verticalMargin = marginTop + marginBottom;
comp.setSize(new Dimension(size.width - 2 - horizonMargin, size.height - 2 - verticalMargin));
int x = 1 + marginLeft;
int y = 1 + marginTop;
int width = size.width - 2 - horizonMargin;
int height = size.height - 2 - verticalMargin;
comp.setSize(new Dimension(width, height));
LayoutUtils.layoutContainer(comp);
Graphics clipg = g.create(1 + marginLeft, 1 + marginTop, size.width, size.height);
comp.setBounds(comp.getX() + x, comp.getY() + y, width, height);
Graphics clipg = g.create(x, y, width, height);
this.comp.paint(clipg);
}
}

3
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -146,6 +146,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
if (isEditing) {
g.setColor(OUTER_BORDER_COLOR);
GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 1, bounds.height + BORDER_WIDTH + 1), Constants.LINE_LARGE);
g.setColor(INNER_BORDER_COLOR);
GraphHelper.draw(g, new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height), Constants.LINE_MEDIUM);
} else if (!isHovering) {
super.paintBorder(g, bounds);
}

6
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -830,4 +830,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
}
}
public void hidePopup() {
if (popup != null) {
popup.setVisible(false);
}
}
}

49
designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java

@ -4,6 +4,7 @@ import com.fr.design.constants.UIConstants;
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.XWTitleLayout;
import com.fr.design.designer.treeview.ComponentTreeCellRenderer;
import com.fr.design.designer.treeview.ComponentTreeModel;
import com.fr.design.file.HistoryTemplateListCache;
@ -16,6 +17,7 @@ import com.fr.stable.StringUtils;
import java.awt.Rectangle;
import java.awt.event.MouseListener;
import java.util.Stack;
import java.util.function.Consumer;
import javax.swing.BorderFactory;
import javax.swing.DropMode;
import javax.swing.JPanel;
@ -349,6 +351,7 @@ public class ComponentTree extends JTree {
private final class ComponetTreeMouseListener extends MouseAdapter {
private final JTree tree;
private XCreator selectedCreator;
private ComponetTreeMouseListener(JTree tree) {
this.tree = tree;
@ -378,8 +381,49 @@ public class ComponentTree extends JTree {
@Override
public void mouseClicked(MouseEvent e) {
// 鼠标左键 双击
onMouseEvent(e, new Consumer<XCreator>() {
@Override
public void accept(XCreator creator) {
if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !designer.isFormParaDesigner()) {
startEditing(creator, e);
}
}
});
}
@Override
public void mousePressed(MouseEvent e) {
onMouseEvent(e, new Consumer<XCreator>() {
@Override
public void accept(XCreator creator) {
if (e.getButton() == MouseEvent.BUTTON1) {
selectedCreator = creator;
}
}
});
}
@Override
public void mouseReleased(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1 && selectedCreator != null) {
showSelectedPopup(selectedCreator);
}
}
private void showSelectedPopup(XCreator comp) {
Rectangle rectangle = getRelativeBounds(comp);
comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class));
comp.setSelected(true);
}
/**
* 响应鼠标事件并解析选中的组件
*
* @param e
* @param consumer
*/
private void onMouseEvent(final MouseEvent e, Consumer<XCreator> consumer) {
Point p = e.getPoint();
// 解析组件树路径 获取选中的组件
int selRow = tree.getRowForLocation(p.x, p.y);
@ -389,8 +433,7 @@ public class ComponentTree extends JTree {
Point point = bounds.getLocation();
SwingUtilities.convertPointToScreen(point, tree);
XCreator comp = (XCreator) path.getLastPathComponent();
startEditing(comp, e);
}
consumer.accept(comp);
}
}

11
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -624,6 +624,8 @@ public class EditingMouseListener extends MouseInputAdapter {
creator = processTopLayoutMouseClick(creator);
if (creator != null) {
// tab块处于未编辑状态
boolean uneditedTab = designer.getCursor().getType() != Cursor.HAND_CURSOR && creator.acceptType(XWCardMainBorderLayout.class) && !((XWCardMainBorderLayout) creator).isEditable();
// 点击不在tab块的button中
boolean clickedNonCardButton = !creator.acceptType(XCardAddButton.class, XCardSwitchButton.class);
if (clickedNonCardButton && e.getClickCount() == 1 && designer.getCursor().getType() != Cursor.HAND_CURSOR) {
@ -631,10 +633,17 @@ public class EditingMouseListener extends MouseInputAdapter {
selectionModel.selectACreatorAtMouseEvent(e);
refreshTopXCreator();
XCreator[] xCreators = selectionModel.getSelection().getSelectedCreators();
// 放到事件队尾执行
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
for (XCreator xCreator : xCreators) {
xCreator.setSelected(true);
}
} else if (clickedNonCardButton && responseTabLayout(oldCreator, e)) {
}
});
} else if (clickedNonCardButton && uneditedTab && responseTabLayout(oldCreator, e)) {
// do nothing
} else {
creator.respondClick(this, e);

27
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -47,8 +47,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.mainframe.template.info.JFormProcessInfo;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -79,10 +77,8 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONArray;
import com.fr.log.FineLoggerFactory;
import com.fr.page.PaperSettingProvider;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.worksheet.FormElementCase;
@ -93,6 +89,8 @@ import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.web.controller.ViewRequestConstants;
import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerEvent;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
@ -135,18 +133,36 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
//FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示
protected int index = FORM_TAB;
private PluginEventListener pluginListener;
private ContainerAdapter containerAdapter = new ContainerAdapter() {
@Override
public void componentRemoved(ContainerEvent e) {
// 当前jfrom未在tab中显示时
if (formDesign != null) {
XCreator[] creators = formDesign.getSelectionModel().getSelection().getSelectedCreators();
for (XCreator creator : creators) {
creator.hidePopup();
}
}
}
};
public JForm() {
super(new Form(new WBorderLayout("form")), "Form");
init();
}
public JForm(Form form, FILE file, Parameter[] parameters) {
super(form, file, parameters);
init();
}
public JForm(Form form, FILE file) {
super(form, file);
init();
}
private void init() {
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addContainerListener(containerAdapter);
}
@Override
@ -1114,6 +1130,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
public void whenClose() {
super.whenClose();
this.releaseResources();
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().removeContainerListener(this.containerAdapter);
}
@Override

Loading…
Cancel
Save