Destiny.Lin
2 years ago
8 changed files with 367 additions and 15 deletions
@ -0,0 +1,98 @@
|
||||
package com.fr.design.actions.replace.ui; |
||||
|
||||
|
||||
import com.fr.design.dialog.UIDialog; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
|
||||
import com.fr.design.gui.itableeditorpane.UITableEditorPane; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
import static com.fr.design.actions.replace.ui.ITTableEditorPane.getEditTable; |
||||
|
||||
/** |
||||
* 合法性校验的面板 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-10-28 |
||||
*/ |
||||
public class ITCheckDialog extends UIDialog { |
||||
private UITableEditorPane editorPane; |
||||
private ITCheckEditor editor; |
||||
private static final int DIALOG_WIDTH = 660, DIALOG_HEIGHT = 400; |
||||
private static final int TABLE_WIDTH = 640, TABLE_HEIGHT = 320; |
||||
private static final int LABEL_HEIGHT = 20; |
||||
|
||||
public static final Object[] columnTitle = {Toolkit.i18nText("Fine-Design_Replace_Check_Content"), Toolkit.i18nText("Fine-Design_Replace_Check_Reason")}; |
||||
|
||||
public ITCheckDialog() { |
||||
super(ITReplaceMainDialog.getInstance()); |
||||
setTitle(Toolkit.i18nText("Fine-Design_Replace_Check_Title")); |
||||
JPanel centerPanel = new JPanel(); |
||||
JPanel southPanel = new JPanel(); |
||||
southPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
||||
|
||||
editor = new ITCheckEditor(); |
||||
editorPane = new UITableEditorPane(editor); |
||||
editor.add(ITReplaceMainDialog.getCheckValidList()); |
||||
|
||||
UILabel label = new UILabel("<html>" + Toolkit.i18nText("Fine-Design_Replace_Check") + "<font color = 'rgb(236,124,125)'>" + ITReplaceMainDialog.contentReplaceFailedCount + "</font>" + Toolkit.i18nText("Fine-Design_Replace_Check_Tip")); |
||||
JPanel center = new JPanel(new BorderLayout()); |
||||
UIButton location = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Location")); |
||||
UIButton cancel = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); |
||||
|
||||
location.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
for (int i : ITReplaceMainDialog.getSerialNumber()) { |
||||
getEditTable().addRowSelectionInterval(i, i); |
||||
} |
||||
ITCheckDialog.this.dispose(); |
||||
} |
||||
}); |
||||
|
||||
cancel.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
ITCheckDialog.this.dispose(); |
||||
} |
||||
}); |
||||
|
||||
|
||||
editorPane.setPreferredSize(new Dimension(TABLE_WIDTH, TABLE_HEIGHT)); |
||||
label.setPreferredSize(new Dimension(TABLE_WIDTH, LABEL_HEIGHT)); |
||||
|
||||
centerPanel.add(editorPane); |
||||
southPanel.add(location); |
||||
southPanel.add(cancel); |
||||
center.add(southPanel, BorderLayout.SOUTH); |
||||
center.add(label, BorderLayout.NORTH); |
||||
center.add(centerPanel, BorderLayout.CENTER); |
||||
center.setVisible(true); |
||||
//主体部分
|
||||
add(center); |
||||
|
||||
|
||||
setSize(DIALOG_WIDTH, DIALOG_HEIGHT); |
||||
setMaximumSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); |
||||
setMinimumSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); |
||||
|
||||
setLocation(ITReplaceMainDialog.getInstance().getX() + ITReplaceMainDialog.getInstance().getWidth() / 2 - DIALOG_WIDTH / 2, ITReplaceMainDialog.getInstance().getY()); |
||||
setVisible(true); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void checkValid() throws Exception { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,64 @@
|
||||
package com.fr.design.actions.replace.ui; |
||||
|
||||
import com.fr.design.actions.replace.info.Info; |
||||
import com.fr.design.actions.replace.info.base.ITContent; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itableeditorpane.UITableEditAction; |
||||
import com.fr.design.gui.itableeditorpane.UITableModelAdapter; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 合法性校验表格的Model |
||||
* |
||||
* @author Destiny.Lin |
||||
* @version 11.0 |
||||
* created by Destiny.Lin on 2022-10-28 |
||||
*/ |
||||
public class ITCheckEditor extends UITableModelAdapter { |
||||
|
||||
public ITCheckEditor() { |
||||
super(new String[]{ |
||||
Toolkit.i18nText("Fine-Design_Replace_Check_Content"), |
||||
Toolkit.i18nText("Fine-Design_Replace_Check_Reason") |
||||
}); |
||||
|
||||
this.setColumnClass(new Class[]{ |
||||
UILabel.class, |
||||
UILabel.class, |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
public Object getValueAt(int rowIndex, int columnIndex) { |
||||
ITContent content = (ITContent) this.getList().get(rowIndex); |
||||
if (columnIndex == 0) { |
||||
return content.getShowStr(); |
||||
} else { |
||||
return content.getCheckStr(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean isCellEditable(int row, int col) { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public UITableEditAction[] createAction() { |
||||
return new UITableEditAction[0]; |
||||
} |
||||
|
||||
/** |
||||
* 添加数据 |
||||
* |
||||
* @param list |
||||
*/ |
||||
public void add(List<? extends Info> list) { |
||||
for (Info info : list) { |
||||
addRow(info.getContent()); |
||||
} |
||||
fireTableDataChanged(); |
||||
} |
||||
} |
Loading…
Reference in new issue