From 35b57ab86010712f71b018901e3bef233f53fbd0 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 8 Aug 2017 21:56:27 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3348=20=E8=A7=86=E8=A7=89=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/quickeditor/CellQuickEditor.java | 13 ++++++++++--- .../cellquick/CellBiasTextPainterEditor.java | 11 +++++++---- .../quickeditor/cellquick/CellDSColumnEditor.java | 8 ++------ .../quickeditor/cellquick/CellImageQuickEditor.java | 12 +++++++----- .../quickeditor/cellquick/CellRichTextEditor.java | 12 ++++++++---- .../cellquick/CellStringQuickEditor.java | 4 +--- .../quickeditor/cellquick/CellSubReportEditor.java | 12 ++++++++---- 7 files changed, 43 insertions(+), 29 deletions(-) diff --git a/designer/src/com/fr/quickeditor/CellQuickEditor.java b/designer/src/com/fr/quickeditor/CellQuickEditor.java index b6cbb0f6a9..2e1f4531d2 100644 --- a/designer/src/com/fr/quickeditor/CellQuickEditor.java +++ b/designer/src/com/fr/quickeditor/CellQuickEditor.java @@ -48,6 +48,12 @@ public abstract class CellQuickEditor extends QuickEditor { private int selectedIndex; private JPanel leftContentPane; private UIScrollBar scrollBar; + /*占位label*/ + protected static UILabel emptyLabel = new UILabel(); + + static { + emptyLabel.setPreferredSize(new Dimension(60, 20)); + } public CellQuickEditor() { @@ -89,13 +95,14 @@ public abstract class CellQuickEditor extends QuickEditor { double f = TableLayout.FILL; double[] columnSize = {p, f}; double[] rowSize = {p, p}; + JComponent centerBody = createCenterBody(); + centerBody.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 0, this.getBackground())); Component[][] components = new Component[][]{ new Component[]{initTopContent(), null}, - new Component[]{createCenterBody(), null} + new Component[]{centerBody, null} }; leftContentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BarLayout()); - this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); this.add(scrollBar); this.add(leftContentPane); } @@ -116,7 +123,7 @@ public abstract class CellQuickEditor extends QuickEditor { new Component[]{insertContentLabel, cellElementEditButton}, }; JPanel topContent = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); return topContent; } diff --git a/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java index 261a1111ad..c9a1ad1e17 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java @@ -5,9 +5,10 @@ import com.fr.design.actions.insert.cell.BiasCellAction; import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; import com.fr.report.cell.painter.BiasTextPainter; @@ -25,8 +26,7 @@ public class CellBiasTextPainterEditor extends CellQuickEditor { @Override public JComponent createCenterBody() { JPanel content = new JPanel(new BorderLayout()); - content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); - UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); + UIButton editButton = new UIButton(Inter.getLocText("Edit")); editButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -34,7 +34,10 @@ public class CellBiasTextPainterEditor extends CellQuickEditor { } }); editButton.setOpaque(false); - content.add(editButton, BorderLayout.CENTER); + content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{ + new Component[]{emptyLabel, editButton}}, + new double[]{TableLayout.PREFERRED}, + new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER); return content; } diff --git a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 0bcd22b625..254b9102da 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -135,7 +135,6 @@ public class CellDSColumnEditor extends CellQuickEditor { String[] iconArray = new String[paneList.size()]; card = new CardLayout(); cardContainer = new JPanel(card); - cardContainer.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); for (int i = 0; i < paneList.size(); i++) { CellEditorPane pane = paneList.get(i); iconArray[i] = pane.getIconPath(); @@ -227,9 +226,8 @@ public class CellDSColumnEditor extends CellQuickEditor { new Component[]{uiLabel, uiButton} }; conditionPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); - this.add(this.createContentPane(), BorderLayout.CENTER); - this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); } @@ -302,7 +300,7 @@ public class CellDSColumnEditor extends CellQuickEditor { public DSColumnAdvancedEditorPane() { this.setLayout(new BorderLayout()); this.add(this.createContentPane(), BorderLayout.CENTER); - this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); + this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); } @@ -330,7 +328,6 @@ public class CellDSColumnEditor extends CellQuickEditor { } } - @SuppressWarnings("Duplicates") @Override public void populate() { if (cellElement != null) { @@ -374,7 +371,6 @@ public class CellDSColumnEditor extends CellQuickEditor { /** * 更新单元格扩展属性 */ - @SuppressWarnings("Duplicates") private void updateExtendConfig() { CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); if (cellExpandAttr == null) { diff --git a/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java index 315e95c571..6bbbf5fcf5 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java @@ -5,10 +5,11 @@ import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.ImageCellAction; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.DesignerContext; import com.fr.design.report.SelectImagePane; import com.fr.general.ComparatorUtils; -import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; import com.fr.report.cell.cellattr.CellImage; @@ -33,8 +34,7 @@ public class CellImageQuickEditor extends CellQuickEditor { @Override public JComponent createCenterBody() { JPanel content = new JPanel(new BorderLayout()); - content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); - UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/image.png")); + UIButton editButton = new UIButton(Inter.getLocText("Edit")); editButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -42,11 +42,13 @@ public class CellImageQuickEditor extends CellQuickEditor { } }); editButton.setOpaque(false); - content.add(editButton, BorderLayout.CENTER); + content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{ + new Component[]{emptyLabel, editButton}}, + new double[]{TableLayout.PREFERRED}, + new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER); return content; } - @SuppressWarnings("Duplicates") private void showEditingDialog() { final SelectImagePane imageEditorPane = new SelectImagePane(); imageEditorPane.populate(cellElement); diff --git a/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java index a0cbf705bd..9e9bf3bc9d 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java @@ -3,6 +3,8 @@ package com.fr.quickeditor.cellquick; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; @@ -22,14 +24,15 @@ public class CellRichTextEditor extends CellQuickEditor { super(); } - @SuppressWarnings("Duplicates") @Override public JComponent createCenterBody() { JPanel content = new JPanel(new BorderLayout()); - content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); richTextButton = new UIButton(); richTextButton.setOpaque(false); - content.add(richTextButton, BorderLayout.CENTER); + content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{ + new Component[]{emptyLabel, richTextButton}}, + new double[]{TableLayout.PREFERRED}, + new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER); return content; } @@ -41,7 +44,8 @@ public class CellRichTextEditor extends CellQuickEditor { @Override protected void refreshDetails() { RichTextCellAction subReportCellAction = new RichTextCellAction(tc); - subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); + subReportCellAction.setName(Inter.getLocText("Edit")); + subReportCellAction.setSmallIcon(null); richTextButton.setAction(subReportCellAction); } diff --git a/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java index b6af023c07..d0dffdfbd9 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java @@ -28,7 +28,6 @@ public class CellStringQuickEditor extends CellQuickEditor { //编辑状态 private boolean isEditing = false; - //august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。 private boolean reserveInResult = false; private boolean reserveOnWriteOrAnaly = true; @@ -61,7 +60,6 @@ public class CellStringQuickEditor extends CellQuickEditor { @Override public JComponent createCenterBody() { JPanel content = new JPanel(new BorderLayout()); - content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); stringTextArea = new UITextArea(); stringTextArea.addKeyListener(new KeyAdapter() { @@ -71,7 +69,7 @@ public class CellStringQuickEditor extends CellQuickEditor { return; } if (e.getKeyCode() == KeyEvent.VK_ENTER) { - //todo yaoh.wu虽然模仿选中单元格按enter可以做到,但是原理没有弄清楚。 + //todo 按enter键换至下一个单元格 yaoh.wu虽然模仿选中单元格按enter这种场景可以做到,但是原理没有弄清楚。 GridKeyListener dispatchListener = new GridKeyListener(tc.getGrid()); dispatchListener.keyPressed(e); dispatchListener.keyTyped(e); diff --git a/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java index 3ef0cda8aa..c2d5e52df6 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java @@ -3,6 +3,8 @@ package com.fr.quickeditor.cellquick; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.insert.cell.SubReportCellAction; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; import com.fr.general.Inter; import com.fr.quickeditor.CellQuickEditor; @@ -23,21 +25,23 @@ public class CellSubReportEditor extends CellQuickEditor { super(); } - @SuppressWarnings("Duplicates") @Override public JComponent createCenterBody() { JPanel content = new JPanel(new BorderLayout()); - content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); subReportButton = new UIButton(); subReportButton.setOpaque(false); - content.add(subReportButton, BorderLayout.CENTER); + content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{ + new Component[]{emptyLabel, subReportButton}}, + new double[]{TableLayout.PREFERRED}, + new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER); return content; } @Override protected void refreshDetails() { SubReportCellAction subReportCellAction = new SubReportCellAction(tc); - subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"})); + subReportCellAction.setName(Inter.getLocText("Edit")); + subReportCellAction.setSmallIcon(null); subReportButton.setAction(subReportCellAction); }