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.
62 lines
1.9 KiB
62 lines
1.9 KiB
package com.fr.plugin.demo.dataset.transfer; |
|
|
|
import com.fanruan.api.design.ui.component.UILabel; |
|
import com.fanruan.api.design.ui.layout.TableLayoutKit; |
|
import com.fr.design.data.datapane.connect.DatabaseConnectionPane; |
|
|
|
import javax.swing.*; |
|
import java.awt.*; |
|
|
|
/** |
|
* Created by richie on 2017/5/15. |
|
*/ |
|
public class DemoConnectionPane extends DatabaseConnectionPane<DemoConnection> { |
|
|
|
private JTextField hostTextPane; |
|
private JTextField userNameTextPane; |
|
|
|
|
|
@Override |
|
protected JPanel mainPanel() { |
|
JPanel panel = new JPanel(new BorderLayout()); |
|
|
|
double p = TableLayoutKit.PREFERRED; |
|
double f = TableLayoutKit.FILL; |
|
double[] rowSize = new double[]{p, p, p, p, p, p, p, p, p, p}; |
|
double[] columnSize = new double[]{p, f}; |
|
|
|
hostTextPane = new JTextField(); |
|
userNameTextPane = new JTextField(); |
|
Component[][] components = new Component[][]{ |
|
{new UILabel("host:"), hostTextPane}, |
|
{new UILabel("userName:"), userNameTextPane} |
|
}; |
|
JPanel centerPane = TableLayoutKit.createTableLayoutPane(components, rowSize, columnSize); |
|
panel.add(centerPane, BorderLayout.CENTER); |
|
return panel; |
|
} |
|
|
|
@Override |
|
protected boolean isFineBI() { |
|
return false; |
|
} |
|
|
|
@Override |
|
protected void populateSubDatabaseConnectionBean(DemoConnection demoConnection) { |
|
hostTextPane.setText(demoConnection.getHost()); |
|
userNameTextPane.setText(demoConnection.getUsername()); |
|
} |
|
|
|
@Override |
|
protected DemoConnection updateSubDatabaseConnectionBean() { |
|
DemoConnection connection = new DemoConnection(); |
|
connection.setHost(hostTextPane.getText()); |
|
connection.setUsername(userNameTextPane.getText()); |
|
return connection; |
|
} |
|
|
|
@Override |
|
protected String title4PopupWindow() { |
|
return "demo"; |
|
} |
|
}
|
|
|