|
|
@ -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()); |
|
|
|
} |
|
|
|
} |
|
|
@ -72,18 +60,26 @@ public class BackgroundPane extends AbstractBasicStylePane { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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) { |
|
|
@ -108,6 +104,7 @@ public class BackgroundPane extends AbstractBasicStylePane { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 名称 |
|
|
|
* 名称 |
|
|
|
|
|
|
|
* |
|
|
|
* @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 |
|
|
|