Browse Source

REPORT-3348 视觉调整

master
yaoh.wu 7 years ago
parent
commit
35b57ab860
  1. 13
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  2. 11
      designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  3. 8
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  4. 12
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  5. 12
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  6. 4
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  7. 12
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

13
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -48,6 +48,12 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
private int selectedIndex; private int selectedIndex;
private JPanel leftContentPane; private JPanel leftContentPane;
private UIScrollBar scrollBar; private UIScrollBar scrollBar;
/*占位label*/
protected static UILabel emptyLabel = new UILabel();
static {
emptyLabel.setPreferredSize(new Dimension(60, 20));
}
public CellQuickEditor() { public CellQuickEditor() {
@ -89,13 +95,14 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
JComponent centerBody = createCenterBody();
centerBody.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 0, this.getBackground()));
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{initTopContent(), null}, new Component[]{initTopContent(), null},
new Component[]{createCenterBody(), null} new Component[]{centerBody, null}
}; };
leftContentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); leftContentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BarLayout()); this.setLayout(new BarLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(scrollBar); this.add(scrollBar);
this.add(leftContentPane); this.add(leftContentPane);
} }
@ -116,7 +123,7 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
new Component[]{insertContentLabel, cellElementEditButton}, new Component[]{insertContentLabel, cellElementEditButton},
}; };
JPanel topContent = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); 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; return topContent;
} }

11
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.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; 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.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.painter.BiasTextPainter; import com.fr.report.cell.painter.BiasTextPainter;
@ -25,8 +26,7 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); UIButton editButton = new UIButton(Inter.getLocText("Edit"));
UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/bias.png"));
editButton.addActionListener(new ActionListener() { editButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -34,7 +34,10 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
} }
}); });
editButton.setOpaque(false); 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; return content;
} }

8
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -135,7 +135,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
String[] iconArray = new String[paneList.size()]; String[] iconArray = new String[paneList.size()];
card = new CardLayout(); card = new CardLayout();
cardContainer = new JPanel(card); cardContainer = new JPanel(card);
cardContainer.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
for (int i = 0; i < paneList.size(); i++) { for (int i = 0; i < paneList.size(); i++) {
CellEditorPane pane = paneList.get(i); CellEditorPane pane = paneList.get(i);
iconArray[i] = pane.getIconPath(); iconArray[i] = pane.getIconPath();
@ -227,9 +226,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
new Component[]{uiLabel, uiButton} new Component[]{uiLabel, uiButton}
}; };
conditionPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); conditionPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.add(this.createContentPane(), BorderLayout.CENTER); 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() { public DSColumnAdvancedEditorPane() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(this.createContentPane(), BorderLayout.CENTER); 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 @Override
public void populate() { public void populate() {
if (cellElement != null) { if (cellElement != null) {
@ -374,7 +371,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
/** /**
* 更新单元格扩展属性 * 更新单元格扩展属性
*/ */
@SuppressWarnings("Duplicates")
private void updateExtendConfig() { private void updateExtendConfig() {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr == null) { if (cellExpandAttr == null) {

12
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.actions.insert.cell.ImageCellAction;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; 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.mainframe.DesignerContext;
import com.fr.design.report.SelectImagePane; import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
@ -33,8 +34,7 @@ public class CellImageQuickEditor extends CellQuickEditor {
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); UIButton editButton = new UIButton(Inter.getLocText("Edit"));
UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
editButton.addActionListener(new ActionListener() { editButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -42,11 +42,13 @@ public class CellImageQuickEditor extends CellQuickEditor {
} }
}); });
editButton.setOpaque(false); 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; return content;
} }
@SuppressWarnings("Duplicates")
private void showEditingDialog() { private void showEditingDialog() {
final SelectImagePane imageEditorPane = new SelectImagePane(); final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(cellElement); imageEditorPane.populate(cellElement);

12
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.core.ActionFactory;
import com.fr.design.actions.insert.cell.RichTextCellAction; import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.gui.ibutton.UIButton; 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.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
@ -22,14 +24,15 @@ public class CellRichTextEditor extends CellQuickEditor {
super(); super();
} }
@SuppressWarnings("Duplicates")
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
richTextButton = new UIButton(); richTextButton = new UIButton();
richTextButton.setOpaque(false); 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; return content;
} }
@ -41,7 +44,8 @@ public class CellRichTextEditor extends CellQuickEditor {
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
RichTextCellAction subReportCellAction = new RichTextCellAction(tc); RichTextCellAction subReportCellAction = new RichTextCellAction(tc);
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor")); subReportCellAction.setName(Inter.getLocText("Edit"));
subReportCellAction.setSmallIcon(null);
richTextButton.setAction(subReportCellAction); richTextButton.setAction(subReportCellAction);
} }

4
designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -28,7 +28,6 @@ public class CellStringQuickEditor extends CellQuickEditor {
//编辑状态 //编辑状态
private boolean isEditing = false; private boolean isEditing = false;
//august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。 //august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
private boolean reserveInResult = false; private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true; private boolean reserveOnWriteOrAnaly = true;
@ -61,7 +60,6 @@ public class CellStringQuickEditor extends CellQuickEditor {
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
stringTextArea = new UITextArea(); stringTextArea = new UITextArea();
stringTextArea.addKeyListener(new KeyAdapter() { stringTextArea.addKeyListener(new KeyAdapter() {
@ -71,7 +69,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
return; return;
} }
if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getKeyCode() == KeyEvent.VK_ENTER) {
//todo yaoh.wu虽然模仿选中单元格按enter可以做到,但是原理没有弄清楚。 //todo 按enter键换至下一个单元格 yaoh.wu虽然模仿选中单元格按enter这种场景可以做到,但是原理没有弄清楚。
GridKeyListener dispatchListener = new GridKeyListener(tc.getGrid()); GridKeyListener dispatchListener = new GridKeyListener(tc.getGrid());
dispatchListener.keyPressed(e); dispatchListener.keyPressed(e);
dispatchListener.keyTyped(e); dispatchListener.keyTyped(e);

12
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.core.ActionFactory;
import com.fr.design.actions.insert.cell.SubReportCellAction; import com.fr.design.actions.insert.cell.SubReportCellAction;
import com.fr.design.gui.ibutton.UIButton; 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.general.Inter;
import com.fr.quickeditor.CellQuickEditor; import com.fr.quickeditor.CellQuickEditor;
@ -23,21 +25,23 @@ public class CellSubReportEditor extends CellQuickEditor {
super(); super();
} }
@SuppressWarnings("Duplicates")
@Override @Override
public JComponent createCenterBody() { public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
subReportButton = new UIButton(); subReportButton = new UIButton();
subReportButton.setOpaque(false); 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; return content;
} }
@Override @Override
protected void refreshDetails() { protected void refreshDetails() {
SubReportCellAction subReportCellAction = new SubReportCellAction(tc); 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); subReportButton.setAction(subReportCellAction);
} }

Loading…
Cancel
Save