帆软报表设计器源代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

90 lines
2.9 KiB

package com.fr.design.expand;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.stable.Constants;
import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
/**
*
* @editor zhou
* @since 2012-3-23下午3:21:02
*/
public class ExpandDirectionPane extends JPanel {
private UIRadioButton t2bRadioButton;
private UIRadioButton l2rRadioButton;
private UIRadioButton noneRadioButton;
public ExpandDirectionPane() {
super();
this.initComponents();
}
public void initComponents() {
this.setLayout(new BorderLayout());
t2bRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Top_To_Bottom"));
l2rRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("FIne-Design_Report_Utils_Left_To_Right"));
noneRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ExpandD_Not_Expand"));
ButtonGroup bg = new ButtonGroup();
bg.add(t2bRadioButton);
bg.add(l2rRadioButton);
bg.add(noneRadioButton);
this.add(row(10,
cell(t2bRadioButton), cell(l2rRadioButton), cell(noneRadioButton)
).getComponent());
}
public void populate(CellExpandAttr cellExpandAttr) {
if (cellExpandAttr == null) {
cellExpandAttr = new CellExpandAttr();
}
switch (cellExpandAttr.getDirection()) {
case Constants.TOP_TO_BOTTOM:
t2bRadioButton.setSelected(true);
break;
case Constants.LEFT_TO_RIGHT:
l2rRadioButton.setSelected(true);
break;
default:
noneRadioButton.setSelected(true);
}
}
public void update(CellExpandAttr cellExpandAttr) {
if (cellExpandAttr == null) {
cellExpandAttr = new CellExpandAttr();
}
if (t2bRadioButton.isSelected()) {
cellExpandAttr.setDirection(Constants.TOP_TO_BOTTOM);
} else if (l2rRadioButton.isSelected()) {
cellExpandAttr.setDirection(Constants.LEFT_TO_RIGHT);
} else {
cellExpandAttr.setDirection(Constants.NONE);
}
}
public void setNoneRadioButtonSelected(boolean isSummary) {
if (isSummary) {
this.noneRadioButton.setSelected(true);
this.l2rRadioButton.setEnabled(false);
this.t2bRadioButton.setEnabled(false);
this.noneRadioButton.setEnabled(false);
} else {
this.t2bRadioButton.setEnabled(true);
this.l2rRadioButton.setEnabled(true);
this.noneRadioButton.setEnabled(true);
if (this.noneRadioButton.isSelected()) {
this.t2bRadioButton.setSelected(true);
}
}
}
}