Browse Source

引用错误

master
richie 9 years ago
parent
commit
8c543728f6
  1. 25
      designer_base/src/com/fr/design/gui/style/BackgroundNoImagePane.java
  2. 241
      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
};
} }
} }

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

@ -1,148 +1,145 @@
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
*/ */
public class BackgroundPane extends AbstractBasicStylePane { 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();
} }
protected void initComponents() { protected void initComponents() {
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); this.add(typeComboBox, BorderLayout.NORTH);
initPaneList(); paneList = supportKindsOfBackgroundUI();
final JPanel centerPane = new JPanel(cardlayout) {
@Override final JPanel centerPane = new JPanel(cardlayout) {
public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度 @Override
int index = typeComboBox.getSelectedIndex(); public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度
return new Dimension(super.getPreferredSize().width, paneList.get(index).getPreferredSize().height); int index = typeComboBox.getSelectedIndex();
} 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()); typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow()); centerPane.add(pane, pane.title4PopupWindow());
} }
this.add(centerPane, BorderLayout.CENTER); 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());
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) {
listenerList.add(ChangeListener.class, changeListener); listenerList.add(ChangeListener.class, changeListener);
} }
/** /**
*/ */
protected void fireStateChanged() { protected void fireStateChanged() {
Object[] listeners = listenerList.getListenerList(); Object[] listeners = listenerList.getListenerList();
ChangeEvent e = null; ChangeEvent e = null;
for (int i = listeners.length - 2; i >= 0; i -= 2) { for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) { if (listeners[i] == ChangeListener.class) {
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() {
return Inter.getLocText("FR-Utils_Background");
}
/**
* Populate background.
*/
public void populateBean(Background background) {
for (int i = 0; i < paneList.length; i++) {
BackgroundQuickPane pane = paneList[i];
if (pane.accept(background)) {
pane.populateBean(background);
typeComboBox.setSelectedIndex(i);
return;
}
}
}
/**
* Update background.
*/ */
public String title4PopupWindow() { public Background update() {
return Inter.getLocText("FR-Utils_Background"); return paneList[typeComboBox.getSelectedIndex()].updateBean();
} }
/** @Override
* Populate background. public void populateBean(Style style) {
*/ this.populateBean(style.getBackground());
public void populateBean(Background background) { }
for (int i = 0; i < paneList.size(); i++) {
BackgroundSettingPane pane = paneList.get(i); @Override
if (pane.accept(background)) { public Style update(Style style) {
pane.populateBean(background); return style.deriveBackground(this.update());
typeComboBox.setSelectedIndex(i); }
return;
}
}
}
/**
* Update background.
*/
public Background update() {
return paneList.get(typeComboBox.getSelectedIndex()).updateBean();
}
@Override
public void populateBean(Style style) {
this.populateBean(style.getBackground());
}
@Override
public Style update(Style style) {
return style.deriveBackground(this.update());
}
} }

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