Moxkiriyaプロジェクト事前開発用の作業部屋
修訂 | 7d68da5a4b424a88189469bb9f3dccb0f126e5de (tree) |
---|---|
時間 | 2018-10-20 10:25:20 |
作者 | Harold_Andoh <andolloyd@gmai...> |
Commiter | Harold_Andoh |
[Moxkiriya7]
@@ -64,7 +64,7 @@ | ||
64 | 64 | <Font size="20.0" fx:id="x2" /> |
65 | 65 | </font> |
66 | 66 | </Button> |
67 | - <TextField id="TextFieldSearchWiki" fx:id="webViewMenuAnchorPaneTextFieldSearchWiki" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="35.0" prefWidth="256.0" promptText="%key.TextField.Search_Wiki" AnchorPane.rightAnchor="85.0" AnchorPane.topAnchor="2.0" /> | |
67 | + <TextField id="TextFieldSearchWiki" fx:id="webViewMenuAnchorPaneTextFieldSearchWiki" maxHeight="-Infinity" maxWidth="-Infinity" onKeyPressed="#onKeyPressedTextFieldSearchWiki" prefHeight="35.0" prefWidth="256.0" promptText="%key.TextField.Search_Wiki" AnchorPane.rightAnchor="85.0" AnchorPane.topAnchor="2.0" /> | |
68 | 68 | <Button id="ButtonSearch" fx:id="webViewMenuAnchorPaneButtonSearch" maxHeight="-Infinity" maxWidth="-Infinity" mnemonicParsing="false" onAction="#onActionButtonSearch" prefHeight="35.0" prefWidth="80.0" text="%key.Button.Search" AnchorPane.rightAnchor="2.0" AnchorPane.topAnchor="2.0" /> |
69 | 69 | </children> |
70 | 70 | <padding> |
@@ -60,6 +60,8 @@ import javafx.scene.control.TextField; | ||
60 | 60 | import javafx.scene.control.cell.CheckBoxTableCell; |
61 | 61 | import javafx.scene.control.cell.PropertyValueFactory; |
62 | 62 | import javafx.scene.image.ImageView; |
63 | +import javafx.scene.input.KeyCode; | |
64 | +import javafx.scene.input.KeyEvent; | |
63 | 65 | import javafx.scene.layout.AnchorPane; |
64 | 66 | import javafx.scene.layout.FlowPane; |
65 | 67 | import javafx.scene.web.WebEngine; |
@@ -214,7 +216,9 @@ public class WikiMainWindowController implements Initializable { | ||
214 | 216 | @Override |
215 | 217 | public void initialize(URL url, ResourceBundle resourceBundle) { |
216 | 218 | resourceBundle_ = resourceBundle; |
219 | + | |
217 | 220 | setLinkClickListner(webView.getEngine()); |
221 | + webView.setContextMenuEnabled(false); | |
218 | 222 | |
219 | 223 | previewWindow_ = new WikiPreviewWindow(stage_, resourceBundle_); |
220 | 224 | previewWindow_.setMainWindowController(this); |
@@ -513,23 +517,22 @@ public class WikiMainWindowController implements Initializable { | ||
513 | 517 | } |
514 | 518 | |
515 | 519 | @FXML |
516 | - public void onActionButtonSearch(ActionEvent event) { | |
520 | + public void onKeyPressedTextFieldSearchWiki(KeyEvent event) { | |
517 | 521 | try { |
518 | - String key = webViewMenuAnchorPaneTextFieldSearchWiki.getText(); | |
519 | - | |
520 | - if(key.isEmpty() != true) { | |
521 | - HashMap<String, PageData> map = wikiEngine_.queryPageFullTextSearch(key); | |
522 | - | |
523 | - wikiEngine_.setPageDataMap(map); | |
524 | - loadWikiContent(); | |
525 | - | |
526 | - webViewHyperlinkMain.setId("webViewMainHyperlinkActive"); | |
527 | - webViewHyperlinkHistory.setId("webViewMainHyperlinkInactive"); | |
528 | - webViewAnchorPaneMain.setVisible(true); | |
529 | - webViewAnchorPaneHistory.setVisible(false); | |
522 | + if(event.getCode().equals(KeyCode.ENTER) == true) { | |
523 | + doSearchWiki(); | |
530 | 524 | } |
531 | 525 | } catch (Exception e) { |
532 | 526 | e.printStackTrace(); |
527 | + } | |
528 | + } | |
529 | + | |
530 | + @FXML | |
531 | + public void onActionButtonSearch(ActionEvent event) { | |
532 | + try { | |
533 | + doSearchWiki(); | |
534 | + } catch (Exception e) { | |
535 | + e.printStackTrace(); | |
533 | 536 | } |
534 | 537 | } |
535 | 538 |
@@ -990,6 +993,7 @@ public class WikiMainWindowController implements Initializable { | ||
990 | 993 | e.printStackTrace(); |
991 | 994 | } |
992 | 995 | } |
996 | + | |
993 | 997 | /** |
994 | 998 | * Latest contents getter. |
995 | 999 | * @return PageData |
@@ -1040,7 +1044,7 @@ public class WikiMainWindowController implements Initializable { | ||
1040 | 1044 | e.printStackTrace(); |
1041 | 1045 | } |
1042 | 1046 | } |
1043 | - | |
1047 | + | |
1044 | 1048 | /** |
1045 | 1049 | * ページ内の指定セクションリンクへジャンプする。 |
1046 | 1050 | * @param target |
@@ -1069,6 +1073,26 @@ public class WikiMainWindowController implements Initializable { | ||
1069 | 1073 | public ImageView getImageViewLoading() { |
1070 | 1074 | return ImageViewLoading; |
1071 | 1075 | } |
1076 | + | |
1077 | + /** | |
1078 | + * Execute search wiki. | |
1079 | + * @throws Exception | |
1080 | + */ | |
1081 | + private void doSearchWiki() throws Exception { | |
1082 | + String key = webViewMenuAnchorPaneTextFieldSearchWiki.getText(); | |
1083 | + | |
1084 | + if(key.isEmpty() != true) { | |
1085 | + HashMap<String, PageData> map = wikiEngine_.queryPageFullTextSearch(key); | |
1086 | + | |
1087 | + wikiEngine_.setPageDataMap(map); | |
1088 | + loadWikiContent(); | |
1089 | + | |
1090 | + webViewHyperlinkMain.setId("webViewMainHyperlinkActive"); | |
1091 | + webViewHyperlinkHistory.setId("webViewMainHyperlinkInactive"); | |
1092 | + webViewAnchorPaneMain.setVisible(true); | |
1093 | + webViewAnchorPaneHistory.setVisible(false); | |
1094 | + } | |
1095 | + } | |
1072 | 1096 | |
1073 | 1097 | /** |
1074 | 1098 | * 選択中または現在表示中のコンテンツのディレクトリを取得する。 |