Browse Source

REPORT-24206_设计器_修改边框颜色单元格背景颜色会变统一

bugfix/10.0
hades 5 years ago
parent
commit
8bccab743c
  1. 5
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java
  2. 26
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  3. 26
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java
  4. 15
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java
  5. 13
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java
  6. 7
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java
  7. 4
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java
  8. 19
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java
  9. 7
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java

5
designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java

@ -32,7 +32,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
protected BackgroundQuickPane[] paneList; protected BackgroundQuickPane[] paneList;
//获取当前面板 //获取当前面板
protected JPanel currentPane = null; protected BackgroundQuickPane currentPane = null;
public BackgroundPane() { public BackgroundPane() {
@ -43,7 +43,6 @@ public class BackgroundPane extends AbstractBasicStylePane {
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
typeComboBox = new UIComboBox(); typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout(); final CardLayout cardlayout = new CardLayout();
// this.add(typeComboBox, BorderLayout.NORTH);
paneList = supportKindsOfBackgroundUI(); paneList = supportKindsOfBackgroundUI();
@ -58,12 +57,12 @@ public class BackgroundPane extends AbstractBasicStylePane {
typeComboBox.addItem(pane.title4PopupWindow()); typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow()); centerPane.add(pane, pane.title4PopupWindow());
} }
// this.add(centerPane, BorderLayout.CENTER);
typeComboBox.addItemListener(new ItemListener() { typeComboBox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem()); cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem());
currentPane = paneList[typeComboBox.getSelectedIndex()];
fireStateChanged(); fireStateChanged();
} }
}); });

26
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -16,11 +16,14 @@ import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.general.Background;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -28,6 +31,7 @@ import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set;
/** /**
* @author zhou * @author zhou
@ -37,6 +41,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton",
"leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; "leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"};
private static final Set<String> BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY));
private boolean insideMode = false; private boolean insideMode = false;
private UIToggleButton topToggleButton; private UIToggleButton topToggleButton;
@ -193,25 +198,20 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
this.verticalToggleButton.setEnabled(this.insideMode); this.verticalToggleButton.setEnabled(this.insideMode);
} }
@Override
public Style update(Style style) { public Style update(Style style) {
if (style == null) { if (style == null) {
style = Style.DEFAULT_STYLE; style = Style.DEFAULT_STYLE;
} }
CellBorderStyle cellBorderStyle = this.update(); if (backgroundPane.currentPane.isBackgroundChange()) {
HashSet<String> borderSet = new HashSet<String>(Arrays.asList(BORDERARRAY)); style = style.deriveBackground(backgroundPane.update());
style = style.deriveBackground(backgroundPane.update()); }
if (backgroundPane.currentPane != backgroundPane.paneList[1]){ if (BORDER_SET.contains(globalNameListener.getGlobalName())) {
if (borderSet.contains(globalNameListener.getGlobalName())) { CellBorderStyle cellBorderStyle = this.update();
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
}else {
if (borderSet.contains(globalNameListener.getGlobalName()) && !((ColorBackgroundQuickPane) backgroundPane.currentPane).isBackGroundColor()){
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
} }
return style; return style;

26
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java

@ -2,14 +2,20 @@ package com.fr.design.mainframe.backgroundpane;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/** /**
* @author zhou * @author zhou
* @since 2012-5-29下午1:12:28 * @since 2012-5-29下午1:12:28
*/ */
public abstract class BackgroundQuickPane extends BasicBeanPane<Background> implements UIObserver { public abstract class BackgroundQuickPane extends BasicBeanPane<Background> implements UIObserver {
private boolean backgroundChange;
public abstract boolean accept(Background background); public abstract boolean accept(Background background);
@Override @Override
@ -23,6 +29,10 @@ public abstract class BackgroundQuickPane extends BasicBeanPane<Background> impl
public abstract void reset(); public abstract void reset();
public boolean isBackgroundChange() {
return backgroundChange;
}
/** /**
* 组件是否需要响应添加的观察者事件 * 组件是否需要响应添加的观察者事件
* *
@ -32,4 +42,20 @@ public abstract class BackgroundQuickPane extends BasicBeanPane<Background> impl
return true; return true;
} }
class ChangeListenerImpl implements ChangeListener {
private UIObserverListener listener;
public ChangeListenerImpl(UIObserverListener listener) {
this.listener = listener;
}
@Override
public void stateChanged(ChangeEvent e) {
backgroundChange = true;
this.listener.doChange();
backgroundChange = false;
}
}
} }

15
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java

@ -19,7 +19,6 @@ import java.awt.Color;
public class ColorBackgroundQuickPane extends BackgroundQuickPane { public class ColorBackgroundQuickPane extends BackgroundQuickPane {
private NewColorSelectPane detailColorSelectPane; private NewColorSelectPane detailColorSelectPane;
private boolean isBackGroundColor;
public ColorBackgroundQuickPane() { public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -39,7 +38,6 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
public void populateColor(Color color) { public void populateColor(Color color) {
this.detailColorSelectPane.setColor(color); this.detailColorSelectPane.setColor(color);
isBackGroundColor = false;
} }
public Color updateColor() { public Color updateColor() {
@ -47,23 +45,14 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
return this.detailColorSelectPane.getNotNoneColor(); return this.detailColorSelectPane.getNotNoneColor();
} }
public boolean isBackGroundColor() {
return isBackGroundColor;
}
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
detailColorSelectPane.addChangeListener(new ChangeListener() { detailColorSelectPane.addChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) {
isBackGroundColor = true;
listener.doChange();
isBackGroundColor = false;
}
});
} }
@Override @Override

13
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java

@ -96,17 +96,10 @@ public class GradientBackgroundQuickPane extends BackgroundQuickPane {
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
gradientBar.addChangeListener(new ChangeListener() { gradientBar.addChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) { directionPane.addChangeListener(new ChangeListenerImpl(listener));
listener.doChange();
}
});
directionPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
} }
@Override @Override

7
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java

@ -127,12 +127,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane {
*/ */
@Override @Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
changeListener = new ChangeListener() { changeListener = new ChangeListenerImpl(listener);
@Override
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
};
imageLayoutPane.addChangeListener(changeListener); imageLayoutPane.addChangeListener(changeListener);
} }

4
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java

@ -33,6 +33,10 @@ public class NullBackgroundQuickPane extends BackgroundQuickPane {
} }
@Override
public boolean isBackgroundChange() {
return true;
}
/** /**
* 是否接受 * 是否接受

19
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java

@ -112,23 +112,12 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane {
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
foregroundColorPane.addSelectChangeListener(new ChangeListener() { foregroundColorPane.addSelectChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) { backgroundColorPane.addSelectChangeListener(new ChangeListenerImpl(listener));
listener.doChange();
}
});
backgroundColorPane.addSelectChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
for (int i = 0, count = patternButtonArray.length; i < count; i++) { for (int i = 0, count = patternButtonArray.length; i < count; i++) {
patternButtonArray[i].addChangeListener(new ChangeListener() { patternButtonArray[i].addChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
} }
} }

7
designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java

@ -68,13 +68,10 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane {
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(final UIObserverListener listener) { public void registerChangeListener(final UIObserverListener listener) {
for (int i = 0, count = textureButtonArray.length; i < count; i++) { for (int i = 0, count = textureButtonArray.length; i < count; i++) {
textureButtonArray[i].addChangeListener(new ChangeListener() { textureButtonArray[i].addChangeListener(new ChangeListenerImpl(listener));
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
} }
} }

Loading…
Cancel
Save