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.

80 lines
2.2 KiB

3 years ago
/*
* Copyright (C), 2015-2019
* FileName: ParamConfigPane
* Author: xx
* Date: 2019/09/09
* Description: ParamConfigPane
* History:
* <author> <time> <version> <desc>
* 作者姓名 修改时间 版本号 描述
*/
package com.fr.plugin.isgd.menu;
import com.fanruan.api.design.ui.component.UILabel;
import com.fanruan.api.design.ui.component.UITextField;
import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.design.ui.layout.TableLayoutKit;
import com.fanruan.api.i18n.I18nKit;
import com.fr.main.impl.WorkBook;
import javax.swing.*;
import java.awt.*;
import static com.fr.plugin.isgd.Constants.ACTION_NAME;
/**
* <功能简述><br>
* <ParamConfigPane>
*
* @author xx
* @create 2019/09/09
* @since 1.0.0
*/
public class ParamConfigPane extends BasicPane {
private UITextField headerTextField;
public ParamConfigPane() {
UILabel headerLabel = new UILabel(I18nKit.getLocText("Plugin-isgd_Header_Row"));
headerTextField = new UITextField();
double p = TableLayoutKit.PREFERRED;
double f = TableLayoutKit.FILL;
double[] columnSize = new double[]{p, f};
double[] rowSize = new double[]{p, p, p};
Component[][] components = new Component[][]{
new Component[]{headerLabel, headerTextField},
};
JPanel centerPane = TableLayoutKit.createTableLayoutPane(components, rowSize, columnSize);
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
pane.add(centerPane, BorderLayout.NORTH);
setLayout(new BorderLayout());
add(pane, BorderLayout.CENTER);
}
public void populate(WorkBook workBook) {
if (workBook == null) {
return;
}
ParamConfig paramConfig = workBook.getAttrMark(ParamConfig.XML_TAG);
if (paramConfig != null) {
headerTextField.setText(paramConfig.getHeaderRow());
}
}
public ParamConfig update() {
ParamConfig paramConfig = new ParamConfig();
paramConfig.setHeaderRow(headerTextField.getText());
return paramConfig;
}
@Override
protected String title4PopupWindow() {
return ACTION_NAME;
}
}