28
28
import org .code4everything .qiniu .constant .QiniuValueConsts ;
29
29
import org .code4everything .qiniu .model .FileInfo ;
30
30
import org .code4everything .qiniu .util .ConfigUtils ;
31
+ import org .code4everything .qiniu .util .DialogUtils ;
32
+ import org .code4everything .qiniu .util .QiniuDialog ;
31
33
import org .code4everything .qiniu .util .QiniuUtils ;
32
- import org .code4everything .qiniu .view .Dialogs ;
33
34
34
35
import java .awt .*;
35
36
import java .io .File ;
@@ -358,7 +359,7 @@ private void drawChart(boolean fluxUnitChange, boolean bandUnitChange) {
358
359
* 日志下载,cdn相关
359
360
*/
360
361
public void downloadCdnLog () {
361
- String date = Dialogs .showInputDialog (null , QiniuValueConsts .INPUT_LOG_DATE ,
362
+ String date = DialogUtils .showInputDialog (null , QiniuValueConsts .INPUT_LOG_DATE ,
362
363
Formatter .dateToString (new Date ()));
363
364
new QiManager ().downloadCdnLog (date );
364
365
}
@@ -375,7 +376,7 @@ public void refreshFile() {
375
376
* 通过链接下载其他的网络文件
376
377
*/
377
378
public void downloadFromURL () {
378
- String url = Dialogs .showInputDialog (null , QiniuValueConsts .DOWNLOAD_URL , "http://example.com" );
379
+ String url = DialogUtils .showInputDialog (null , QiniuValueConsts .DOWNLOAD_URL , "http://example.com" );
379
380
QiniuUtils .download (url );
380
381
}
381
382
@@ -443,7 +444,7 @@ public void updateFile() {
443
444
public void setLife () {
444
445
ObservableList <FileInfo > selectedItems = resTable .getSelectionModel ().getSelectedItems ();
445
446
if (Checker .isNotEmpty (selectedItems )) {
446
- String lifeStr = Dialogs .showInputDialog (null , QiniuValueConsts .FILE_LIFE ,
447
+ String lifeStr = DialogUtils .showInputDialog (null , QiniuValueConsts .FILE_LIFE ,
447
448
QiniuValueConsts .DEFAULT_FILE_LIFE );
448
449
if (Checker .isNumber (lifeStr )) {
449
450
int life = Formatter .stringToInt (lifeStr );
@@ -466,9 +467,9 @@ public void showFileMovableDialog() {
466
467
// 没有选择文件,结束方法
467
468
return ;
468
469
} else if (selectedItems .size () > 1 ) {
469
- pair = new Dialogs ().showFileMovableDialog (bucket , "" , false );
470
+ pair = new QiniuDialog ().showFileMovableDialog (bucket , "" , false );
470
471
} else {
471
- pair = new Dialogs ().showFileMovableDialog (bucket , selectedItems .get (0 ).getName (), true );
472
+ pair = new QiniuDialog ().showFileMovableDialog (bucket , selectedItems .get (0 ).getName (), true );
472
473
}
473
474
if (Checker .isNotNull (pair )) {
474
475
boolean useNewKey = Checker .isNotEmpty (pair .getValue ()[1 ]);
@@ -563,11 +564,11 @@ public void setBucketCount() {
563
564
*/
564
565
public void refreshResTable () {
565
566
if (!QiniuUtils .checkNet ()) {
566
- Dialogs .showWarning (QiniuValueConsts .NET_ERROR );
567
+ DialogUtils .showWarning (QiniuValueConsts .NET_ERROR );
567
568
return ;
568
569
}
569
570
setResTableData ();
570
- Dialogs .showInformation (QiniuValueConsts .REFRESH_SUCCESS );
571
+ DialogUtils .showInformation (QiniuValueConsts .REFRESH_SUCCESS );
571
572
}
572
573
573
574
/**
@@ -666,7 +667,7 @@ private void setFiles(File[] files, boolean checkRecursive) {
666
667
public void uploadFile () {
667
668
if (Checker .isEmpty (zoneText .getText ()) || Checker .isEmpty (selectedFileTextArea .getText ())) {
668
669
// 没有选择存储空间或文件,不能上传文件
669
- Dialogs .showWarning (QiniuValueConsts .NEED_CHOOSE_BUCKET_OR_FILE );
670
+ DialogUtils .showWarning (QiniuValueConsts .NEED_CHOOSE_BUCKET_OR_FILE );
670
671
return ;
671
672
}
672
673
// 新建一个上传文件的线程
@@ -732,7 +733,7 @@ public void uploadFile() {
732
733
} catch (QiniuException e ) {
733
734
status = Formatter .datetimeToString (new Date ()) + "\t error\t " + path ;
734
735
logger .error ("upload error, message: " + e .getMessage ());
735
- Platform .runLater (() -> Dialogs .showException (QiniuValueConsts .UPLOAD_ERROR , e ));
736
+ Platform .runLater (() -> DialogUtils .showException (QiniuValueConsts .UPLOAD_ERROR , e ));
736
737
}
737
738
Platform .runLater (() -> {
738
739
uploadStatusTextArea .deleteText (0 , end );
@@ -777,7 +778,7 @@ private void savePrefix(String key) {
777
778
public void openConfigFile () {
778
779
try {
779
780
Desktop .getDesktop ().open (new File (QiniuValueConsts .CONFIG_PATH ));
780
- Optional <ButtonType > result = Dialogs .showConfirmation (QiniuValueConsts .RELOAD_CONFIG );
781
+ Optional <ButtonType > result = DialogUtils .showConfirmation (QiniuValueConsts .RELOAD_CONFIG );
781
782
if (result .isPresent () && result .get () == ButtonType .OK ) {
782
783
// 重新载入配置文件
783
784
bucketChoiceCombo .getItems ().clear ();
@@ -786,18 +787,18 @@ public void openConfigFile() {
786
787
}
787
788
} catch (IOException e ) {
788
789
logger .error ("open config file error, message -> " + e .getMessage ());
789
- Dialogs .showException (QiniuValueConsts .OPEN_FILE_ERROR , e );
790
+ DialogUtils .showException (QiniuValueConsts .OPEN_FILE_ERROR , e );
790
791
} catch (Exception e ) {
791
792
logger .error ("can't open config file, message -> " + e .getMessage ());
792
- Dialogs .showException (QiniuValueConsts .OPEN_FILE_ERROR , e );
793
+ DialogUtils .showException (QiniuValueConsts .OPEN_FILE_ERROR , e );
793
794
}
794
795
}
795
796
796
797
/**
797
798
* 重置Key
798
799
*/
799
800
public void resetKey () {
800
- boolean ok = new Dialogs ().showInputKeyDialog ();
801
+ boolean ok = new QiniuDialog ().showInputKeyDialog ();
801
802
if (ok && Checker .isNotEmpty (zoneText .getText ())) {
802
803
SdkConfigurer .configUploadEnv (zoneText .getText (), bucketChoiceCombo .getValue ());
803
804
}
@@ -808,7 +809,7 @@ public void resetKey() {
808
809
*/
809
810
public void showBucketAddableDialog () {
810
811
logger .info ("show bucket addable dialog" );
811
- new Dialogs ().showBucketAddableDialog ();
812
+ new QiniuDialog ().showBucketAddableDialog ();
812
813
}
813
814
814
815
public enum DownloadWay {
0 commit comments