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.
67 lines
2.2 KiB
67 lines
2.2 KiB
4 years ago
|
package com.tptj.demo.hg.connection.data;
|
||
|
|
||
|
import com.fanruan.api.design.work.BaseTableDataPane;
|
||
|
import com.fanruan.api.design.work.ConnectionComboBoxPanel;
|
||
|
import com.fr.base.BaseUtils;
|
||
|
import com.fr.design.data.datapane.preview.PreviewTablePane;
|
||
|
import com.fr.design.gui.ibutton.UIButton;
|
||
|
import com.fr.design.layout.TableLayout;
|
||
|
import com.fr.design.layout.TableLayoutHelper;
|
||
|
import com.tptj.demo.hg.connection.conn.DemoConnection;
|
||
|
|
||
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
import java.awt.event.ActionEvent;
|
||
|
import java.awt.event.ActionListener;
|
||
|
|
||
|
/**
|
||
|
* @author 秃破天际
|
||
|
* @version 10.0
|
||
|
* Created by 秃破天际 on 2021-03-31
|
||
|
**/
|
||
|
public class DemoDataPane extends BaseTableDataPane<DemoData> {
|
||
|
private ConnectionComboBoxPanel w_connections;
|
||
|
public DemoDataPane(){
|
||
|
setLayout(new BorderLayout(4, 4));
|
||
|
w_connections = new ConnectionComboBoxPanel(DemoConnection.class);
|
||
|
add(w_connections, BorderLayout.NORTH);
|
||
|
UIButton preview = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
|
||
|
preview.addActionListener(new ActionListener() {
|
||
|
@Override
|
||
|
public void actionPerformed(ActionEvent e) {
|
||
|
SwingUtilities.invokeLater(new Runnable() {
|
||
|
@Override
|
||
|
public void run() {
|
||
|
PreviewTablePane.previewTableData(DemoDataPane.this.updateBean());
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
add(TableLayoutHelper.createTableLayoutPane(
|
||
|
new Component[][] {{
|
||
|
w_connections,preview
|
||
|
}},
|
||
|
new double[] { TableLayout.PREFERRED },
|
||
|
new double[] { TableLayout.FILL,TableLayout.PREFERRED }
|
||
|
),BorderLayout.NORTH);
|
||
|
}
|
||
|
@Override
|
||
|
public void populateBean(DemoData data) {
|
||
|
if( null != data ){
|
||
|
w_connections.setSelectedItem( data.getDatabase() );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public DemoData updateBean() {
|
||
|
DemoData data = new DemoData();
|
||
|
data.setDatabase( w_connections.getSelectedItem() );
|
||
|
return data;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected String title4PopupWindow() {
|
||
|
return "Demo Conn Data";
|
||
|
}
|
||
|
}
|