Browse Source

Merge pull request #96 in BA/design from ~RICHIE/design:dev to dev

* commit 'ac4773554653bcf5dc3ec32f481657e954b4a433':
  引用错误
master
superman 9 years ago
parent
commit
d0d720c652
  1. 25
      designer_base/src/com/fr/design/gui/style/BackgroundNoImagePane.java
  2. 79
      designer_base/src/com/fr/design/gui/style/BackgroundPane.java
  3. 28
      designer_base/src/com/fr/design/gui/style/BackgroundSpecialPane.java
  4. 11
      designer_base/src/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java
  5. 4
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartBackgroundNoImagePane.java
  6. 8
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartBackgroundPane.java

25
designer_base/src/com/fr/design/gui/style/BackgroundNoImagePane.java

@ -1,10 +1,10 @@
package com.fr.design.gui.style;
import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.backgroundpane.BackgroundSettingPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundPane;
import java.util.ArrayList;
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
/**
* Created with IntelliJ IDEA.
@ -18,8 +18,9 @@ public class BackgroundNoImagePane extends BackgroundPane{
super();
}
protected void initPaneList(){
ColorBackgroundPane colorBackgroundPane = new ColorBackgroundPane();
@Override
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane();
colorBackgroundPane.registerChangeListener(new UIObserverListener() {
@Override
@ -27,7 +28,7 @@ public class BackgroundNoImagePane extends BackgroundPane{
fireStateChanged();
}
});
GradientPane gradientPane = new GradientPane();
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() {
@Override
@ -35,10 +36,10 @@ public class BackgroundNoImagePane extends BackgroundPane{
fireStateChanged();
}
});
paneList = new ArrayList<BackgroundSettingPane>();
paneList.add(new NullBackgroundPane());
paneList.add(colorBackgroundPane);
paneList.add(gradientPane);
return new BackgroundQuickPane[]{
new NullBackgroundQuickPane(),
colorBackgroundPane,
gradientPane
};
}
}

79
designer_base/src/com/fr/design/gui/style/BackgroundPane.java

@ -1,34 +1,22 @@
package com.fr.design.gui.style;
/*
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved.
*/
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Style;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.BackgroundQuickUIProvider;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.mainframe.backgroundpane.BackgroundSettingPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundPane;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundPane;
import com.fr.design.mainframe.backgroundpane.PatternBackgroundPane;
import com.fr.design.mainframe.backgroundpane.TextureBackgroundPane;
import com.fr.design.mainframe.backgroundpane.*;
import com.fr.general.Background;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
/**
*
* @author zhou
* @since 2012-5-28下午6:22:09
*/
@ -36,7 +24,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
private UIComboBox typeComboBox;
protected List<BackgroundSettingPane> paneList;
protected BackgroundQuickPane[] paneList;
public BackgroundPane() {
this.initComponents();
@ -48,16 +36,16 @@ public class BackgroundPane extends AbstractBasicStylePane {
final CardLayout cardlayout = new CardLayout();
this.add(typeComboBox, BorderLayout.NORTH);
initPaneList();
paneList = supportKindsOfBackgroundUI();
final JPanel centerPane = new JPanel(cardlayout) {
@Override
public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度
int index = typeComboBox.getSelectedIndex();
return new Dimension(super.getPreferredSize().width, paneList.get(index).getPreferredSize().height);
return new Dimension(super.getPreferredSize().width, paneList[index].getPreferredSize().height);
}
};
for (int i = 0; i < paneList.size(); i++) {
BackgroundSettingPane pane = paneList.get(i);
for (BackgroundQuickPane pane : paneList) {
typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow());
}
@ -66,24 +54,32 @@ public class BackgroundPane extends AbstractBasicStylePane {
@Override
public void itemStateChanged(ItemEvent e) {
cardlayout.show(centerPane, (String)typeComboBox.getSelectedItem());
cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem());
fireStateChanged();
}
});
}
protected void initPaneList(){
paneList = new ArrayList<BackgroundSettingPane>();
paneList.add(new NullBackgroundPane());
paneList.add(new ColorBackgroundPane());
paneList.add(new TextureBackgroundPane());
paneList.add(new PatternBackgroundPane());
paneList.add(new ImageBackgroundPane());
paneList.add(new GradientPane());
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
java.util.List<BackgroundQuickPane> kinds = new ArrayList<>();
kinds.add(new NullBackgroundQuickPane());
kinds.add(new ColorBackgroundQuickPane());
kinds.add(new TextureBackgroundQuickPane());
kinds.add(new PatternBackgroundQuickPane());
kinds.add(new ImageBackgroundQuickPane());
kinds.add(new GradientBackgroundQuickPane());
BackgroundQuickUIProvider[] providers = ExtraDesignClassManager.getInstance().getBackgroundQuickUIProviders();
for (BackgroundQuickUIProvider provider : providers) {
kinds.add(provider.appearanceForBackground());
}
return kinds.toArray(new BackgroundQuickPane[kinds.size()]);
}
/**
* 事件监听
*
* @param changeListener 事件
*/
public void addChangeListener(ChangeListener changeListener) {
@ -101,13 +97,14 @@ public class BackgroundPane extends AbstractBasicStylePane {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener)listeners[i + 1]).stateChanged(e);
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
/**
* 名称
*
* @return 名称
*/
public String title4PopupWindow() {
@ -118,8 +115,8 @@ public class BackgroundPane extends AbstractBasicStylePane {
* Populate background.
*/
public void populateBean(Background background) {
for (int i = 0; i < paneList.size(); i++) {
BackgroundSettingPane pane = paneList.get(i);
for (int i = 0; i < paneList.length; i++) {
BackgroundQuickPane pane = paneList[i];
if (pane.accept(background)) {
pane.populateBean(background);
typeComboBox.setSelectedIndex(i);
@ -132,7 +129,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
* Update background.
*/
public Background update() {
return paneList.get(typeComboBox.getSelectedIndex()).updateBean();
return paneList[typeComboBox.getSelectedIndex()].updateBean();
}
@Override

28
designer_base/src/com/fr/design/gui/style/BackgroundSpecialPane.java

@ -1,12 +1,7 @@
package com.fr.design.gui.style;
import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.backgroundpane.BackgroundSettingPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundPane;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundPane;
import java.util.ArrayList;
import com.fr.design.mainframe.backgroundpane.*;
/**
* Created with IntelliJ IDEA.
@ -20,8 +15,9 @@ public class BackgroundSpecialPane extends BackgroundPane{
super();
}
protected void initPaneList(){
ColorBackgroundPane colorBackgroundPane = new ColorBackgroundPane();
@Override
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane();
colorBackgroundPane.registerChangeListener(new UIObserverListener() {
@Override
@ -29,7 +25,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged();
}
});
ImageBackgroundPane imageBackgroundPane = new ImageBackgroundPane();
ImageBackgroundQuickPane imageBackgroundPane = new ImageBackgroundQuickPane();
imageBackgroundPane.registerChangeListener(new UIObserverListener() {
@Override
@ -37,18 +33,18 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged();
}
});
GradientPane gradientPane = new GradientPane();
GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
fireStateChanged();
}
});
paneList = new ArrayList<BackgroundSettingPane>();
paneList.add(new NullBackgroundPane());
paneList.add(colorBackgroundPane);
paneList.add(imageBackgroundPane);
paneList.add(gradientPane);
return new BackgroundQuickPane[] {
new NullBackgroundQuickPane(),
colorBackgroundPane,
imageBackgroundPane,
gradientPane
};
}
}

11
designer_base/src/com/fr/design/gui/style/GradientPane.java → designer_base/src/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java

@ -1,4 +1,4 @@
package com.fr.design.gui.style;
package com.fr.design.mainframe.backgroundpane;
import com.fr.base.background.GradientBackground;
import com.fr.design.event.UIObserverListener;
@ -6,10 +6,9 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
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.BackgroundSettingPane;
import com.fr.design.style.background.gradient.GradientBar;
import com.fr.general.Background;
import com.fr.general.Inter;
import com.fr.design.style.background.gradient.GradientBar;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -20,7 +19,7 @@ import java.awt.*;
* @author zhou
* @since 2012-5-30上午10:36:21
*/
public class GradientPane extends BackgroundSettingPane {
public class GradientBackgroundQuickPane extends BackgroundQuickPane {
private static final long serialVersionUID = -6854603990673031897L;
private static final int DEFAULT_GRADIENT_WIDTH = 185;
@ -30,11 +29,11 @@ public class GradientPane extends BackgroundSettingPane {
private GradientBar gradientBar;
private UIButtonGroup<Integer> directionPane;
public GradientPane() {
public GradientBackgroundQuickPane() {
constructPane();
}
public GradientPane(int gradientBarWidth) {
public GradientBackgroundQuickPane(int gradientBarWidth) {
this.gradientBarWidth = gradientBarWidth;
constructPane();
}

4
designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartBackgroundNoImagePane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.chart.gui.style;
import com.fr.design.gui.style.GradientQuickPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
/**
@ -18,6 +18,6 @@ public class ChartBackgroundNoImagePane extends ChartBackgroundPane {
protected void initList() {
paneList.add(new NullBackgroundQuickPane());
paneList.add(new ColorBackgroundQuickPane());
paneList.add(new GradientQuickPane(CHART_GRADIENT_WIDTH));
paneList.add(new GradientBackgroundQuickPane(CHART_GRADIENT_WIDTH));
}
}

8
designer_chart/src/com/fr/design/mainframe/chart/gui/style/ChartBackgroundPane.java

@ -4,13 +4,9 @@ import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.GradientQuickPane;
import com.fr.design.layout.TableLayout;
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.ImageBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.*;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Background;
import com.fr.general.Inter;
@ -92,7 +88,7 @@ public class ChartBackgroundPane extends BasicPane{
paneList.add(new NullBackgroundQuickPane());
paneList.add(new ColorBackgroundQuickPane());
paneList.add(new ImageBackgroundQuickPane());
paneList.add(new GradientQuickPane(CHART_GRADIENT_WIDTH));
paneList.add(new GradientBackgroundQuickPane(CHART_GRADIENT_WIDTH));
}
/**

Loading…
Cancel
Save