Browse Source

Merge pull request #1368 in DESIGN/design from ~HADES/design:bugfix/10.0 to bugfix/10.0

* commit '6f27c10428be5070c8292e30788376950693bb30':
  fix import
  REPORT-24206_设计器_修改边框颜色单元格背景颜色会变统一
bugfix/10.0
Hades 5 years ago
parent
commit
0431084a80
  1. 5
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java
  2. 16
      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 JPanel currentPane = null;
protected BackgroundQuickPane currentPane = null;
public BackgroundPane() {
@ -43,7 +43,6 @@ public class BackgroundPane extends AbstractBasicStylePane {
this.setLayout(new BorderLayout(0, 6));
typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout();
// this.add(typeComboBox, BorderLayout.NORTH);
paneList = supportKindsOfBackgroundUI();
@ -58,12 +57,12 @@ public class BackgroundPane extends AbstractBasicStylePane {
typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow());
}
// this.add(centerPane, BorderLayout.CENTER);
typeComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem());
currentPane = paneList[typeComboBox.getSelectedIndex()];
fireStateChanged();
}
});

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

@ -16,7 +16,6 @@ import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.stable.Constants;
@ -28,6 +27,7 @@ import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* @author zhou
@ -37,6 +37,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton",
"leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"};
private static final Set<String> BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY));
private boolean insideMode = false;
private UIToggleButton topToggleButton;
@ -193,26 +194,21 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
this.verticalToggleButton.setEnabled(this.insideMode);
}
@Override
public Style update(Style style) {
if (style == null) {
style = Style.DEFAULT_STYLE;
}
CellBorderStyle cellBorderStyle = this.update();
HashSet<String> borderSet = new HashSet<String>(Arrays.asList(BORDERARRAY));
if (backgroundPane.currentPane.isBackgroundChange()) {
style = style.deriveBackground(backgroundPane.update());
if (backgroundPane.currentPane != backgroundPane.paneList[1]){
if (borderSet.contains(globalNameListener.getGlobalName())) {
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
}else {
if (borderSet.contains(globalNameListener.getGlobalName()) && !((ColorBackgroundQuickPane) backgroundPane.currentPane).isBackGroundColor()){
if (BORDER_SET.contains(globalNameListener.getGlobalName())) {
CellBorderStyle cellBorderStyle = this.update();
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
}
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.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.general.Background;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/**
* @author zhou
* @since 2012-5-29下午1:12:28
*/
public abstract class BackgroundQuickPane extends BasicBeanPane<Background> implements UIObserver {
private boolean backgroundChange;
public abstract boolean accept(Background background);
@Override
@ -23,6 +29,10 @@ public abstract class BackgroundQuickPane extends BasicBeanPane<Background> impl
public abstract void reset();
public boolean isBackgroundChange() {
return backgroundChange;
}
/**
* 组件是否需要响应添加的观察者事件
*
@ -32,4 +42,20 @@ public abstract class BackgroundQuickPane extends BasicBeanPane<Background> impl
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 {
private NewColorSelectPane detailColorSelectPane;
private boolean isBackGroundColor;
public ColorBackgroundQuickPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -39,7 +38,6 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
public void populateColor(Color color) {
this.detailColorSelectPane.setColor(color);
isBackGroundColor = false;
}
public Color updateColor() {
@ -47,23 +45,14 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane {
return this.detailColorSelectPane.getNotNoneColor();
}
public boolean isBackGroundColor() {
return isBackGroundColor;
}
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
@Override
public void registerChangeListener(final UIObserverListener listener) {
detailColorSelectPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
isBackGroundColor = true;
listener.doChange();
isBackGroundColor = false;
}
});
detailColorSelectPane.addChangeListener(new ChangeListenerImpl(listener));
}
@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 观察者监听事件
*/
@Override
public void registerChangeListener(final UIObserverListener listener) {
gradientBar.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
directionPane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
listener.doChange();
}
});
gradientBar.addChangeListener(new ChangeListenerImpl(listener));
directionPane.addChangeListener(new ChangeListenerImpl(listener));
}
@Override

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

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

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

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

Loading…
Cancel
Save