Browse Source

REPORT-2897 9.0设计器修改

缩放条tooltip部分视觉优化 pr修改
master
MoMeak 7 years ago
parent
commit
3dfeeccbd3
  1. 2
      designer/src/com/fr/design/actions/cell/CleanAuthorityAction.java
  2. 20
      designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java
  3. 14
      designer/src/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java
  4. 47
      designer/src/com/fr/design/mainframe/SheetAuthorityEditPane.java
  5. 2
      designer_base/src/com/fr/design/mainframe/AuthorityEditPane.java
  6. 98
      designer_base/src/com/fr/design/mainframe/JSliderPane.java

2
designer/src/com/fr/design/actions/cell/CleanAuthorityAction.java

File diff suppressed because one or more lines are too long

20
designer/src/com/fr/design/mainframe/AuthorityEditToolBarPane.java

@ -84,6 +84,8 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
private static final int TOP_GAP = 11;
private static final int LEFT_GAP = 4;
private static final int LEFT_CHECKPANE = 3;
private JPanel typePane;
private JPanel namePane;
private UILabel type = null;
private UILabel name = null;
private JPanel checkPane = null;
@ -144,9 +146,15 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
public AuthorityEditPane(List<ToolBarButton> buttonlists) {
setLayout(new BorderLayout());
type = new UILabel();
type.setBorder(BorderFactory.createLineBorder(Color.lightGray));
typePane = new JPanel(new BorderLayout());
typePane.add(type, BorderLayout.CENTER);
type.setBorder(BorderFactory.createEmptyBorder(0,LEFT_GAP,0,0));
typePane.setBorder(BorderFactory.createLineBorder(Color.lightGray));
name = new UILabel();
name.setBorder(BorderFactory.createLineBorder(Color.lightGray));
namePane = new JPanel(new BorderLayout());
namePane.add(name, BorderLayout.CENTER);
name.setBorder(BorderFactory.createEmptyBorder(0,LEFT_GAP,0,0));
namePane.setBorder(BorderFactory.createLineBorder(Color.lightGray));
checkPane = new JPanel();
checkPane.setLayout(new BorderLayout());
this.add(centerPane(), BorderLayout.NORTH);
@ -162,8 +170,8 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Type") + " ", SwingConstants.LEFT), type},
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_WF_Name") + " ", SwingConstants.LEFT), name},
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Type") + " ", SwingConstants.LEFT), typePane},
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_WF_Name") + " ", SwingConstants.LEFT), namePane},
new Component[]{checkPane, null},
};
@ -200,7 +208,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
if (name.getText() == "") {
type.setText("");
} else {
type.setText(" " + Inter.getLocText(new String[]{"ReportServerP-Toolbar", "FR-Designer_Form_Button"}));
type.setText(Inter.getLocText(new String[]{"ReportServerP-Toolbar", "FR-Designer_Form_Button"}));
}
}
@ -214,7 +222,7 @@ public class AuthorityEditToolBarPane extends AuthorityPropertyPane {
if (names != "") {
names = names.substring(1);
}
name.setText(" " + names);
name.setText(names);
}
public void populateCheckPane() {

14
designer/src/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java

@ -427,13 +427,13 @@ public class ElementCasePaneAuthorityEditPane extends AuthorityEditPane {
*/
public void populateType() {
if (selectionType == CellSelection.NORMAL) {
type.setText(" "+Inter.getLocText("FR-Designer_Cell"));
type.setText(Inter.getLocText("FR-Designer_Cell"));
} else if (selectionType == CellSelection.CHOOSE_ROW) {
type.setText(" "+Inter.getLocText("FR-Designer_Row"));
type.setText(Inter.getLocText("FR-Designer_Row"));
} else if (selectionType == CellSelection.CHOOSE_COLUMN) {
type.setText(" "+Inter.getLocText("FR-Designer_Column"));
type.setText(Inter.getLocText("FR-Designer_Column"));
} else {
type.setText(" "+Inter.getLocText("M_Insert-Float"));
type.setText(Inter.getLocText("M_Insert-Float"));
}
}
@ -442,11 +442,11 @@ public class ElementCasePaneAuthorityEditPane extends AuthorityEditPane {
*/
public void populateName() {
if (selectionType == CellSelection.NORMAL) {
name.setText(" "+getCellSelectionName());
name.setText(getCellSelectionName());
} else if (selectionType == CellSelection.CHOOSE_ROW || selectionType == CellSelection.CHOOSE_COLUMN) {
name.setText(" "+getCellColumnRowName());
name.setText(getCellColumnRowName());
} else {
name.setText(" "+getFloatSelectionName());
name.setText(getFloatSelectionName());
}
}

47
designer/src/com/fr/design/mainframe/SheetAuthorityEditPane.java

@ -34,6 +34,8 @@ public class SheetAuthorityEditPane extends AuthorityEditPane {
private UICheckBox sheetVisible = new UICheckBox("sheet" + Inter.getLocText("Widget-Visible"));
private WorkBook workBook = null;
private int selectedIndex = -1;
private JPanel typePane;
private JPanel namePane;
private ItemListener itemListener = new ItemListener() {
@Override
@ -66,9 +68,15 @@ public class SheetAuthorityEditPane extends AuthorityEditPane {
super(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
setLayout(new BorderLayout());
type = new UILabel();
type.setBorder(BorderFactory.createLineBorder(Color.lightGray));
typePane = new JPanel(new BorderLayout());
typePane.add(type, BorderLayout.CENTER);
type.setBorder(BorderFactory.createEmptyBorder(0,LEFT_GAP,0,0));
typePane.setBorder(BorderFactory.createLineBorder(Color.lightGray));
name = new UILabel();
name.setBorder(BorderFactory.createLineBorder(Color.lightGray));
namePane = new JPanel(new BorderLayout());
namePane.add(name, BorderLayout.CENTER);
name.setBorder(BorderFactory.createEmptyBorder(0,LEFT_GAP,0,0));
namePane.setBorder(BorderFactory.createLineBorder(Color.lightGray));
checkPane = new JPanel();
checkPane.setLayout(new BorderLayout());
// this.add(layoutText(), BorderLayout.WEST);
@ -87,41 +95,14 @@ public class SheetAuthorityEditPane extends AuthorityEditPane {
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Type") + " ", SwingConstants.LEFT), type},
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_WF_Name") + " ", SwingConstants.LEFT), name},
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Type") + " ", SwingConstants.LEFT), typePane},
new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_WF_Name") + " ", SwingConstants.LEFT), namePane},
new Component[]{checkPane, null},
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
}
private JPanel layoutText() {
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("Type") + ":", SwingConstants.RIGHT)},
new Component[]{new UILabel(Inter.getLocText("WF-Name") + ":", SwingConstants.RIGHT)},
new Component[]{new UILabel(Inter.getLocText("DashBoard-Potence") + ":", SwingConstants.RIGHT)},
};
double[] rowSize = {p, p, p};
double[] columnSize = {p};
int[][] rowCount = {{1}, {1}, {1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel layoutPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{type},
new Component[]{name},
new Component[]{checkPane},
};
double[] rowSize = {p, p, p};
double[] columnSize = {f};
int[][] rowCount = {{1}, {1}, {1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
/**
@ -146,14 +127,14 @@ public class SheetAuthorityEditPane extends AuthorityEditPane {
* 刷新类型
*/
public void populateType() {
type.setText(" " + "sheet");
type.setText("sheet");
}
/**
* 更新名字
*/
public void populateName() {
name.setText(" " + workBook.getReportName(selectedIndex));
name.setText(workBook.getReportName(selectedIndex));
}
/**

2
designer_base/src/com/fr/design/mainframe/AuthorityEditPane.java

@ -1 +1 @@
package com.fr.design.mainframe; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.TargetComponent; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.Inter; import javax.swing.*; import java.awt.*; /** * Author : daisy * Date: 13-9-12 * Time: 下午6:21 */ public abstract class AuthorityEditPane extends JPanel { protected static final int TOP_GAP = 11; protected static final int LEFT_GAP = 4; protected static final int RIGHT_GAP = 10; protected static final int ALIGNMENT_GAP = -3; protected static final int LEFT_CHECKPANE = 3; protected UILabel type = null; protected UILabel name = null; protected JPanel checkPane = null; private TargetComponent target; public AuthorityEditPane(TargetComponent target) { this.target = target; setLayout(new BorderLayout()); type = new UILabel(); type.setBorder(BorderFactory.createLineBorder(Color.lightGray)); name = new UILabel(); name.setBorder(BorderFactory.createLineBorder(Color.lightGray)); checkPane = new JPanel(); checkPane.setLayout(new BorderLayout()); // this.add(layoutText(), BorderLayout.WEST); // this.add(layoutPane(), BorderLayout.CENTER); this.add(centerPane(), BorderLayout.NORTH); this.setBorder(BorderFactory.createEmptyBorder(TOP_GAP, LEFT_GAP, 0, RIGHT_GAP)); } private JPanel centerPane() { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; Component[][] components = new Component[][]{ new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Type") + " ", SwingConstants.LEFT), type}, new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_WF_Name") + " ", SwingConstants.LEFT), name}, new Component[]{checkPane, null}, }; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); } /** * 更新权限编辑面板的具体内容:类型、名称、权限面板 */ public void populateDetials() { populateType(); populateName(); checkPane.removeAll(); populateCheckPane(); checkPane.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); } public abstract void populateType(); public abstract void populateName(); public abstract JPanel populateCheckPane(); }
package com.fr.design.mainframe; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.TargetComponent; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.Inter; import javax.swing.*; import java.awt.*; /** * Author : daisy * Date: 13-9-12 * Time: 下午6:21 */ public abstract class AuthorityEditPane extends JPanel { protected static final int TOP_GAP = 11; protected static final int LEFT_GAP = 4; protected static final int RIGHT_GAP = 10; protected static final int ALIGNMENT_GAP = -3; protected static final int LEFT_CHECKPANE = 3; protected UILabel type = null; protected UILabel name = null; protected JPanel checkPane = null; private TargetComponent target; private JPanel typePane; public AuthorityEditPane(TargetComponent target) { this.target = target; setLayout(new BorderLayout()); type = new UILabel(); type.setBorder(BorderFactory.createLineBorder(Color.lightGray)); name = new UILabel(); nam typePane.setBorder(BorderFactory.createLineBorder(Color.lightGray)); name = new UILabel(); namePane = new JPanel(new BorderLayout()); namePane.add(name, BorderLayout.CENTER); name.setBorder(BorderFactory.createEmptyBorder(0,LEFT_GAP,0,0)); namePane.setBorder(BorderFactory.createLineBorder(Color.lightGray)); checkPane = new JPanel(); checkPane.setLayout(new BorderLayout()); // this.add(layoutText(), BorderLayout.WEST); // this.add(layoutPane(), BorderLayout.CENTER); this.add(centerPane(), BorderLayout.NORTH); this.setBorder(BorderFactory.createEmptyBorder(TOP_GAP, LEFT_GAP, 0, RIGHT_GAP)); } private JPanel centerPane() { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; Component[][] components = new Component[][]{ new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_Type") + " ", SwingConstants.LEFT), typePane}, new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_WF_Name") + " ", SwingConstants.LEFT), namePane}, new Component[]{checkPane, null}, }; return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM); } /** * 更新权限编辑面板的具体内容:类型、名称、权限面板 */ public void populateDetials() { populateType(); populateName(); checkPane.removeAll(); populateCheckPane(); checkPane.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); } public abstract void populateType(); public abstract void populateName(); public abstract JPanel populateCheckPane(); }

98
designer_base/src/com/fr/design/mainframe/JSliderPane.java

@ -18,10 +18,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.*;
import java.math.BigDecimal;
/**
@ -48,6 +45,8 @@ public class JSliderPane extends JPanel {
private static final int SHOWVALBUTTON_WIDTH = 40;
private static final int SHOWVALBUTTON_HEIGHTH = 20;
private static final int SLIDER_GAP = 5;
private static final int TOOLTIP_Y = 25;
private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100;
public double resolutionTimes = 1.0;
@ -76,22 +75,70 @@ public class JSliderPane extends JPanel {
public JSliderPane() {
this.setLayout(new BorderLayout());
slider = new UISlider(0, HUNDRED, HALF_HUNDRED);
initSlider();
initShowValSpinner();
initDownUpButton();
initShowValButton();
initUIRadioButton();
initPane();
JPanel panel = new JPanel(new FlowLayout(1, 5, 0));
panel.add(downButton);
panel.add(slider);
panel.add(upButton);
panel.add(showValButton);
panel.setBackground(BACK_COLOR);
this.add(panel, BorderLayout.NORTH);
}
public static final JSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
}
private void initSlider() {
slider = new UISlider(0, HUNDRED, HALF_HUNDRED){
public Point getToolTipLocation(MouseEvent event){
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener);
slider.setPreferredSize(new Dimension(220, 20));
//去掉虚线框
slider.setFocusable(false);
slider.setToolTipText(Inter.getLocText("FR-Designer_Scale_Slider"));
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1));
}
private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOUR_HUNDRED, 1)){
public Point getToolTipLocation(MouseEvent event){
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"));
}
private void initDownUpButton() {
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")){
public Point getToolTipLocation(MouseEvent event){
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
downButton.setOpaque(false);
downButton.setBorderPainted(false);
downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")){
public Point getToolTipLocation(MouseEvent event){
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
upButton.setOpaque(false);
upButton.setBorderPainted(false);
upButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Up"));
@ -99,7 +146,14 @@ public class JSliderPane extends JPanel {
upButton.setActionCommand("more");
downButton.addActionListener(buttonActionListener);
upButton.addActionListener(buttonActionListener);
showValButton = new JButton(showValSpinner.getValue() + "%");
}
private void initShowValButton() {
showValButton = new JButton(showValSpinner.getValue() + "%"){
public Point getToolTipLocation(MouseEvent event){
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
showValButton.setOpaque(false);
showValButton.setMargin(new Insets(0, 0, 0, 0));
showValButton.setFont(new Font("SimSun", Font.PLAIN, 12));
@ -107,31 +161,7 @@ public class JSliderPane extends JPanel {
showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener);
//TODO 先注释,需要自定义tooltip
// showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
initUIRadioButton();
initPane();
JPanel panel = new JPanel(new FlowLayout(1, 5, 0));
panel.add(downButton);
panel.add(slider);
panel.add(upButton);
panel.add(showValButton);
panel.setBackground(BACK_COLOR);
this.add(panel, BorderLayout.NORTH);
}
public JToolTip createToolTip() {
JToolTip tip = new JToolTip();
tip.setComponent(this);
return tip;
}
public static final JSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade"));
}
private void initUIRadioButton() {

Loading…
Cancel
Save