forked from fanruan/design
Browse Source
* commit '17ae107b7681415f11b24308d3f5676154adf88f': REPORT-3348 修改后触发保存 REPORT-3348 重构,不然不能保存 REPORT-3348 复用添加数据列对话框代码,保留原始对话框布局 REPORT-3348 数据列高级设置内部组件调整 REPORT-3348 单元格元素数据列高级设置master
12 changed files with 1412 additions and 799 deletions
@ -1,36 +1,33 @@ |
|||||||
package com.fr.design.actions.columnrow; |
package com.fr.design.actions.columnrow; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.design.data.DesignTableDataManager; |
|
||||||
import com.fr.design.actions.cell.AbstractCellElementAction; |
import com.fr.design.actions.cell.AbstractCellElementAction; |
||||||
import com.fr.design.dscolumn.DSColumnConditionsPane; |
import com.fr.design.data.DesignTableDataManager; |
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.general.Inter; |
import com.fr.design.dscolumn.DSColumnConditionsPane; |
||||||
import com.fr.design.mainframe.ElementCasePane; |
import com.fr.design.mainframe.ElementCasePane; |
||||||
|
import com.fr.general.Inter; |
||||||
import com.fr.report.cell.TemplateCellElement; |
import com.fr.report.cell.TemplateCellElement; |
||||||
|
|
||||||
public class DSColumnConditionAction extends AbstractCellElementAction { |
public class DSColumnConditionAction extends AbstractCellElementAction { |
||||||
|
|
||||||
private boolean returnValue = false; |
|
||||||
private TemplateCellElement editCellElement; |
|
||||||
|
|
||||||
public DSColumnConditionAction(ElementCasePane t) { |
public DSColumnConditionAction(ElementCasePane t) { |
||||||
super(t); |
super(t); |
||||||
|
|
||||||
this.setName(Inter.getLocText("Filter")); |
this.setName(Inter.getLocText("Filter")); |
||||||
this.setMnemonic('E'); |
this.setMnemonic('E'); |
||||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||||
DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane(); |
DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane(); |
||||||
dSColumnConditionsPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement); |
dSColumnConditionsPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement); |
||||||
return dSColumnConditionsPane; |
return dSColumnConditionsPane; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
||||||
((DSColumnConditionsPane) bp).update(cellElement); |
((DSColumnConditionsPane) bp).update(cellElement); |
||||||
} |
} |
||||||
} |
} |
@ -1,38 +0,0 @@ |
|||||||
package com.fr.design.dscolumn; |
|
||||||
|
|
||||||
import com.fr.design.mainframe.cell.CellEditorPane; |
|
||||||
import com.fr.report.cell.TemplateCellElement; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 单元格元素 数据列 基本设置内容面板 |
|
||||||
* |
|
||||||
* @author yaoh.wu |
|
||||||
* @version 2017年7月25日 |
|
||||||
* @since 9.0 |
|
||||||
*/ |
|
||||||
public class DSColumnAdvancedEditorPane extends CellEditorPane { |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public String getIconPath() { |
|
||||||
return "Advanced"; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return "Advanced"; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void update() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(TemplateCellElement cellElement) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,84 +0,0 @@ |
|||||||
package com.fr.design.dscolumn; |
|
||||||
|
|
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.design.mainframe.cell.CellEditorPane; |
|
||||||
import com.fr.report.cell.TemplateCellElement; |
|
||||||
|
|
||||||
import javax.swing.*; |
|
||||||
import java.awt.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* 单元格元素 数据列 高级设置内容面板 |
|
||||||
* |
|
||||||
* @author yaoh.wu |
|
||||||
* @version 2017年7月25日 |
|
||||||
* @since 9.0 |
|
||||||
*/ |
|
||||||
public class DSColumnBasicEditorPane extends CellEditorPane { |
|
||||||
|
|
||||||
//数据集和数据列
|
|
||||||
private SelectedDataColumnPane dataPane; |
|
||||||
//数据分组设置
|
|
||||||
private ResultSetGroupDockingPane groupPane; |
|
||||||
//当前编辑的单元格
|
|
||||||
private TemplateCellElement cellElement; |
|
||||||
//条件过滤按钮面板
|
|
||||||
private JPanel conditionPane; |
|
||||||
|
|
||||||
public DSColumnBasicEditorPane(TemplateCellElement cellElement, SelectedDataColumnPane dataPane, ResultSetGroupDockingPane groupPane, JPanel conditionPane) { |
|
||||||
this.setLayout(new BorderLayout()); |
|
||||||
this.cellElement = cellElement; |
|
||||||
this.dataPane = dataPane; |
|
||||||
this.groupPane = groupPane; |
|
||||||
this.conditionPane = conditionPane; |
|
||||||
this.add(this.createContentPane(), BorderLayout.CENTER); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public String getIconPath() { |
|
||||||
return "Basic"; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String title4PopupWindow() { |
|
||||||
return "Basic"; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void update() { |
|
||||||
dataPane.update(this.cellElement); |
|
||||||
groupPane.update(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(TemplateCellElement cellElement) { |
|
||||||
this.cellElement = cellElement; |
|
||||||
dataPane.populate(null, cellElement); |
|
||||||
groupPane.populate(cellElement); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 创建有内容的面板显示信息 |
|
||||||
* |
|
||||||
* @return content JPanel |
|
||||||
*/ |
|
||||||
private JPanel createContentPane() { |
|
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double f = TableLayout.FILL; |
|
||||||
double[] columnSize = {f}; |
|
||||||
double[] rowSize = {p, p, p}; |
|
||||||
Component[][] components = new Component[][]{ |
|
||||||
//数据集列选择
|
|
||||||
new Component[]{this.dataPane}, |
|
||||||
//数据分组设置
|
|
||||||
new Component[]{this.groupPane}, |
|
||||||
//条件过滤
|
|
||||||
new Component[]{this.conditionPane} |
|
||||||
}; |
|
||||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
||||||
} |
|
||||||
} |
|
@ -1,45 +1,45 @@ |
|||||||
package com.fr.design.dscolumn; |
package com.fr.design.dscolumn; |
||||||
|
|
||||||
import java.awt.Dimension; |
|
||||||
import java.awt.event.ItemEvent; |
|
||||||
import java.awt.event.ItemListener; |
|
||||||
import java.util.Iterator; |
|
||||||
|
|
||||||
import com.fr.data.TableDataSource; |
import com.fr.data.TableDataSource; |
||||||
import com.fr.design.data.datapane.TableDataComboBox; |
import com.fr.design.data.datapane.TableDataComboBox; |
||||||
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
||||||
import com.fr.main.impl.WorkBook; |
import com.fr.main.impl.WorkBook; |
||||||
import com.fr.report.cell.TemplateCellElement; |
import com.fr.report.cell.TemplateCellElement; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ItemEvent; |
||||||
|
import java.awt.event.ItemListener; |
||||||
|
import java.util.Iterator; |
||||||
|
|
||||||
public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { |
public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { |
||||||
|
|
||||||
public SelectedConfirmedDataColumnPane () { |
public SelectedConfirmedDataColumnPane() { |
||||||
super(false); |
super(false); |
||||||
} |
} |
||||||
|
|
||||||
protected void initTableNameComboBox() { |
protected void initTableNameComboBox() { |
||||||
tableNameComboBox = new TableDataComboBox(new WorkBook()); |
tableNameComboBox = new TableDataComboBox(new WorkBook()); |
||||||
tableNameComboBox.addItemListener(new ItemListener() { |
tableNameComboBox.addItemListener(new ItemListener() { |
||||||
@Override |
@Override |
||||||
public void itemStateChanged(ItemEvent e) { |
public void itemStateChanged(ItemEvent e) { |
||||||
columnNameComboBox.setLoaded(false); |
columnNameComboBox.setLoaded(false); |
||||||
} |
} |
||||||
}); |
}); |
||||||
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); |
tableNameComboBox.setPreferredSize(new Dimension(100, 20)); |
||||||
} |
} |
||||||
|
|
||||||
public void populate(TableDataSource source, TemplateCellElement cell) { |
public void populate(TableDataSource source, TemplateCellElement cell) { |
||||||
tableNameComboBox.refresh(source); |
tableNameComboBox.refresh(source); |
||||||
tableNameComboBox.setEditable(false); |
tableNameComboBox.setEditable(false); |
||||||
tableNameComboBox.setEnabled(false); |
tableNameComboBox.setEnabled(false); |
||||||
super.populate(source, cell); |
super.populate(source, cell); |
||||||
try { |
try { |
||||||
Iterator it = source.getTableDataNameIterator(); |
Iterator it = source.getTableDataNameIterator(); |
||||||
String name = (String)it.next(); |
String name = (String) it.next(); |
||||||
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); |
TemplateTableDataWrapper wrapper = new TemplateTableDataWrapper(source.getTableData(name), name); |
||||||
tableNameComboBox.setSelectedItem(wrapper); |
tableNameComboBox.setSelectedItem(wrapper); |
||||||
tableNameComboBox.getModel().setSelectedItem(wrapper); |
tableNameComboBox.getModel().setSelectedItem(wrapper); |
||||||
} catch (Exception e) { |
} catch (Exception e) { |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
@ -1,456 +1,486 @@ |
|||||||
package com.fr.design.layout; |
package com.fr.design.layout; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import com.fr.design.border.UITitledBorder; |
||||||
import java.awt.CardLayout; |
|
||||||
import java.awt.Color; |
|
||||||
import java.awt.FlowLayout; |
|
||||||
import java.awt.LayoutManager; |
|
||||||
|
|
||||||
import javax.swing.BorderFactory; |
|
||||||
import javax.swing.BoxLayout; |
|
||||||
import javax.swing.Icon; |
|
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import javax.swing.JPanel; |
|
||||||
import javax.swing.JRadioButton; |
|
||||||
|
|
||||||
import com.fr.design.border.UITitledBorder; |
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
public class FRGUIPaneFactory { |
public class FRGUIPaneFactory { |
||||||
private FRGUIPaneFactory() { |
public static final float WIDTH_PARA_F = 80.0f; |
||||||
} |
public static final int WIDTH_OFFSET_N = 60; |
||||||
|
public static final int WIDTH_OFFSET_M = 20; |
||||||
|
public static final int WIDTH_PARA_INT = 80; |
||||||
|
public static final float WIDTHABS_PARA_F = 2.0f; |
||||||
|
public static final int HEIGHT_PARA = 25; |
||||||
|
public static final int HEIGHT_OFFSET = 50; |
||||||
|
|
||||||
public static final float WIDTH_PARA_F = 80.0f; |
private FRGUIPaneFactory() { |
||||||
public static final int WIDTH_OFFSET_N = 60; |
} |
||||||
public static final int WIDTH_OFFSET_M = 20; |
|
||||||
public static final int WIDTH_PARA_INT = 80; |
|
||||||
public static final float WIDTHABS_PARA_F = 2.0f; |
|
||||||
public static final int HEIGHT_PARA = 25; |
|
||||||
public static final int HEIGHT_OFFSET = 50; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠右靠左的水平间隙为2的流式布局 |
* 创建一个靠右靠左的水平间隙为2的流式布局 |
||||||
|
* |
||||||
* @return FlowLayout对象 |
* @return FlowLayout对象 |
||||||
*/ |
*/ |
||||||
public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多
|
public static LayoutManager createBoxFlowLayout() { // createBoxFlowLayout 图表用到的比较多
|
||||||
return new FlowLayout(FlowLayout.LEFT, 2, 0); |
return new FlowLayout(FlowLayout.LEFT, 2, 0); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠左的布局 |
* 创建一个靠左的布局 |
||||||
* @return FlowLayout对象 |
* |
||||||
*/ |
* @return FlowLayout对象 |
||||||
public static LayoutManager createLeftZeroLayout() { |
*/ |
||||||
return new FlowLayout(FlowLayout.LEFT, 0, 0); |
public static LayoutManager createLeftZeroLayout() { |
||||||
} |
return new FlowLayout(FlowLayout.LEFT, 0, 0); |
||||||
|
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠左的水平和垂直间隙均为5的流式布局 |
* 创建一个靠左的水平和垂直间隙均为5的流式布局 |
||||||
|
* |
||||||
|
* @return FlowLayout对象 |
||||||
|
*/ |
||||||
|
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout
|
||||||
|
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个靠左流式布局,间距10,10 |
||||||
|
* |
||||||
|
* @return FlowLayout对象 |
||||||
|
*/ |
||||||
|
public static LayoutManager createL_FlowLayout() { |
||||||
|
return new FlowLayout(FlowLayout.LEFT, 10, 10); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个居中流式布局 |
||||||
|
* |
||||||
* @return FlowLayout对象 |
* @return FlowLayout对象 |
||||||
*/ |
*/ |
||||||
public static LayoutManager createLabelFlowLayout() { // createLabelFlowLayout
|
public static LayoutManager createCenterFlowLayout() { |
||||||
return new FlowLayout(FlowLayout.LEFT); // 默认 5, 5
|
return new FlowLayout(FlowLayout.CENTER); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个靠左流式布局,间距10,10 |
* 创建一个靠右流式布局 |
||||||
* @return FlowLayout对象 |
* |
||||||
*/ |
* @return FlowLayout对象 |
||||||
public static LayoutManager createL_FlowLayout() { |
*/ |
||||||
return new FlowLayout(FlowLayout.LEFT, 10, 10); |
public static LayoutManager createRightFlowLayout() { |
||||||
} |
return new FlowLayout(FlowLayout.RIGHT); |
||||||
|
} |
||||||
/** |
|
||||||
* 创建一个居中流式布局 |
/** |
||||||
* @return FlowLayout对象 |
* 创建一个边框布局 |
||||||
*/ |
* |
||||||
public static LayoutManager createCenterFlowLayout() { |
* @return BorderLayout对象 |
||||||
return new FlowLayout(FlowLayout.CENTER); |
*/ |
||||||
} |
public static LayoutManager createBorderLayout() { |
||||||
|
return new BorderLayout(); |
||||||
/** |
} |
||||||
* 创建一个靠右流式布局 |
|
||||||
* @return FlowLayout对象 |
/** |
||||||
*/ |
* 创建一个边框布局,间距4,4 |
||||||
public static LayoutManager createRightFlowLayout() { |
* |
||||||
return new FlowLayout(FlowLayout.RIGHT); |
* @return BorderLayout对象 |
||||||
} |
*/ |
||||||
|
public static LayoutManager createM_BorderLayout() { |
||||||
/** |
return new BorderLayout(4, 4); |
||||||
* 创建一个边框布局 |
} |
||||||
* @return BorderLayout对象 |
|
||||||
*/ |
|
||||||
public static LayoutManager createBorderLayout() { |
/** |
||||||
return new BorderLayout(); |
* 创建一个1列的网格布局 |
||||||
} |
* |
||||||
|
* @return FRGridLayout对象 |
||||||
/** |
*/ |
||||||
* 创建一个边框布局,间距4,4 |
public static LayoutManager create1ColumnGridLayout() { |
||||||
* @return BorderLayout对象 |
return new FRGridLayout(1); |
||||||
*/ |
} |
||||||
public static LayoutManager createM_BorderLayout() { |
|
||||||
return new BorderLayout(4,4); |
/** |
||||||
} |
* 创建一个2列的网格布局 |
||||||
|
* |
||||||
// TODO 删掉
|
* @return FRGridLayout对象 |
||||||
|
*/ |
||||||
/** |
public static LayoutManager create2ColumnGridLayout() { |
||||||
* 创建一个1列的网格布局 |
return new FRGridLayout(2); |
||||||
* @return FRGridLayout对象 |
} |
||||||
*/ |
|
||||||
public static LayoutManager create1ColumnGridLayout() { |
/** |
||||||
return new FRGridLayout(1); |
* 创建一个n列的网格布局 |
||||||
} |
* |
||||||
|
* @param nColumn 列数 |
||||||
/** |
* @return FRGridLayout对象 |
||||||
* 创建一个2列的网格布局 |
*/ |
||||||
* @return FRGridLayout对象 |
public static LayoutManager createNColumnGridLayout(int nColumn) { |
||||||
*/ |
return new FRGridLayout(nColumn); |
||||||
public static LayoutManager create2ColumnGridLayout() { |
} |
||||||
return new FRGridLayout(2); |
|
||||||
} |
/** |
||||||
|
* 创建一个带标题边框面板 |
||||||
/** |
* |
||||||
* 创建一个n列的网格布局 |
* @param string 边框标题 |
||||||
* @param nColumn 列数 |
* @return JPanel对象 |
||||||
* @return FRGridLayout对象 |
*/ |
||||||
*/ |
public static JPanel createTitledBorderPane(String string) { |
||||||
public static LayoutManager createNColumnGridLayout(int nColumn) { |
JPanel jp = new JPanel(); |
||||||
return new FRGridLayout(nColumn); |
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); |
||||||
} |
jp.setBorder(explainBorder); |
||||||
|
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
/** |
return jp; |
||||||
* 创建一个带标题边框面板 |
} |
||||||
* @param string 边框标题 |
|
||||||
* @return JPanel对象 |
/** |
||||||
*/ |
* 创建一个带标题边框面板并且居中显示 |
||||||
public static JPanel createTitledBorderPane(String string) { |
* |
||||||
JPanel jp = new JPanel(); |
* @param borderTitle 边框标题 |
||||||
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(string); |
* @return JPanel对象 |
||||||
jp.setBorder(explainBorder); |
*/ |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
public static JPanel createTitledBorderPaneCenter(String borderTitle) { |
||||||
return jp; |
JPanel jp = new JPanel(); |
||||||
} |
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle); |
||||||
|
jp.setBorder(explainBorder); |
||||||
/** |
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); |
||||||
* 创建一个带标题边框面板并且居中显示 |
return jp; |
||||||
* @param borderTitle 边框标题 |
} |
||||||
* @return JPanel对象 |
|
||||||
*/ |
/** |
||||||
public static JPanel createTitledBorderPaneCenter(String borderTitle) { |
* 创建一个靠左空边框布局,间隔大 |
||||||
JPanel jp = new JPanel(); |
* |
||||||
UITitledBorder explainBorder = UITitledBorder.createBorderWithTitle(borderTitle); |
* @return JPanel对象 |
||||||
jp.setBorder(explainBorder); |
*/ |
||||||
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); |
public static JPanel createBigHGapFlowInnerContainer_M_Pane() { |
||||||
return jp; |
JPanel jp = new JPanel(); |
||||||
} |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
|
jp.setLayout(new FRLeftFlowLayout(5, 60, 5)); |
||||||
/** |
return jp; |
||||||
* 创建一个靠左空边框布局,间隔大 |
} |
||||||
* @return JPanel对象 |
|
||||||
*/ |
/** |
||||||
public static JPanel createBigHGapFlowInnerContainer_M_Pane() { |
* 创建一个靠左空边框面板,间隔中等 |
||||||
JPanel jp = new JPanel(); |
* |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
* @return JPanel对象 |
||||||
jp.setLayout(new FRLeftFlowLayout(5, 60, 5)); |
*/ |
||||||
return jp; |
public static JPanel createMediumHGapFlowInnerContainer_M_Pane() { |
||||||
} |
JPanel jp = new JPanel(); |
||||||
|
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
/** |
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); |
||||||
* 创建一个靠左空边框面板,间隔中等 |
return jp; |
||||||
* @return JPanel对象 |
} |
||||||
*/ |
|
||||||
public static JPanel createMediumHGapFlowInnerContainer_M_Pane() { |
/** |
||||||
JPanel jp = new JPanel(); |
* 创建一个靠左空边框面板,间隔中等 |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
* |
||||||
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); |
* @return JPanel对象 |
||||||
return jp; |
*/ |
||||||
} |
public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() { |
||||||
|
JPanel jp = new JPanel(); |
||||||
/** |
jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0)); |
||||||
* 创建一个靠左空边框面板,间隔中等 |
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); |
||||||
* @return JPanel对象 |
return jp; |
||||||
*/ |
} |
||||||
public static JPanel createMediumHGapHighTopFlowInnerContainer_M_Pane() { |
|
||||||
JPanel jp = new JPanel(); |
/** |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(50, 5, 0, 0)); |
* 创建一个正常靠左空边框面板 |
||||||
jp.setLayout(new FRLeftFlowLayout(5, 20, 5)); |
* |
||||||
return jp; |
* @return JPanel对象 |
||||||
} |
*/ |
||||||
|
public static JPanel createNormalFlowInnerContainer_M_Pane() { |
||||||
/** |
JPanel jp = new JPanel(); |
||||||
* 创建一个正常靠左空边框面板 |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
* @return JPanel对象 |
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
*/ |
return jp; |
||||||
public static JPanel createNormalFlowInnerContainer_M_Pane() { |
} |
||||||
JPanel jp = new JPanel(); |
|
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
/** |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
* 创建一个靠左0间距边框面板 |
||||||
return jp; |
* |
||||||
} |
* @return JPanel对象 |
||||||
|
*/ |
||||||
/** |
public static JPanel createLeftFlowZeroGapBorderPane() { |
||||||
* 创建一个靠左0间距边框面板 |
JPanel jp = new JPanel(); |
||||||
* @return JPanel对象 |
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
*/ |
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
||||||
public static JPanel createLeftFlowZeroGapBorderPane() { |
return jp; |
||||||
JPanel jp = new JPanel(); |
} |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
/** |
||||||
return jp; |
* 创建一个靠左流式布局,正常流式内嵌 |
||||||
} |
* |
||||||
|
* @return JPanel对象 |
||||||
/** |
*/ |
||||||
* 创建一个靠左流式布局,正常流式内嵌 |
public static JPanel createNormalFlowInnerContainer_S_Pane() { |
||||||
* @return JPanel对象 |
JPanel jp = new JPanel(); |
||||||
*/ |
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
public static JPanel createNormalFlowInnerContainer_S_Pane() { |
return jp; |
||||||
JPanel jp = new JPanel(); |
} |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT)); |
|
||||||
return jp; |
/** |
||||||
} |
* 创建一个靠左流式布局,流式内嵌 |
||||||
|
* |
||||||
/** |
* @return JPanel对象 |
||||||
* 创建一个靠左流式布局,流式内嵌 |
*/ |
||||||
* @return JPanel对象 |
public static JPanel createBoxFlowInnerContainer_S_Pane() { |
||||||
*/ |
JPanel jp = new JPanel(); |
||||||
public static JPanel createBoxFlowInnerContainer_S_Pane() { |
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); |
||||||
JPanel jp = new JPanel(); |
return jp; |
||||||
jp.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); |
} |
||||||
return jp; |
|
||||||
} |
/** |
||||||
|
* 创建一个靠右面板 |
||||||
/** |
* |
||||||
* 创建一个靠右面板 |
* @return JPanel对象 |
||||||
* @return JPanel对象 |
*/ |
||||||
*/ |
public static JPanel createRightFlowInnerContainer_S_Pane() { |
||||||
public static JPanel createRightFlowInnerContainer_S_Pane() { |
JPanel jp = new JPanel(); |
||||||
JPanel jp = new JPanel(); |
jp.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
||||||
jp.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
return jp; |
||||||
return jp; |
} |
||||||
} |
|
||||||
|
/** |
||||||
/** |
* 创建一个居中面板 |
||||||
* 创建一个居中面板 |
* |
||||||
* @return JPanel对象 |
* @return JPanel对象 |
||||||
*/ |
*/ |
||||||
public static JPanel createCenterFlowInnerContainer_S_Pane() { |
public static JPanel createCenterFlowInnerContainer_S_Pane() { |
||||||
JPanel jp = new JPanel(); |
JPanel jp = new JPanel(); |
||||||
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); |
jp.setLayout(new FlowLayout(FlowLayout.CENTER)); |
||||||
return jp; |
return jp; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建一个居中0间距面板 |
* 创建一个居中0间距面板 |
||||||
* @return JPanel对象 |
* |
||||||
*/ |
* @return JPanel对象 |
||||||
public static JPanel createCenterFlowZeroGapBorderPane() { |
*/ |
||||||
JPanel jp = new JPanel(); |
public static JPanel createCenterFlowZeroGapBorderPane() { |
||||||
jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); |
JPanel jp = new JPanel(); |
||||||
jp.setBorder(BorderFactory.createEmptyBorder()); |
jp.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); |
||||||
return jp; |
jp.setBorder(BorderFactory.createEmptyBorder()); |
||||||
} |
return jp; |
||||||
|
} |
||||||
/** |
|
||||||
* 创建纵向排列面板 |
/** |
||||||
* @return JPanel对象 |
* 创建纵向排列面板 |
||||||
*/ |
* |
||||||
public static JPanel createY_AXISBoxInnerContainer_L_Pane() { |
* @return JPanel对象 |
||||||
JPanel jp = new JPanel(); |
*/ |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
public static JPanel createY_AXISBoxInnerContainer_L_Pane() { |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
JPanel jp = new JPanel(); |
||||||
return jp; |
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
} |
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||||
|
return jp; |
||||||
/** |
} |
||||||
* 创建纵向边框面板 |
|
||||||
* @return JPanel对象 |
/** |
||||||
*/ |
* 创建纵向边框面板 |
||||||
public static JPanel createYBoxEmptyBorderPane() { |
* |
||||||
JPanel jp = new JPanel(); |
* @return JPanel对象 |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
*/ |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
public static JPanel createYBoxEmptyBorderPane() { |
||||||
return jp; |
JPanel jp = new JPanel(); |
||||||
} |
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||||
|
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||||
/** |
return jp; |
||||||
* 创建横向面板 |
} |
||||||
* @return JPanel对象 |
|
||||||
*/ |
/** |
||||||
public static JPanel createX_AXISBoxInnerContainer_L_Pane() { |
* 创建横向面板 |
||||||
JPanel jp = new JPanel(); |
* |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
* @return JPanel对象 |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
*/ |
||||||
return jp; |
public static JPanel createX_AXISBoxInnerContainer_L_Pane() { |
||||||
} |
JPanel jp = new JPanel(); |
||||||
|
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
/** |
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
||||||
* 创建纵向面板M |
return jp; |
||||||
* @return JPanel对象 |
} |
||||||
*/ |
|
||||||
public static JPanel createY_AXISBoxInnerContainer_M_Pane() { |
/** |
||||||
JPanel jp = new JPanel(); |
* 创建纵向面板M |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
* |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
* @return JPanel对象 |
||||||
return jp; |
*/ |
||||||
} |
public static JPanel createY_AXISBoxInnerContainer_M_Pane() { |
||||||
|
JPanel jp = new JPanel(); |
||||||
/** |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
* 创建横向内置boxlayout的面板 |
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||||
* @return JPanel对象 |
return jp; |
||||||
*/ |
} |
||||||
public static JPanel createX_AXISBoxInnerContainer_M_Pane() { |
|
||||||
JPanel jp = new JPanel(); |
/** |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
* 创建横向内置boxlayout的面板 |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
* |
||||||
return jp; |
* @return JPanel对象 |
||||||
} |
*/ |
||||||
|
public static JPanel createX_AXISBoxInnerContainer_M_Pane() { |
||||||
/** |
JPanel jp = new JPanel(); |
||||||
* 创建纵向内置boxlayout的面板 |
jp.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||||
* @return JPanel对象 |
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
||||||
*/ |
return jp; |
||||||
public static JPanel createY_AXISBoxInnerContainer_S_Pane() { |
} |
||||||
JPanel jp = new JPanel(); |
|
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
/** |
||||||
return jp; |
* 创建纵向内置boxlayout的面板 |
||||||
} |
* |
||||||
|
* @return JPanel对象 |
||||||
/** |
*/ |
||||||
* 创建横向内置boxlayout的面板 |
public static JPanel createY_AXISBoxInnerContainer_S_Pane() { |
||||||
* @return JPanel对象 |
JPanel jp = new JPanel(); |
||||||
*/ |
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); |
||||||
public static JPanel createX_AXISBoxInnerContainer_S_Pane() { |
return jp; |
||||||
JPanel jp = new JPanel(); |
} |
||||||
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
|
||||||
return jp; |
/** |
||||||
} |
* 创建横向内置boxlayout的面板 |
||||||
|
* |
||||||
/** |
* @return JPanel对象 |
||||||
* 创建n列网格面板 |
*/ |
||||||
* @param nColumn 列数 |
public static JPanel createX_AXISBoxInnerContainer_S_Pane() { |
||||||
* @return JPanel对象 |
JPanel jp = new JPanel(); |
||||||
*/ |
jp.setLayout(new BoxLayout(jp, BoxLayout.X_AXIS)); |
||||||
public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) { |
return jp; |
||||||
JPanel jp = new JPanel(); |
} |
||||||
jp.setLayout(new FRGridLayout(nColumn)); |
|
||||||
return jp; |
/** |
||||||
} |
* 创建n列网格面板 |
||||||
|
* |
||||||
/** |
* @param nColumn 列数 |
||||||
* 创建n列网格面板 |
* @return JPanel对象 |
||||||
* @param nColumn 列数 |
*/ |
||||||
* @param h 水平间距 |
public static JPanel createNColumnGridInnerContainer_S_Pane(int nColumn) { |
||||||
* @param v 垂直间距 |
JPanel jp = new JPanel(); |
||||||
* @return JPanel对象 |
jp.setLayout(new FRGridLayout(nColumn)); |
||||||
*/ |
return jp; |
||||||
public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) { |
} |
||||||
JPanel jp = new JPanel(); |
|
||||||
jp.setLayout(new FRGridLayout(nColumn, h, v)); |
/** |
||||||
return jp; |
* 创建n列网格面板 |
||||||
} |
* |
||||||
|
* @param nColumn 列数 |
||||||
/** |
* @param h 水平间距 |
||||||
* 创建顶格n列网格面板 |
* @param v 垂直间距 |
||||||
* @param nColumn 列数 |
* @return JPanel对象 |
||||||
* @return JPanel对象 |
*/ |
||||||
*/ |
public static JPanel createNColumnGridInnerContainer_Pane(int nColumn, int h, int v) { |
||||||
public static JPanel createFillColumnPane(int nColumn) { |
JPanel jp = new JPanel(); |
||||||
JPanel jp = new JPanel(); |
jp.setLayout(new FRGridLayout(nColumn, h, v)); |
||||||
jp.setLayout(new FRGridLayout(nColumn, 0, 0)); |
return jp; |
||||||
return jp; |
} |
||||||
} |
|
||||||
|
/** |
||||||
/** |
* 创建顶格n列网格面板 |
||||||
* 创建边框面板L |
* |
||||||
* @return JPanel对象 |
* @param nColumn 列数 |
||||||
*/ |
* @return JPanel对象 |
||||||
public static JPanel createBorderLayout_L_Pane() { |
*/ |
||||||
JPanel jp = new JPanel(); |
public static JPanel createFillColumnPane(int nColumn) { |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
JPanel jp = new JPanel(); |
||||||
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); |
jp.setLayout(new FRGridLayout(nColumn, 0, 0)); |
||||||
return jp; |
return jp; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 创建边框面板M |
* 创建边框面板L |
||||||
* @return JPanel对象 |
* |
||||||
*/ |
* @return JPanel对象 |
||||||
public static JPanel createBorderLayout_M_Pane() { |
*/ |
||||||
JPanel jp = new JPanel(); |
public static JPanel createBorderLayout_L_Pane() { |
||||||
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
JPanel jp = new JPanel(); |
||||||
jp.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
return jp; |
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
} |
return jp; |
||||||
|
} |
||||||
/** |
|
||||||
* 创建边框面板S |
/** |
||||||
* @return JPanel对象 |
* 创建边框面板M |
||||||
*/ |
* |
||||||
public static JPanel createBorderLayout_S_Pane() { |
* @return JPanel对象 |
||||||
JPanel jp = new JPanel(); |
*/ |
||||||
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); |
public static JPanel createBorderLayout_M_Pane() { |
||||||
return jp; |
JPanel jp = new JPanel(); |
||||||
} |
jp.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||||
|
jp.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
||||||
/** |
return jp; |
||||||
* 创建卡片式布局 |
} |
||||||
* @return JPanel对象 |
|
||||||
*/ |
/** |
||||||
public static JPanel createCardLayout_S_Pane() { |
* 创建边框面板S |
||||||
JPanel jp = new JPanel(); |
* |
||||||
jp.setLayout(new CardLayout()); |
* @return JPanel对象 |
||||||
return jp; |
*/ |
||||||
} |
public static JPanel createBorderLayout_S_Pane() { |
||||||
|
JPanel jp = new JPanel(); |
||||||
/** |
jp.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
* 创建图标IconRadio面板 |
return jp; |
||||||
* @param icon 图标 |
} |
||||||
* @param jradiobtn 按钮 |
|
||||||
* @return JPanel对象 |
/** |
||||||
*/ |
* 创建卡片式布局 |
||||||
public static JPanel createIconRadio_S_Pane(Icon icon, |
* |
||||||
JRadioButton jradiobtn) { |
* @return JPanel对象 |
||||||
jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); |
*/ |
||||||
jradiobtn.setBackground(new Color(255, 255, 255)); |
public static JPanel createCardLayout_S_Pane() { |
||||||
JPanel iconRadioPane = new JPanel(); |
JPanel jp = new JPanel(); |
||||||
iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS)); |
jp.setLayout(new CardLayout()); |
||||||
|
return jp; |
||||||
iconRadioPane.add(new UILabel(icon)); |
} |
||||||
iconRadioPane.add(jradiobtn); |
|
||||||
|
/** |
||||||
return iconRadioPane; |
* 创建图标IconRadio面板 |
||||||
} |
* |
||||||
|
* @param icon 图标 |
||||||
/** |
* @param jradiobtn 按钮 |
||||||
* 计算宽度 |
* @return JPanel对象 |
||||||
* @param width 宽度输入值 |
*/ |
||||||
* @return w 宽度输出值 |
public static JPanel createIconRadio_S_Pane(Icon icon, |
||||||
*/ |
JRadioButton jradiobtn) { |
||||||
public static int caculateWidth(int width) { |
jradiobtn.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); |
||||||
int w = 0; |
jradiobtn.setBackground(new Color(255, 255, 255)); |
||||||
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; |
JPanel iconRadioPane = new JPanel(); |
||||||
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; |
iconRadioPane.setLayout(new BoxLayout(iconRadioPane, BoxLayout.X_AXIS)); |
||||||
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); |
|
||||||
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); |
iconRadioPane.add(new UILabel(icon)); |
||||||
float x = i > j ? i : j; |
iconRadioPane.add(jradiobtn); |
||||||
if (x == i) { |
|
||||||
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; |
return iconRadioPane; |
||||||
} else if (x == j) { |
} |
||||||
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N; |
|
||||||
} |
/** |
||||||
return w; |
* 计算宽度 |
||||||
} |
* |
||||||
|
* @param width 宽度输入值 |
||||||
/** |
* @return w 宽度输出值 |
||||||
* 计算高度 |
*/ |
||||||
* @param height 高度输入值 |
public static int caculateWidth(int width) { |
||||||
* @return 高度输出值 |
int w = 0; |
||||||
*/ |
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F; |
||||||
public static int caculateHeight(int height) { |
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F; |
||||||
int h = 0; |
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m); |
||||||
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; |
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n); |
||||||
h = ((int) x + 1) * HEIGHT_PARA; |
float x = i > j ? i : j; |
||||||
return h; |
if (x == i) { |
||||||
} |
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M; |
||||||
|
} else if (x == j) { |
||||||
|
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N; |
||||||
|
} |
||||||
|
return w; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算高度 |
||||||
|
* |
||||||
|
* @param height 高度输入值 |
||||||
|
* @return 高度输出值 |
||||||
|
*/ |
||||||
|
public static int caculateHeight(int height) { |
||||||
|
int h = 0; |
||||||
|
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA; |
||||||
|
h = ((int) x + 1) * HEIGHT_PARA; |
||||||
|
return h; |
||||||
|
} |
||||||
|
|
||||||
} |
} |
Loading…
Reference in new issue