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

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

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

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

@ -1,12 +1,7 @@
package com.fr.design.gui.style; package com.fr.design.gui.style;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.backgroundpane.BackgroundSettingPane; import com.fr.design.mainframe.backgroundpane.*;
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;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -20,8 +15,9 @@ public class BackgroundSpecialPane extends BackgroundPane{
super(); super();
} }
protected void initPaneList(){ @Override
ColorBackgroundPane colorBackgroundPane = new ColorBackgroundPane(); protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {
ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane();
colorBackgroundPane.registerChangeListener(new UIObserverListener() { colorBackgroundPane.registerChangeListener(new UIObserverListener() {
@Override @Override
@ -29,7 +25,7 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
ImageBackgroundPane imageBackgroundPane = new ImageBackgroundPane(); ImageBackgroundQuickPane imageBackgroundPane = new ImageBackgroundQuickPane();
imageBackgroundPane.registerChangeListener(new UIObserverListener() { imageBackgroundPane.registerChangeListener(new UIObserverListener() {
@Override @Override
@ -37,18 +33,18 @@ public class BackgroundSpecialPane extends BackgroundPane{
fireStateChanged(); fireStateChanged();
} }
}); });
GradientPane gradientPane = new GradientPane(); GradientBackgroundQuickPane gradientPane = new GradientBackgroundQuickPane();
gradientPane.registerChangeListener(new UIObserverListener() { gradientPane.registerChangeListener(new UIObserverListener() {
@Override @Override
public void doChange() { public void doChange() {
fireStateChanged(); fireStateChanged();
} }
}); });
paneList = new ArrayList<BackgroundSettingPane>(); return new BackgroundQuickPane[] {
paneList.add(new NullBackgroundPane()); new NullBackgroundQuickPane(),
paneList.add(colorBackgroundPane); colorBackgroundPane,
paneList.add(imageBackgroundPane); imageBackgroundPane,
paneList.add(gradientPane); 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.base.background.GradientBackground;
import com.fr.design.event.UIObserverListener; 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.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.BackgroundSettingPane; import com.fr.design.style.background.gradient.GradientBar;
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.background.gradient.GradientBar;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -20,7 +19,7 @@ import java.awt.*;
* @author zhou * @author zhou
* @since 2012-5-30上午10:36:21 * @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 long serialVersionUID = -6854603990673031897L;
private static final int DEFAULT_GRADIENT_WIDTH = 185; private static final int DEFAULT_GRADIENT_WIDTH = 185;
@ -30,11 +29,11 @@ public class GradientPane extends BackgroundSettingPane {
private GradientBar gradientBar; private GradientBar gradientBar;
private UIButtonGroup<Integer> directionPane; private UIButtonGroup<Integer> directionPane;
public GradientPane() { public GradientBackgroundQuickPane() {
constructPane(); constructPane();
} }
public GradientPane(int gradientBarWidth) { public GradientBackgroundQuickPane(int gradientBarWidth) {
this.gradientBarWidth = gradientBarWidth; this.gradientBarWidth = gradientBarWidth;
constructPane(); 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; 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.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
/** /**
@ -18,6 +18,6 @@ public class ChartBackgroundNoImagePane extends ChartBackgroundPane {
protected void initList() { protected void initList() {
paneList.add(new NullBackgroundQuickPane()); paneList.add(new NullBackgroundQuickPane());
paneList.add(new ColorBackgroundQuickPane()); 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.frpane.UINumberDragPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; 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.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.*;
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.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -92,7 +88,7 @@ public class ChartBackgroundPane extends BasicPane{
paneList.add(new NullBackgroundQuickPane()); paneList.add(new NullBackgroundQuickPane());
paneList.add(new ColorBackgroundQuickPane()); paneList.add(new ColorBackgroundQuickPane());
paneList.add(new ImageBackgroundQuickPane()); paneList.add(new ImageBackgroundQuickPane());
paneList.add(new GradientQuickPane(CHART_GRADIENT_WIDTH)); paneList.add(new GradientBackgroundQuickPane(CHART_GRADIENT_WIDTH));
} }
/** /**

Loading…
Cancel
Save