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.
69 lines
2.8 KiB
69 lines
2.8 KiB
package com.fr.plugin.file.submit.oss.ui; |
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
import com.fr.design.editor.ValueEditorPane; |
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
import com.fr.design.gui.ilable.UILabel; |
|
import com.fr.design.i18n.Toolkit; |
|
import com.fr.design.layout.TableLayout; |
|
import com.fr.design.layout.TableLayoutHelper; |
|
import com.fr.general.GeneralUtils; |
|
import com.fr.plugin.file.submit.oss.fun.OssVariableValue; |
|
import com.fr.plugin.file.submit.oss.script.OssDownloadHyperlink; |
|
import com.fr.plugin.oss.universal.config.OssUniversalConfig; |
|
|
|
import javax.swing.*; |
|
import java.awt.*; |
|
|
|
public class OssHyperlink4DownloadPane extends BasicBeanPane<OssDownloadHyperlink> { |
|
|
|
private UIComboBox bucketComboBox; |
|
private ValueEditorPane directoryValuePane; |
|
private ValueEditorPane fileNameValuePane; |
|
|
|
public OssHyperlink4DownloadPane() { |
|
initComponents(); |
|
} |
|
|
|
private void initComponents() { |
|
this.setLayout(new BorderLayout()); |
|
this.bucketComboBox = new UIComboBox(OssUniversalConfig.getInstance().getArrayBuckets()); |
|
this.directoryValuePane = Editors.createValueEditorPane(); |
|
this.fileNameValuePane = Editors.createValueEditorPane(); |
|
double p = TableLayout.PREFERRED; |
|
double f = TableLayout.FILL; |
|
double[] rowSize = {p, p, p}; |
|
double[] columnSize = {p, f}; |
|
JPanel centerPane = TableLayoutHelper.createTableLayoutPane( |
|
new Component[][] { |
|
{new UILabel(Toolkit.i18nText("Plugin-File_Submit_Oss_Bucket_Name") + ":"), bucketComboBox}, |
|
{new UILabel(Toolkit.i18nText("Plugin-File_Submit_Oss_Directory") + ":"), directoryValuePane}, |
|
{new UILabel(Toolkit.i18nText("Plugin-File_Submit_Oss_File_Name") + ":"), fileNameValuePane} |
|
}, rowSize, columnSize); |
|
this.add(centerPane, BorderLayout.CENTER); |
|
} |
|
|
|
@Override |
|
public void populateBean(OssDownloadHyperlink hyperlink) { |
|
if (hyperlink == null) { |
|
return; |
|
} |
|
bucketComboBox.setSelectedItem(hyperlink.getBucket()); |
|
directoryValuePane.populate(hyperlink.getDirectory() == null ? null : hyperlink.getDirectory().getValue()); |
|
fileNameValuePane.populate(hyperlink.getFileName() == null ? null : hyperlink.getFileName().getValue()); |
|
} |
|
|
|
@Override |
|
public OssDownloadHyperlink updateBean() { |
|
OssDownloadHyperlink hyperlink = new OssDownloadHyperlink(); |
|
hyperlink.setBucket(GeneralUtils.objectToString(bucketComboBox.getSelectedItem())); |
|
hyperlink.setDirectory(new OssVariableValue(directoryValuePane.update())); |
|
hyperlink.setFileName(new OssVariableValue(fileNameValuePane.update())); |
|
return hyperlink; |
|
} |
|
|
|
@Override |
|
protected String title4PopupWindow() { |
|
return Toolkit.i18nText("Plugin-File_Download_Hyperlink"); |
|
} |
|
}
|
|
|