Browse Source

Merge branch 'temp' into release/9.0

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

Loading…
Cancel
Save