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.
85 lines
2.6 KiB
85 lines
2.6 KiB
package com.fr.design.present.dict; |
|
|
|
import com.fine.swing.ui.layout.Layouts; |
|
import com.fr.data.Dictionary; |
|
import com.fr.data.impl.DynamicSQLDict; |
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
import com.fr.design.constants.LayoutConstants; |
|
import com.fr.design.data.DataCreatorUI; |
|
import com.fr.design.data.tabledata.Prepare4DataSourceChange; |
|
import com.fr.design.gui.frpane.UIComboBoxPane; |
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
|
import javax.swing.*; |
|
import java.awt.*; |
|
import java.util.ArrayList; |
|
import java.util.List; |
|
|
|
import static com.fine.swing.ui.layout.Layouts.cell; |
|
import static com.fine.swing.ui.layout.Layouts.row; |
|
|
|
/** |
|
* @author zhou |
|
* @since 2012-5-31下午12:20:41 |
|
*/ |
|
public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCreatorUI, Prepare4DataSourceChange { |
|
private TableDataDictPane tableDataDictPane; |
|
|
|
public DictionaryPane() { |
|
} |
|
|
|
@Override |
|
protected void initLayout() { |
|
this.setLayout(new BorderLayout()); |
|
this.add(Layouts.column(LayoutConstants.VERTICAL_GAP, |
|
row( |
|
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Set"), UILabel.LEFT)).weight(1), |
|
cell(jcb).weight(2) |
|
), |
|
cell(cardPane).weight(1) |
|
).weight(1).getComponent()); |
|
} |
|
|
|
@Override |
|
protected String title4PopupWindow() { |
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary"); |
|
} |
|
|
|
@Override |
|
public JComponent toSwingComponent() { |
|
return this; |
|
} |
|
|
|
@Override |
|
public void populateBean(Dictionary ob) { |
|
for (int i = 0; i < this.cards.size(); i++) { |
|
FurtherBasicBeanPane pane = cards.get(i); |
|
if (pane.accept(ob)) { |
|
pane.populateBean(ob); |
|
jcb.setSelectedIndex(i); |
|
} else { |
|
pane.reset(); |
|
} |
|
} |
|
if (ob instanceof DynamicSQLDict) { |
|
jcb.setSelectedIndex(1); |
|
tableDataDictPane.populateBean((DynamicSQLDict) ob); |
|
} |
|
} |
|
|
|
@Override |
|
protected List<FurtherBasicBeanPane<? extends Dictionary>> initPaneList() { |
|
List<FurtherBasicBeanPane<? extends Dictionary>> paneList = new ArrayList<FurtherBasicBeanPane<? extends Dictionary>>(); |
|
paneList.add(new DatabaseDictPane()); |
|
paneList.add(tableDataDictPane = new TableDataDictPane()); |
|
paneList.add(new CustomDictPane()); |
|
paneList.add(new FormulaDictPane()); |
|
return paneList; |
|
} |
|
|
|
@Override |
|
public void registerDSChangeListener() { |
|
tableDataDictPane.registerDSChangeListener(); |
|
} |
|
}
|
|
|