Browse Source

REPORT-1096 取色板=>1、修改无透明颜色选择框的样式;2、“更多颜色”按钮下留出空隙;3、取色器按钮大小修改为与色块相同;4、空出一个色块的位置

master
plough 8 years ago
parent
commit
02f5befc45
  1. 25
      designer_base/src/com/fr/design/style/color/ColorSelectPane.java
  2. 11
      designer_base/src/com/fr/design/style/color/NewColorSelectPane.java
  3. 35
      designer_base/src/com/fr/design/style/color/UsedColorPane.java
  4. 12
      designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java

25
designer_base/src/com/fr/design/style/color/ColorSelectPane.java

@ -71,11 +71,8 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
centerPane.add(getRow1Pane());
JPanel menuColorPane1 = new JPanel();
JPanel menuColorPane1 = getMenuColorPane();
centerPane.add(menuColorPane1);
menuColorPane1.setLayout(new GridLayout(5, 8, 1, 1));
menuColorPane1.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
Color[] colorArray = this.getColorArray();
for (int i = 0; i < colorArray.length; i++) {
Color color = colorArray[i] == null ? UsedColorPane.DEFAULT_COLOR : colorArray[i];
@ -94,24 +91,28 @@ public class ColorSelectPane extends TransparentPane implements ColorSelectable
});
customButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
JPanel centerPane1 = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 8));
centerPane1.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8));
centerPane1.add(customButton, BorderLayout.NORTH);
centerPane.add(centerPane1);
}
protected JPanel getMenuColorPane() {
JPanel menuColorPane = new JPanel();
menuColorPane.setLayout(new GridLayout(5, 8, 1, 1));
menuColorPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
return menuColorPane;
}
// 第一行,1个取色按钮 + 7个最近使用的颜色
private JPanel getRow1Pane() {
protected JPanel getRow1Pane() {
JPanel row1Pane = new JPanel(FRGUIPaneFactory.createBorderLayout());
row1Pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 0));
row1Pane.setPreferredSize(new Dimension(135, 24)); // 宽度为 16 * 8 + 7
// 取色按钮
UIButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON16, true);
row1Pane.add(pickColorButton, BorderLayout.WEST);
// 最近使用
UsedColorPane usedColorPane = new UsedColorPane(1, 7, ColorSelectConfigManager.getInstance().getColors(),this);
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 8));
UsedColorPane usedColorPane = new UsedColorPane(1, 8, 1, true, ColorSelectConfigManager.getInstance().getColors(),this);
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8));
row1Pane.add(usedColorPane.getPane());
return row1Pane;
}

11
designer_base/src/com/fr/design/style/color/NewColorSelectPane.java

@ -79,19 +79,14 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
this.add(centerPane, BorderLayout.CENTER);
// 第一行,1个取色按钮 + 7个最近使用的颜色
// 第一行
JPanel row1Pane = new JPanel(FRGUIPaneFactory.createBorderLayout());
row1Pane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 0));
row1Pane.setPreferredSize(new Dimension(135, 16)); // 宽度为 16 * 8 + 7
centerPane.add(row1Pane);
// 取色按钮
UIButton pickColorButton = PickColorButtonFactory.getPickColorButton(this, PickColorButtonFactory.IconType.ICON16);
row1Pane.add(pickColorButton, BorderLayout.WEST);
// 最近使用
usedColorPane = new UsedColorPane(1, 7, ColorSelectConfigManager.getInstance().getColors(),this);
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 8));
usedColorPane = new UsedColorPane(1, 8, 1, true, ColorSelectConfigManager.getInstance().getColors(),this);
usedColorPane.getPane().setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 8));
row1Pane.add(usedColorPane.getPane());
JPanel menuColorPane1 = new JPanel();

35
designer_base/src/com/fr/design/style/color/UsedColorPane.java

@ -7,6 +7,7 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
public class UsedColorPane extends BasicPane{
@ -16,6 +17,10 @@ public class UsedColorPane extends BasicPane{
private int columns;
// 最近使用面板行数
private int rows;
// 留白的单元格数量
private int reserveCells;
// 是否需要取色器按钮
private boolean needPickColorButton;
// 最近使用颜色
private Object[] colors;
// 最近使用面板
@ -40,15 +45,23 @@ public class UsedColorPane extends BasicPane{
*
* @param rows
* @param columns
* @param reserveCells 留白的单元格个数
* @param needPickColorButton 是否需要加上取色器按钮
* @param colors 最近使用的颜色
*/
public UsedColorPane(int rows,int columns,Object[] colors,ColorSelectable selectable){
public UsedColorPane(int rows,int columns,int reserveCells, boolean needPickColorButton, Object[] colors,ColorSelectable selectable){
this.columns = columns;
this.rows = rows;
this.reserveCells = reserveCells;
this.needPickColorButton = needPickColorButton;
this.colors = colors;
this.selectable = selectable;
initialComponents();
}
public UsedColorPane(int rows,int columns, Object[] colors,ColorSelectable selectable){
this(rows, columns, 0, false, colors, selectable);
}
private void initialComponents(){
int total = columns * rows;
@ -57,9 +70,25 @@ public class UsedColorPane extends BasicPane{
panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
Color[] colors = ColorSelectConfigManager.getInstance().getColors();
int size = colors.length;
for (int i = 0; i < total; i++) {
int i = 0;
if (needPickColorButton) {
// 取色按钮
UIButton pickColorButton = PickColorButtonFactory.getPickColorButton(selectable, PickColorButtonFactory.IconType.ICON16, true);
panel.add(pickColorButton);
i++;
this.reserveCells += 1;
}
while (i < this.reserveCells) {
ColorCell cc = new ColorCell(DEFAULT_COLOR, selectable);
cc.setVisible(false);
panel.add(cc);
i++;
}
while (i < total) {
Color color = i < size ? colors[size-1-i]: DEFAULT_COLOR;
panel.add(new ColorCell(color == null ? DEFAULT_COLOR : color, selectable));
i++;
}
this.pane = panel;
}
@ -72,7 +101,7 @@ public class UsedColorPane extends BasicPane{
int total = columns * rows;
Color[] colors = ColorSelectConfigManager.getInstance().getColors();
int size = colors.length;
for(int i=0; i<total; i++){
for(int i=this.reserveCells; i<total; i++){
ColorCell cell = (ColorCell) this.pane.getComponent(i);
Color color = i < size ? colors[size-1-i]: DEFAULT_COLOR;
cell.setColor(color == null ? DEFAULT_COLOR : color);

12
designer_chart/src/com/fr/design/mainframe/chart/gui/ColorSelectPaneWithOutTransparent.java

@ -19,7 +19,7 @@ public class ColorSelectPaneWithOutTransparent extends ColorSelectPane {
public void initCenterPaneChildren(JPanel centerPane) {
JPanel menuColorPane1 = new JPanel();
centerPane.add(menuColorPane1);
menuColorPane1.setLayout(new GridLayout(5, 8, 5, 5));
menuColorPane1.setLayout(new GridLayout(3, 8, 5, 5));
for (int i = 0; i < ChartConstants.MAP_COLOR_ARRAY.length; i++) {
menuColorPane1.add(new ColorCell(ChartConstants.MAP_COLOR_ARRAY[i], this));
}
@ -30,4 +30,14 @@ public class ColorSelectPaneWithOutTransparent extends ColorSelectPane {
protected Color[] getColorArray(){
return ChartConstants.MAP_COLOR_ARRAY;
}
protected JPanel getMenuColorPane() {
JPanel menuColorPane = new JPanel();
menuColorPane.setLayout(new GridLayout(0, 8, 1, 1));
menuColorPane.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8));
menuColorPane.setPreferredSize(new Dimension(205, 62));
return menuColorPane;
}
}

Loading…
Cancel
Save