Browse Source

REPORT-3895 [9.0一轮回归]渐变色左边箭头不易操作,右边箭头不显示如附件图片

REPORT-3896 [9.0一轮回归]样式单元格背景图案的前景和背景选择按钮只显示一半如附件图片
master
MoMeak 7 years ago
parent
commit
fa21593fcc
  1. 2
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  2. 4
      designer_base/src/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java
  3. 7
      designer_base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  4. 372
      designer_base/src/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java
  5. 1
      designer_base/src/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java

2
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -248,8 +248,6 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
}
}
});
tooltipTextField = new UITextField();
tooltipTextField.getUI();
return fileNamePane;
}

4
designer_base/src/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java

@ -22,7 +22,7 @@ import java.awt.*;
public class GradientBackgroundQuickPane extends BackgroundQuickPane {
private static final long serialVersionUID = -6854603990673031897L;
private static final int DEFAULT_GRADIENT_WIDTH = 185;
private static final int DEFAULT_GRADIENT_WIDTH = 150 ;
private int gradientBarWidth = DEFAULT_GRADIENT_WIDTH;
@ -52,7 +52,7 @@ public class GradientBackgroundQuickPane extends BackgroundQuickPane {
Component[][] components = new Component[][]{
new Component[]{gradientBar, null},
new Component[]{new UILabel(Inter.getLocText("Gradient-Direction") + ":"), directionPane}
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Gradient_Direction")), directionPane}
};
JPanel Gradient = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());

7
designer_base/src/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java

@ -61,17 +61,14 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
contentPane.add(southPane, BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER);
JPanel selectFilePane = new JPanel(new GridLayout(0, 2));
UIButton selectPictureButton = new UIButton(Inter.getLocText("Image-Select_Picture"));
selectFilePane.add(new JPanel());
selectFilePane.add(selectPictureButton);
selectPictureButton.addActionListener(selectPictureActionListener);
if(hasImageLayout){
southPane.add(imageLayoutPane, BorderLayout.CENTER);
southPane.add(imageLayoutPane, BorderLayout.SOUTH);
}
southPane.add(selectFilePane, BorderLayout.SOUTH);
southPane.add(selectPictureButton, BorderLayout.CENTER);
imageLayoutPane.addChangeListener(new ChangeListener() {

372
designer_base/src/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java

@ -2,14 +2,17 @@ package com.fr.design.mainframe.backgroundpane;
import com.fr.base.GraphHelper;
import com.fr.base.background.PatternBackground;
import com.fr.design.constants.UIConstants;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.Background;
import com.fr.general.Inter;
import com.fr.design.style.color.ColorSelectBox;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -25,182 +28,191 @@ import java.awt.geom.Rectangle2D;
*/
public class PatternBackgroundQuickPane extends BackgroundQuickPane {
private int patternIndex = 0; // pattern setIndex.
private final static int DEFAULT_DIM_HEIGHT = 190;
private ColorSelectBox foregroundColorPane;
private ColorSelectBox backgroundColorPane;
private PatternButton[] patternButtonArray;
public PatternBackgroundQuickPane() {
this.setLayout(new BorderLayout(0, 4));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(contentPane, BorderLayout.NORTH);
contentPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5));
JPanel typePane2 = new JPanel();
contentPane.add(typePane2);
typePane2.setLayout(new GridLayout(0, 8, 1, 1));
typePane2.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
ButtonGroup patternButtonGroup = new ButtonGroup();
patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT];
for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) {
patternButtonArray[i] = new PatternButton(i);
patternButtonGroup.add(patternButtonArray[i]);
typePane2.add(patternButtonArray[i]);
}
JPanel colorPane = new JPanel(new GridLayout(0, 2));
foregroundColorPane = new ColorSelectBox(70);
backgroundColorPane = new ColorSelectBox(70);
colorPane.add(this.createLabelColorPane(Inter.getLocText("FR-Designer_Foreground") + ":", foregroundColorPane));
colorPane.add(this.createLabelColorPane(Inter.getLocText("FR-Designer_Background") + ":", backgroundColorPane));
this.add(colorPane, BorderLayout.CENTER);
foregroundColorPane.addSelectChangeListener(colorChangeListener);
backgroundColorPane.addSelectChangeListener(colorChangeListener);
}
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.height = DEFAULT_DIM_HEIGHT;
return dim;
}
private JPanel createLabelColorPane(String text, JComponent colorPane) {
JPanel labelColorPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
labelColorPane.add(new UILabel(text));
labelColorPane.add(colorPane);
return labelColorPane;
}
public void populateBean(Background background) {
PatternBackground patternBackground = (PatternBackground) background;
int patternIndex = patternBackground.getPatternIndex();
if (patternIndex >= 0 && patternIndex < this.patternButtonArray.length) {
this.patternButtonArray[patternIndex].setSelected(true);
this.patternIndex = patternIndex;
} else {
this.patternIndex = 0;
}
foregroundColorPane.setSelectObject(patternBackground.getForeground());
backgroundColorPane.setSelectObject(patternBackground.getBackground());
}
public Background updateBean() {
return new PatternBackground(patternIndex, foregroundColorPane.getSelectObject(), backgroundColorPane.getSelectObject());
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(final UIObserverListener listener) {
foregroundColorPane.addSelectChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
backgroundColorPane.addSelectChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
for (int i = 0, count = patternButtonArray.length; i < count; i ++) {
patternButtonArray[i].addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
}
}
// Foreground or Background changed.
ChangeListener colorChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
for (int i = 0; i < patternButtonArray.length; i++) {
patternButtonArray[i].setPatternForeground(foregroundColorPane.getSelectObject());
patternButtonArray[i].setPatternBackground(backgroundColorPane.getSelectObject());
}
PatternBackgroundQuickPane.this.repaint();// repaint
}
};
/**
* Pattern type button.
*/
class PatternButton extends JToggleButton implements ActionListener {
public PatternButton(int pIndex) {
this.pIndex = pIndex;
this.addActionListener(this);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.setBorder(null);
this.patternBackground = new PatternBackground(this.pIndex, Color.lightGray, Color.black);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
if (this.pIndex == patternIndex) {// it's selected.
g2d.setPaint(UIConstants.LINE_COLOR);
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
}
}
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 20);
}
public void setPatternForeground(Color foreground) {
this.patternBackground.setForeground(foreground);
}
public void setPatternBackground(Color background) {
this.patternBackground.setBackground(background);
}
/**
* set Pattern setIndex.
*/
public void actionPerformed(ActionEvent evt) {
PatternBackgroundQuickPane.this.patternIndex = pIndex;
fireChagneListener();
PatternBackgroundQuickPane.this.repaint();// repaint
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
private int pIndex = 0;
private PatternBackground patternBackground;
}
@Override
public boolean accept(Background background) {
return background instanceof PatternBackground;
}
@Override
public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Background-Pattern");
}
private int patternIndex = 0; // pattern setIndex.
private final static int DEFAULT_DIM_HEIGHT = 210;
private ColorSelectBox foregroundColorPane;
private ColorSelectBox backgroundColorPane;
private PatternButton[] patternButtonArray;
public PatternBackgroundQuickPane() {
this.setLayout(new BorderLayout(0, 4));
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(contentPane, BorderLayout.NORTH);
contentPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5));
JPanel typePane2 = new JPanel();
contentPane.add(typePane2);
typePane2.setLayout(new GridLayout(0, 8, 1, 1));
typePane2.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
ButtonGroup patternButtonGroup = new ButtonGroup();
patternButtonArray = new PatternButton[PatternBackground.PATTERN_COUNT];
for (int i = 0; i < PatternBackground.PATTERN_COUNT; i++) {
patternButtonArray[i] = new PatternButton(i);
patternButtonGroup.add(patternButtonArray[i]);
typePane2.add(patternButtonArray[i]);
}
foregroundColorPane = new ColorSelectBox(60);
backgroundColorPane = new ColorSelectBox(60);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Foreground"), UILabel.LEFT), foregroundColorPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Background"), UILabel.LEFT), backgroundColorPane},
};
double[] rowSize = {p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
JPanel colorPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_LARGE);
this.add(colorPane, BorderLayout.CENTER);
foregroundColorPane.addSelectChangeListener(colorChangeListener);
backgroundColorPane.addSelectChangeListener(colorChangeListener);
}
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.height = DEFAULT_DIM_HEIGHT;
return dim;
}
private JPanel createLabelColorPane(String text, JComponent colorPane) {
JPanel labelColorPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
labelColorPane.add(new UILabel(text));
labelColorPane.add(colorPane);
return labelColorPane;
}
public void populateBean(Background background) {
PatternBackground patternBackground = (PatternBackground) background;
int patternIndex = patternBackground.getPatternIndex();
if (patternIndex >= 0 && patternIndex < this.patternButtonArray.length) {
this.patternButtonArray[patternIndex].setSelected(true);
this.patternIndex = patternIndex;
} else {
this.patternIndex = 0;
}
foregroundColorPane.setSelectObject(patternBackground.getForeground());
backgroundColorPane.setSelectObject(patternBackground.getBackground());
}
public Background updateBean() {
return new PatternBackground(patternIndex, foregroundColorPane.getSelectObject(), backgroundColorPane.getSelectObject());
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(final UIObserverListener listener) {
foregroundColorPane.addSelectChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
backgroundColorPane.addSelectChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
for (int i = 0, count = patternButtonArray.length; i < count; i++) {
patternButtonArray[i].addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
}
}
// Foreground or Background changed.
ChangeListener colorChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent e) {
for (int i = 0; i < patternButtonArray.length; i++) {
patternButtonArray[i].setPatternForeground(foregroundColorPane.getSelectObject());
patternButtonArray[i].setPatternBackground(backgroundColorPane.getSelectObject());
}
PatternBackgroundQuickPane.this.repaint();// repaint
}
};
/**
* Pattern type button.
*/
class PatternButton extends JToggleButton implements ActionListener {
public PatternButton(int pIndex) {
this.pIndex = pIndex;
this.addActionListener(this);
this.setCursor(new Cursor(Cursor.HAND_CURSOR));
this.setBorder(null);
this.patternBackground = new PatternBackground(this.pIndex, Color.lightGray, Color.black);
}
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
if (this.pIndex == patternIndex) {// it's selected.
g2d.setPaint(UIConstants.LINE_COLOR);
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
}
}
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 20);
}
public void setPatternForeground(Color foreground) {
this.patternBackground.setForeground(foreground);
}
public void setPatternBackground(Color background) {
this.patternBackground.setBackground(background);
}
/**
* set Pattern setIndex.
*/
public void actionPerformed(ActionEvent evt) {
PatternBackgroundQuickPane.this.patternIndex = pIndex;
fireChagneListener();
PatternBackgroundQuickPane.this.repaint();// repaint
}
public void addChangeListener(ChangeListener changeListener) {
this.changeListener = changeListener;
}
private void fireChagneListener() {
if (this.changeListener != null) {
ChangeEvent evt = new ChangeEvent(this);
this.changeListener.stateChanged(evt);
}
}
private int pIndex = 0;
private PatternBackground patternBackground;
}
@Override
public boolean accept(Background background) {
return background instanceof PatternBackground;
}
@Override
public String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Background-Pattern");
}
}

1
designer_base/src/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java

@ -33,7 +33,6 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane {
this.add(borderPane, BorderLayout.NORTH);
contentPane.setLayout(new GridLayout(0, 8, 1, 1));
contentPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
borderPane.setPreferredSize(new Dimension(0, 145));
ButtonGroup patternButtonGroup = new ButtonGroup();
textureButtonArray = new TextureButton[EMBED_TEXTURE_PAINT_ARRAY.length];
for (int i = 0; i < EMBED_TEXTURE_PAINT_ARRAY.length; i++) {

Loading…
Cancel
Save