2424import com .zhazhapan .qiniu .ThreadPool ;
2525import com .zhazhapan .qiniu .QiManager .FileAction ;
2626import com .zhazhapan .qiniu .config .ConfigLoader ;
27- import com .zhazhapan .qiniu .config .QiConfig ;
27+ import com .zhazhapan .qiniu .config .QiConfiger ;
2828import com .zhazhapan .qiniu .model .FileInfo ;
2929import com .zhazhapan .qiniu .modules .constant .Values ;
3030import com .zhazhapan .qiniu .util .Checker ;
5151import javafx .scene .control .TextField ;
5252import javafx .scene .control .cell .PropertyValueFactory ;
5353import javafx .scene .control .cell .TextFieldTableCell ;
54+ import javafx .scene .input .DragEvent ;
5455import javafx .scene .input .KeyEvent ;
56+ import javafx .scene .input .TransferMode ;
5557import javafx .stage .FileChooser ;
5658import javafx .util .Pair ;
5759
@@ -208,7 +210,7 @@ private void initialize() {
208210 bucketDomainTextField .setText (Values .DOMAIN_CONFIG_ERROR );
209211 }
210212 ThreadPool .executor .submit (() -> {
211- if (new QiConfig ().configUploadEnv (zones [0 ], newValue )) {
213+ if (new QiConfiger ().configUploadEnv (zones [0 ], newValue )) {
212214 // 加载文件列表
213215 setResTableData ();
214216 // 刷新流量带宽统计
@@ -227,6 +229,22 @@ private void initialize() {
227229 toIntro1 .setOnAction (e -> Utils .openLink ("http://blog.csdn.net/qq_26954773/article/details/78245100" ));
228230 }
229231
232+ /**
233+ * 拖曳文件至TextArea
234+ */
235+ public void dragFileOver (DragEvent event ) {
236+ logger .info ("drog file in textarea" );
237+ event .acceptTransferModes (TransferMode .ANY );
238+ }
239+
240+ /**
241+ * 拖曳文件松开鼠标
242+ */
243+ public void dragFileDropped (DragEvent event ) {
244+ logger .info ("drag file dropped" );
245+ setFiles (event .getDragboard ().getFiles ());
246+ }
247+
230248 /**
231249 * 开始日期或结束日期改变,刷新流量、带宽统计
232250 */
@@ -461,7 +479,7 @@ public void setBucketCount() {
461479 * 刷新资源列表
462480 */
463481 public void refreshResTable () {
464- if (!new QiConfig ().checkNet ()) {
482+ if (!new QiConfiger ().checkNet ()) {
465483 Dialogs .showWarning (Values .NET_ERROR );
466484 return ;
467485 }
@@ -525,10 +543,15 @@ public void selectFile() {
525543 FileChooser chooser = new FileChooser ();
526544 chooser .setTitle (Values .FILE_CHOOSER_TITLE );
527545 chooser .setInitialDirectory (new File (System .getProperty ("user.home" )));
528- List <File > files = chooser .showOpenMultipleDialog (QiniuApplication .stage );
546+ setFiles (chooser .showOpenMultipleDialog (QiniuApplication .stage ));
547+ }
548+
549+ public void setFiles (List <File > files ) {
529550 if (Checker .isNotEmpty (files )) {
530551 for (File file : files ) {
531- selectedFileTextArea .insertText (0 , file .getAbsolutePath () + "\r \n " );
552+ if (!selectedFileTextArea .getText ().contains (file .getAbsolutePath ())) {
553+ selectedFileTextArea .insertText (0 , file .getAbsolutePath () + "\r \n " );
554+ }
532555 }
533556 }
534557 }
@@ -641,7 +664,7 @@ public void openConfigFile() {
641664 public void resetKey () {
642665 boolean ok = new Dialogs ().showInputKeyDialog ();
643666 if (ok && Checker .isNotEmpty (zoneText .getText ())) {
644- new QiConfig ().configUploadEnv (zoneText .getText (), bucketChoiceCombo .getValue ());
667+ new QiConfiger ().configUploadEnv (zoneText .getText (), bucketChoiceCombo .getValue ());
645668 }
646669 }
647670
0 commit comments