Moxkiriyaプロジェクト事前開発用の作業部屋
Révision | 391cde6c9d96bc1ee9a2c09e3f7e28e1b78bdcac (tree) |
---|---|
l'heure | 2018-09-22 14:05:05 |
Auteur | Harold_Andoh <andolloyd@gmai...> |
Commiter | Harold_Andoh |
[Moxkiriya7]
@@ -1 +1,2 @@ | ||
1 | 1 | bin |
2 | +derby.log |
@@ -133,7 +133,7 @@ public class Main extends Application { | ||
133 | 133 | Scene scene = new Scene((Parent)loader.getRoot()); |
134 | 134 | scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); |
135 | 135 | |
136 | - wikiEngine_.setPageTitle(WikiEngine.MAINPAGE_TITLE); | |
136 | + wikiEngine_.setCurrentPage(WikiEngine.MAINPAGE_TITLE); | |
137 | 137 | controller_.loadWikiContent(); |
138 | 138 | |
139 | 139 | primaryStage_.setScene(scene); |
@@ -7,18 +7,26 @@ | ||
7 | 7 | */ |
8 | 8 | package com.wiki.standalone.moxkiriya; |
9 | 9 | |
10 | +import java.io.BufferedReader; | |
10 | 11 | import java.io.File; |
11 | 12 | import java.io.FileInputStream; |
12 | 13 | import java.io.InputStream; |
14 | +import java.io.StringReader; | |
13 | 15 | import java.util.ArrayList; |
14 | 16 | import java.util.Calendar; |
17 | +import java.util.regex.Pattern; | |
15 | 18 | |
16 | 19 | import javax.activation.FileTypeMap; |
17 | 20 | import javax.jcr.Node; |
18 | 21 | import javax.jcr.PathNotFoundException; |
19 | 22 | import javax.jcr.Property; |
23 | +import javax.jcr.RepositoryException; | |
20 | 24 | import javax.jcr.Value; |
21 | 25 | |
26 | +import com.wiki.standalone.moxkiriya.util.FileIO; | |
27 | + | |
28 | +import javafx.beans.property.SimpleStringProperty; | |
29 | +import javafx.beans.property.StringProperty; | |
22 | 30 | |
23 | 31 | /** |
24 | 32 | * Page data structure. |
@@ -91,6 +99,22 @@ public class PageData { | ||
91 | 99 | // Ignore exception. |
92 | 100 | } |
93 | 101 | } |
102 | + | |
103 | + /** | |
104 | + * UUID property getter. | |
105 | + * @return StringProperty | |
106 | + */ | |
107 | + public StringProperty uuidProperty() { | |
108 | + SimpleStringProperty property = new SimpleStringProperty(); | |
109 | + | |
110 | + try { | |
111 | + property.setValue(node_.getProperty(Property.JCR_UUID).getString()); | |
112 | + } catch (RepositoryException e) { | |
113 | + e.printStackTrace(); | |
114 | + } | |
115 | + | |
116 | + return property; | |
117 | + } | |
94 | 118 | |
95 | 119 | /** |
96 | 120 | * Namespace getter. |
@@ -125,6 +149,14 @@ public class PageData { | ||
125 | 149 | } |
126 | 150 | |
127 | 151 | /** |
152 | + * titleProperty getter. | |
153 | + * @return StringProperty | |
154 | + */ | |
155 | + public StringProperty titleProperty() { | |
156 | + return new SimpleStringProperty(title_); | |
157 | + } | |
158 | + | |
159 | + /** | |
128 | 160 | * Content getter. |
129 | 161 | * @return String |
130 | 162 | */ |
@@ -142,6 +174,64 @@ public class PageData { | ||
142 | 174 | } |
143 | 175 | |
144 | 176 | /** |
177 | + * Introduction getter. | |
178 | + * Introduction is the first part of the page. | |
179 | + * The part is extracted until the following conditions are satisfied. | |
180 | + * <ul> | |
181 | + * <li>Up to the first heading.</li> | |
182 | + * <li>255 characters</li> | |
183 | + * <li>3 lines</li> | |
184 | + * </ul> | |
185 | + * @return String | |
186 | + * @throws Exception | |
187 | + */ | |
188 | + public String getIntroduction() throws Exception { | |
189 | + BufferedReader buffreader = FileIO.bufferedReader(new StringReader(content_)); | |
190 | + String line; | |
191 | + StringBuffer buf = new StringBuffer(""); | |
192 | + int lineCount = 0; | |
193 | + int charCount = 0; | |
194 | + Pattern hnPattern = Pattern.compile("^={2,6}[^=]+={2,6}$"); | |
195 | + | |
196 | + while((line = buffreader.readLine()) != null) { | |
197 | + if(hnPattern.matcher(line).matches() == true) { | |
198 | + break; | |
199 | + } | |
200 | + else if(charCount + line.length() > 255) { | |
201 | + buf.append(line.substring(0, 255 - charCount)); | |
202 | + charCount = 255; | |
203 | + break; | |
204 | + } | |
205 | + else { | |
206 | + buf.append(line + "\n"); | |
207 | + charCount += line.length() + 1; | |
208 | + lineCount++; | |
209 | + | |
210 | + if(lineCount >= 3) { | |
211 | + break; | |
212 | + } | |
213 | + } | |
214 | + } | |
215 | + | |
216 | + return buf.toString(); | |
217 | + } | |
218 | + | |
219 | + /** | |
220 | + * contentProperty getter. | |
221 | + * @return StringProperty | |
222 | + */ | |
223 | + public StringProperty introductionProperty() { | |
224 | + String introduction = ""; | |
225 | + try { | |
226 | + introduction = getIntroduction(); | |
227 | + } catch (Exception e) { | |
228 | + e.printStackTrace(); | |
229 | + } | |
230 | + | |
231 | + return new SimpleStringProperty(introduction); | |
232 | + } | |
233 | + | |
234 | + /** | |
145 | 235 | * Categories getter. |
146 | 236 | * @return ArrayList<String> |
147 | 237 | */ |
@@ -6,12 +6,14 @@ import java.io.FileInputStream; | ||
6 | 6 | import java.io.IOException; |
7 | 7 | import java.io.InputStream; |
8 | 8 | import java.io.StringReader; |
9 | +import java.util.ArrayList; | |
9 | 10 | import java.util.HashMap; |
10 | 11 | import java.util.ResourceBundle; |
11 | 12 | import java.util.Set; |
12 | 13 | |
14 | +import javax.jcr.Value; | |
15 | + | |
13 | 16 | import com.wiki.standalone.moxkiriya.parser.blockparser.WikiBodyBlockParser; |
14 | -import com.wiki.standalone.moxkiriya.parser.inlineparser.WikiInternalLinkInlineParser; | |
15 | 17 | import com.wiki.standalone.moxkiriya.util.FileIO; |
16 | 18 | |
17 | 19 | public class WikiEngine { |
@@ -24,15 +26,12 @@ public class WikiEngine { | ||
24 | 26 | /** template file HTML<head>section. */ |
25 | 27 | public static final String TEMPLATE_HTMLHEADER_FILE = "templateHtmlHead.txt"; |
26 | 28 | |
29 | + /** jcr_uuid 独自属性 */ | |
30 | + public static final String ATTRIBUTE_JCR_UUID = "data-jcr_uuid"; | |
31 | + | |
27 | 32 | /** Wiki Repository. */ |
28 | 33 | private WikiRepository wikiRepository_; |
29 | 34 | |
30 | - /** Now page title */ | |
31 | - private String pageTitle_; | |
32 | - | |
33 | - /** List of PageData */ | |
34 | - private HashMap<String, PageData> pageDataMap_; | |
35 | - | |
36 | 35 | /** Current page data. */ |
37 | 36 | private PageData currentPageData_ = null; |
38 | 37 |
@@ -45,34 +44,29 @@ public class WikiEngine { | ||
45 | 44 | } |
46 | 45 | |
47 | 46 | /** |
48 | - * pageTitle setter. | |
47 | + * Current page setter. | |
49 | 48 | * @param pageTitle |
50 | 49 | * @param pageDataMap |
51 | 50 | * @throws Exception |
52 | 51 | */ |
53 | - public void setPageTitle(String pageTitle, String identifier, HashMap<String, PageData> pageDataMap) throws Exception { | |
54 | - pageTitle_ = pageTitle; | |
55 | - pageDataMap_ = pageDataMap != null | |
56 | - ? pageDataMap | |
57 | - : wikiRepository_.queryNodePageTitle(pageTitle); | |
58 | - currentPageData_ = pageDataMap_.get(identifier); | |
52 | + public void setCurrentPage(PageData pageData) { | |
53 | + currentPageData_ = pageData; | |
59 | 54 | } |
60 | 55 | |
61 | 56 | /** |
62 | - * pageTitle setter. | |
57 | + * Current page setter. | |
63 | 58 | * @param pageTitle |
64 | 59 | * @param pageDataMap |
65 | 60 | * @throws Exception |
66 | 61 | */ |
67 | - public void setPageTitle(String pageTitle, HashMap<String, PageData> pageDataMap) throws Exception { | |
68 | - pageTitle_ = pageTitle; | |
69 | - pageDataMap_ = pageDataMap != null | |
70 | - ? pageDataMap | |
71 | - : wikiRepository_.queryNodePageTitle(pageTitle); | |
72 | - | |
73 | - if(pageDataMap_.size() == 1) { | |
74 | - Set<String> key = pageDataMap_.keySet(); | |
75 | - currentPageData_ = pageDataMap_.get(key.iterator().next()); | |
62 | + public void setCurrentPage(String pageTitle, HashMap<String, PageData> pageDataMap) throws Exception { | |
63 | + if(pageDataMap == null) { | |
64 | + pageDataMap = wikiRepository_.queryPageTitle(pageTitle); | |
65 | + } | |
66 | + | |
67 | + if(pageDataMap.size() == 1) { | |
68 | + Set<String> key = pageDataMap.keySet(); | |
69 | + currentPageData_ = pageDataMap.get(key.iterator().next()); | |
76 | 70 | } |
77 | 71 | else { |
78 | 72 | currentPageData_ = null; |
@@ -80,19 +74,12 @@ public class WikiEngine { | ||
80 | 74 | } |
81 | 75 | |
82 | 76 | /** |
83 | - * pageTitle setter. | |
77 | + * Current page setter. | |
84 | 78 | * @param pageTitle |
85 | 79 | * @throws Exception |
86 | 80 | */ |
87 | - public void setPageTitle(String pageTitle) throws Exception { | |
88 | - setPageTitle(pageTitle, null); | |
89 | - } | |
90 | - | |
91 | - /** | |
92 | - * pageTitle getter. | |
93 | - */ | |
94 | - public String getPageTitle() { | |
95 | - return pageTitle_; | |
81 | + public void setCurrentPage(String pageTitle) throws Exception { | |
82 | + setCurrentPage(pageTitle, null); | |
96 | 83 | } |
97 | 84 | |
98 | 85 | /** |
@@ -104,13 +91,22 @@ public class WikiEngine { | ||
104 | 91 | } |
105 | 92 | |
106 | 93 | /** |
94 | + * pageTitle getter. | |
95 | + */ | |
96 | + public String getPageTitle() { | |
97 | + return currentPageData_ != null | |
98 | + ? currentPageData_.getTitle() | |
99 | + : null; | |
100 | + } | |
101 | + | |
102 | + /** | |
107 | 103 | * Execute query node by namespace. |
108 | 104 | * @param namespace |
109 | 105 | * @return HashMap<String, PageData> |
110 | 106 | * @throws Exception |
111 | 107 | */ |
112 | - public HashMap<String, PageData> queryNodeNamespace(String namespace) throws Exception { | |
113 | - return wikiRepository_.queryNodeNamespace(namespace); | |
108 | + public HashMap<String, PageData> queryPageNamespace(String namespace) throws Exception { | |
109 | + return wikiRepository_.queryPageNamespace(namespace); | |
114 | 110 | } |
115 | 111 | |
116 | 112 | /** |
@@ -119,8 +115,8 @@ public class WikiEngine { | ||
119 | 115 | * @return HashMap<String, PageData> |
120 | 116 | * @throws Exception |
121 | 117 | */ |
122 | - public HashMap<String, PageData> queryNodePageUUID(String uuid) throws Exception { | |
123 | - return wikiRepository_.queryNodePageUUID(uuid); | |
118 | + public HashMap<String, PageData> queryPageUUID(String uuid) throws Exception { | |
119 | + return wikiRepository_.queryPageUUID(uuid); | |
124 | 120 | } |
125 | 121 | |
126 | 122 | /** |
@@ -129,8 +125,8 @@ public class WikiEngine { | ||
129 | 125 | * @return HashMap<String, PageData> |
130 | 126 | * @throws Exception |
131 | 127 | */ |
132 | - public HashMap<String, PageData> queryNodePageTitle(String pageTitle) throws Exception { | |
133 | - return wikiRepository_.queryNodePageTitle(pageTitle); | |
128 | + public HashMap<String, PageData> queryPageTitle(String pageTitle) throws Exception { | |
129 | + return wikiRepository_.queryPageTitle(pageTitle); | |
134 | 130 | } |
135 | 131 | |
136 | 132 | /** |
@@ -139,8 +135,24 @@ public class WikiEngine { | ||
139 | 135 | * @return HashMap<String, PageData> |
140 | 136 | * @throws Exception |
141 | 137 | */ |
142 | - public HashMap<String, PageData> queryFullTextSearch(String searchKey) throws Exception { | |
143 | - return wikiRepository_.queryFullTextSearch(searchKey); | |
138 | + public HashMap<String, PageData> queryPageFullTextSearch(String searchKey) throws Exception { | |
139 | + return wikiRepository_.queryPageFullTextSearch(searchKey); | |
140 | + } | |
141 | + | |
142 | + /** | |
143 | + * NamespaceList getter. | |
144 | + * @return ArrayList<String> | |
145 | + * @throws Exception | |
146 | + */ | |
147 | + public ArrayList<String> getNamespaceList() throws Exception { | |
148 | + ArrayList<String> namespaceList = new ArrayList<String>(); | |
149 | + Value[] namespaces = wikiRepository_.getNamespaceList(); | |
150 | + | |
151 | + for(Value value: namespaces) { | |
152 | + namespaceList.add(value.getString()); | |
153 | + } | |
154 | + | |
155 | + return namespaceList; | |
144 | 156 | } |
145 | 157 | |
146 | 158 | /** |
@@ -271,7 +283,7 @@ public class WikiEngine { | ||
271 | 283 | */ |
272 | 284 | public String fullTextSearch(String key) throws Exception { |
273 | 285 | StringBuffer htmlBuffer = new StringBuffer(""); |
274 | - HashMap<String, PageData> pageDataMap = wikiRepository_.queryFullTextSearch(key); | |
286 | + HashMap<String, PageData> pageDataMap = wikiRepository_.queryPageFullTextSearch(key); | |
275 | 287 | Set<String> uuids = pageDataMap.keySet(); |
276 | 288 | ResourceBundle resources = ResourceBundle.getBundle("com.wiki.standalone.moxkiriya.resources.moxkiriya"); |
277 | 289 |
@@ -279,7 +291,7 @@ public class WikiEngine { | ||
279 | 291 | if(pageDataMap.size() == 1) { |
280 | 292 | Set<String> identifier = pageDataMap.keySet(); |
281 | 293 | PageData pagaData = pageDataMap.get(identifier.iterator().next()); |
282 | - setPageTitle(pagaData.getTitle(), pageDataMap); | |
294 | + setCurrentPage(pagaData.getTitle(), pageDataMap); | |
283 | 295 | htmlBuffer.append(parse()); |
284 | 296 | } |
285 | 297 | else { |
@@ -295,14 +307,14 @@ public class WikiEngine { | ||
295 | 307 | htmlBuffer.append("<h3>" |
296 | 308 | + "<a href=" |
297 | 309 | + "\"" + pageData.getTitle() + "\" " |
298 | - + WikiInternalLinkInlineParser.JCR_UUID + "=" | |
310 | + + ATTRIBUTE_JCR_UUID + "=" | |
299 | 311 | + "\"" + uuid + "\">" |
300 | 312 | + pageData.getTitle() |
301 | 313 | + "</h3>\\n"); |
302 | 314 | /* |
303 | 315 | * 冒頭の256文字を表示する |
304 | 316 | */ |
305 | - String content = pageData.getContent().substring(0, 255); | |
317 | + String content = pageData.getIntroduction(); | |
306 | 318 | htmlBuffer.append(content); |
307 | 319 | } |
308 | 320 | } |
@@ -44,7 +44,7 @@ | ||
44 | 44 | </AnchorPane> |
45 | 45 | <AnchorPane id="AnchorPane" fx:id="AnchorPaneWebView" prefHeight="380.0" prefWidth="590.0" visible="true" AnchorPane.bottomAnchor="70.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="75.0"> |
46 | 46 | <children> |
47 | - <AnchorPane id="AnchorPane" fx:id="webViewMenuAnchorPane" prefHeight="45.0" prefWidth="590.0" visible="false" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> | |
47 | + <AnchorPane id="AnchorPane" fx:id="webViewMenuAnchorPane" prefHeight="45.0" prefWidth="590.0" visible="true" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> | |
48 | 48 | <children> |
49 | 49 | <Button id="webViewMenuAn" fx:id="webViewMenuAnchorPaneButtonBack" disable="true" maxHeight="-Infinity" maxWidth="-Infinity" mnemonicParsing="false" onAction="#onActionButtonBack" prefHeight="35.0" prefWidth="45.0" style="" text="⇦" AnchorPane.leftAnchor="150.0" AnchorPane.topAnchor="4.0"> |
50 | 50 | <font> |
@@ -79,7 +79,25 @@ | ||
79 | 79 | </AnchorPane> |
80 | 80 | <AnchorPane fx:id="AnchorPaneContentList" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="535.0" prefWidth="590.0" visible="false" AnchorPane.bottomAnchor="70.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="73.0"> |
81 | 81 | <children> |
82 | - <TreeView id="treeView" fx:id="TreeViewContentList" prefHeight="487.0" prefWidth="414.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="-1.0" AnchorPane.topAnchor="50.0" /> | |
82 | + <Label maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="30.0" prefWidth="100.0" text="%key.PageList.Label.Namespace" AnchorPane.leftAnchor="150.0" AnchorPane.topAnchor="80.0" /> | |
83 | + <ComboBox fx:id="comboBoxNamespace" prefHeight="25.0" prefWidth="150.0" AnchorPane.leftAnchor="250.0" AnchorPane.topAnchor="82.0"> | |
84 | + <items> | |
85 | + <FXCollections fx:factory="observableArrayList"> | |
86 | + <String fx:value="アイテム1" /> | |
87 | + <String fx:value="アイテム2" /> | |
88 | + <String fx:value="アイテム3" /> | |
89 | + </FXCollections> | |
90 | + </items> | |
91 | + </ComboBox> | |
92 | + <Hyperlink fx:id="hyperlinkRedraw" onMouseClicked="#onMouseClickedHyperlinkRedraw" prefHeight="30.0" prefWidth="-1.0" text="%key.PageList.Label.Redraw" AnchorPane.leftAnchor="410.0" AnchorPane.topAnchor="80.0" /> | |
93 | + <TableView id="TableViewContentList" fx:id="tableViewContentList" editable="true" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="400.0" prefWidth="825.0" AnchorPane.bottomAnchor="50.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="110.0"> | |
94 | + <columns> | |
95 | + <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="45.0" styleClass="-fx-alignment: center;" text="" fx:id="tableColumnCheck" /> | |
96 | + <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="190.0" text="%key.Table.Row.Title" fx:id="tableColumnTitle" /> | |
97 | + <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="540.0" text="%key.Table.Row.Content" fx:id="tableColumnContent" /> | |
98 | + <TableColumn prefWidth="50.0" text="%key.Table.Row.Refs" fx:id="tableColumnRefs" /> | |
99 | + </columns> | |
100 | + </TableView> | |
83 | 101 | </children> |
84 | 102 | </AnchorPane> |
85 | 103 | <AnchorPane id="EditAnchorPane" fx:id="AnchorPaneEdit" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="450.0" prefWidth="590.0" visible="false" AnchorPane.bottomAnchor="70.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="75.0"> |
@@ -92,7 +110,7 @@ | ||
92 | 110 | <Button fx:id="buttonCancel" mnemonicParsing="false" onAction="#onActionButtonCancel" prefWidth="90.0" text="%key.Button.Cancel" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0" /> |
93 | 111 | <TextField disable="true" prefHeight="30.0" prefWidth="716.0" promptText="%key.Edit.TextField.InputPathname" AnchorPane.bottomAnchor="37.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="120.0" AnchorPane.topAnchor="470.0" /> |
94 | 112 | <Label disable="true" prefHeight="30.0" prefWidth="166.0" text="%key.Edit.Label.AttachFile" AnchorPane.bottomAnchor="65.0" AnchorPane.leftAnchor="152.0" AnchorPane.topAnchor="440.0" /> |
95 | - <Button disable="true" mnemonicParsing="false" prefHeight="30.0" prefWidth="45.0" text="..." AnchorPane.bottomAnchor="35.0" AnchorPane.leftAnchor="874.0" AnchorPane.rightAnchor="55.0" AnchorPane.topAnchor="470.0" /> | |
113 | + <Button disable="true" mnemonicParsing="false" prefHeight="30.0" prefWidth="45.0" text="..." AnchorPane.bottomAnchor="35.0" AnchorPane.rightAnchor="55.0" /> | |
96 | 114 | </children> |
97 | 115 | </AnchorPane> |
98 | 116 | </children> |
@@ -12,8 +12,6 @@ import java.net.URLDecoder; | ||
12 | 12 | import java.util.ArrayList; |
13 | 13 | import java.util.HashMap; |
14 | 14 | import java.util.ResourceBundle; |
15 | -import java.util.Set; | |
16 | - | |
17 | 15 | |
18 | 16 | import org.w3c.dom.Document; |
19 | 17 | import org.w3c.dom.NodeList; |
@@ -26,7 +24,6 @@ import com.wiki.standalone.moxkiriya.dialog.AboutMoxkiriyaDialog; | ||
26 | 24 | import com.wiki.standalone.moxkiriya.dialog.AlertDialog; |
27 | 25 | import com.wiki.standalone.moxkiriya.dialog.DialogBase; |
28 | 26 | import com.wiki.standalone.moxkiriya.dialog.EditAttachFilesDialog; |
29 | -import com.wiki.standalone.moxkiriya.parser.inlineparser.WikiInternalLinkInlineParser; | |
30 | 27 | |
31 | 28 | import javafx.beans.value.ChangeListener; |
32 | 29 | import javafx.beans.value.ObservableValue; |
@@ -38,13 +35,19 @@ import javafx.event.Event; | ||
38 | 35 | import javafx.event.EventHandler; |
39 | 36 | import javafx.fxml.FXML; |
40 | 37 | import javafx.fxml.Initializable; |
38 | +import javafx.geometry.Pos; | |
41 | 39 | import javafx.scene.control.Button; |
40 | +import javafx.scene.control.CheckBox; | |
41 | +import javafx.scene.control.ComboBox; | |
42 | 42 | import javafx.scene.control.Hyperlink; |
43 | 43 | import javafx.scene.control.MenuItem; |
44 | +import javafx.scene.control.TableCell; | |
45 | +import javafx.scene.control.TableColumn; | |
46 | +import javafx.scene.control.TableView; | |
44 | 47 | import javafx.scene.control.TextArea; |
45 | 48 | import javafx.scene.control.TextField; |
46 | -import javafx.scene.control.TreeItem; | |
47 | -import javafx.scene.control.TreeView; | |
49 | +import javafx.scene.control.cell.CheckBoxTableCell; | |
50 | +import javafx.scene.control.cell.PropertyValueFactory; | |
48 | 51 | import javafx.scene.image.ImageView; |
49 | 52 | import javafx.scene.layout.AnchorPane; |
50 | 53 | import javafx.scene.web.WebEngine; |
@@ -53,6 +56,7 @@ import javafx.stage.FileChooser; | ||
53 | 56 | import javafx.stage.Modality; |
54 | 57 | import javafx.stage.Stage; |
55 | 58 | import javafx.stage.StageStyle; |
59 | +import javafx.util.Callback; | |
56 | 60 | |
57 | 61 | /** |
58 | 62 | * MainWindowコントローラ |
@@ -110,7 +114,13 @@ public class WikiMainWindowController implements Initializable { | ||
110 | 114 | * AnchorPaneContentList controls. |
111 | 115 | */ |
112 | 116 | @FXML private AnchorPane AnchorPaneContentList; |
113 | - @FXML private TreeView<String> TreeViewContentList; | |
117 | + @FXML private ComboBox<String> comboBoxNamespace; | |
118 | + @FXML private Hyperlink hyperlinkRedraw; | |
119 | + @FXML private TableView<PageData> tableViewContentList; | |
120 | + @FXML private TableColumn<PageData, String> tableColumnCheck; | |
121 | + @FXML private TableColumn<PageData, String> tableColumnTitle; | |
122 | + @FXML private TableColumn<PageData, String> tableColumnContent; | |
123 | + @FXML private TableColumn<PageData, String> tableColumnRefs; | |
114 | 124 | |
115 | 125 | /* |
116 | 126 | * その他 |
@@ -131,30 +141,64 @@ public class WikiMainWindowController implements Initializable { | ||
131 | 141 | /** edit mode.*/ |
132 | 142 | private EditMode editMode_ = EditMode.NONE; |
133 | 143 | |
134 | - /** | |
135 | - * カテゴリーコンボボックスのアイテム | |
136 | - */ | |
137 | - public class ComboBoxCategoryItem extends File { | |
138 | - private static final long serialVersionUID = 1L; | |
139 | - | |
140 | - /** | |
141 | - * コンストラクタ | |
142 | - * @param pathname | |
143 | - */ | |
144 | - public ComboBoxCategoryItem(String pathname) { | |
145 | - super(pathname); | |
146 | - } | |
147 | - | |
148 | - @Override | |
149 | - public String toString() { | |
150 | - return super.getName(); | |
151 | - } | |
152 | - } | |
153 | - | |
154 | 144 | @Override |
155 | 145 | public void initialize(URL url, ResourceBundle resourceBundle) { |
156 | 146 | resourceBundle_ = resourceBundle; |
157 | 147 | setLinkClickListner(webView.getEngine()); |
148 | + | |
149 | + tableColumnCheck.setCellFactory(new Callback<TableColumn<PageData, String>, TableCell<PageData, String>>() { | |
150 | + @Override | |
151 | + public TableCell<PageData, String> call(TableColumn<PageData, String> arg0) { | |
152 | + CheckBoxTableCell<PageData, String> tableCell = new CheckBoxTableCell<PageData, String>(); | |
153 | + | |
154 | + tableCell.setAlignment(Pos.CENTER); | |
155 | + | |
156 | + return tableCell; | |
157 | + } | |
158 | + }); | |
159 | + | |
160 | + tableColumnTitle.setCellFactory(new Callback<TableColumn<PageData, String>, TableCell<PageData, String>>() { | |
161 | + @Override | |
162 | + public TableCell<PageData, String> call(TableColumn<PageData, String> param) { | |
163 | + TableCell<PageData, String> | |
164 | + tableCell = new TableCell<PageData, String>() { | |
165 | + @Override | |
166 | + public void updateItem(String uuid, boolean empty) { | |
167 | + super.updateItem(uuid, empty); | |
168 | + if(empty != true) { | |
169 | + try { | |
170 | + HashMap<String, PageData> pageMap = wikiEngine_.queryPageUUID(uuid); | |
171 | + PageData pageData = pageMap.get(uuid); | |
172 | + Hyperlink hyperlink = new Hyperlink(pageData.getTitle()); | |
173 | + | |
174 | + hyperlink.setUserData(pageData); | |
175 | + hyperlink.setOnMouseClicked(new EventHandler<Event>() { | |
176 | + @Override | |
177 | + public void handle(Event event) { | |
178 | + Hyperlink source = (Hyperlink)event.getSource(); | |
179 | + PageData pageData = (PageData)source.getUserData(); | |
180 | + | |
181 | + menuItemNew.setDisable(false); | |
182 | + wikiEngine_.setCurrentPage(pageData); | |
183 | + loadWikiContent(); | |
184 | + | |
185 | + AnchorPaneEdit.setVisible(false); | |
186 | + AnchorPaneContentList.setVisible(false); | |
187 | + AnchorPaneWebView.setVisible(true); | |
188 | + } | |
189 | + }); | |
190 | + | |
191 | + setGraphic(hyperlink); | |
192 | + } catch (Exception e) { | |
193 | + e.printStackTrace(); | |
194 | + } | |
195 | + } | |
196 | + } | |
197 | + }; | |
198 | + | |
199 | + return tableCell; | |
200 | + } | |
201 | + }); | |
158 | 202 | } |
159 | 203 | |
160 | 204 | /** |
@@ -271,7 +315,7 @@ public class WikiMainWindowController implements Initializable { | ||
271 | 315 | if(pageTitle != null) { |
272 | 316 | menuItemNew.setDisable(false); |
273 | 317 | |
274 | - wikiEngine_.setPageTitle(pageTitle); | |
318 | + wikiEngine_.setCurrentPage(pageTitle); | |
275 | 319 | loadWikiContent(); |
276 | 320 | |
277 | 321 | AnchorPaneEdit.setVisible(false); |
@@ -306,15 +350,9 @@ public class WikiMainWindowController implements Initializable { | ||
306 | 350 | editMode_ = EditMode.NONE; |
307 | 351 | wikiEngine_.cancelCheckout(); |
308 | 352 | |
309 | - TreeItem<String> root = new TreeItem<String>("Main", null); | |
310 | - root.setExpanded(true); | |
311 | - ObservableList<TreeItem<String>> children = buildContentsTree(WikiRepository.PROPERTY_MAIN); | |
312 | - if(children != null) { | |
313 | - root.getChildren().addAll(children); | |
314 | - } | |
315 | - | |
316 | - TreeViewContentList.rootProperty().setValue(root); | |
317 | - | |
353 | + buildComboBoxNamespace(); | |
354 | + | |
355 | + buildTableViewPageList(); | |
318 | 356 | AnchorPaneWebView.setVisible(false); |
319 | 357 | AnchorPaneEdit.setVisible(false); |
320 | 358 | AnchorPaneContentList.setVisible(true); |
@@ -346,13 +384,21 @@ public class WikiMainWindowController implements Initializable { | ||
346 | 384 | @FXML |
347 | 385 | public void onActionButtonHome(ActionEvent event) { |
348 | 386 | try { |
349 | - wikiEngine_.setPageTitle(WikiEngine.MAINPAGE_TITLE); | |
387 | + wikiEngine_.setCurrentPage(WikiEngine.MAINPAGE_TITLE); | |
350 | 388 | loadWikiContent(); |
351 | 389 | } catch (Exception e) { |
352 | 390 | e.printStackTrace(); |
353 | 391 | } |
354 | 392 | } |
355 | 393 | |
394 | + @FXML | |
395 | + public void onMouseClickedHyperlinkRedraw() { | |
396 | + try { | |
397 | + buildTableViewPageList(); | |
398 | + } catch (Exception e) { | |
399 | + e.printStackTrace(); | |
400 | + } | |
401 | + } | |
356 | 402 | |
357 | 403 | @FXML |
358 | 404 | public void onMouseClickedHyperlinkEditAttachFiles() { |
@@ -514,59 +560,6 @@ public class WikiMainWindowController implements Initializable { | ||
514 | 560 | } |
515 | 561 | |
516 | 562 | /** |
517 | - * Contents treeを構築する。 | |
518 | - * param namespace | |
519 | - * @return ObservableLis | |
520 | - * @throws Exception | |
521 | - */ | |
522 | - private ObservableList<TreeItem<String>> buildContentsTree(String namespace) | |
523 | - throws Exception { | |
524 | - ObservableList<TreeItem<String>> list = FXCollections.observableArrayList(); | |
525 | - HashMap<String, PageData> pageDataMap = wikiEngine_.queryNodeNamespace(namespace); | |
526 | - Set<String> keys = pageDataMap.keySet(); | |
527 | - | |
528 | - for(String key: keys) { | |
529 | - PageData pageData = pageDataMap.get(key); | |
530 | - Hyperlink hyperlink = new Hyperlink(pageData.getTitle()); | |
531 | - | |
532 | - hyperlink.setPrefWidth(128); | |
533 | - hyperlink.setUserData(key); | |
534 | - hyperlink.setOnMouseClicked(new EventHandler<Event>() { | |
535 | - public void handle(Event event) { | |
536 | - try { | |
537 | - Hyperlink source = (Hyperlink)event.getSource(); | |
538 | - String title = source.getText(); | |
539 | - String identifier = (String)source.getUserData(); | |
540 | - | |
541 | - wikiEngine_.setPageTitle(title, identifier, null); | |
542 | - menuItemNew.setDisable(false); | |
543 | - loadWikiContent(); | |
544 | - | |
545 | - /* | |
546 | - * PaneをWebViewAnchorPaneに切り替える。 | |
547 | - */ | |
548 | - AnchorPaneContentList.setVisible(false); | |
549 | - AnchorPaneWebView.setVisible(true); | |
550 | - } catch (Exception e) { | |
551 | - e.printStackTrace(); | |
552 | - } | |
553 | - } | |
554 | - }); | |
555 | - | |
556 | - String content = pageData.getContent(); | |
557 | - int length = Math.min(content.length() - 1, 255); | |
558 | - | |
559 | - TreeItem<String> treeItem = new TreeItem<String>(); | |
560 | - treeItem.setGraphic(hyperlink); | |
561 | - treeItem.setValue(content.substring(0, length)); | |
562 | - | |
563 | - list.add(treeItem); | |
564 | - } | |
565 | - | |
566 | - return list; | |
567 | - } | |
568 | - | |
569 | - /** | |
570 | 563 | * webViewを取得する。 |
571 | 564 | * @return webView |
572 | 565 | */ |
@@ -588,6 +581,7 @@ public class WikiMainWindowController implements Initializable { | ||
588 | 581 | */ |
589 | 582 | private String getSelectingPageTitle() { |
590 | 583 | String title = wikiEngine_.getPageTitle(); |
584 | + /* | |
591 | 585 | if(AnchorPaneContentList.isVisible() == true) { |
592 | 586 | TreeItem<String> item = TreeViewContentList.getFocusModel().getFocusedItem(); |
593 | 587 | if(item != null) { |
@@ -597,146 +591,187 @@ public class WikiMainWindowController implements Initializable { | ||
597 | 591 | else if(AnchorPaneEdit.isVisible() == true) { |
598 | 592 | title = textFieldTitle.getText(); |
599 | 593 | } |
594 | + */ | |
600 | 595 | |
601 | 596 | return title; |
602 | 597 | } |
603 | - | |
598 | + | |
599 | + /** | |
600 | + * Build a namespace comboBox. | |
601 | + * @throws Exception | |
602 | + */ | |
603 | + private void buildComboBoxNamespace() throws Exception { | |
604 | + ArrayList<String> namespaceList = wikiEngine_.getNamespaceList(); | |
605 | + ObservableList<String> items = comboBoxNamespace.getItems(); | |
606 | + | |
607 | + items.clear(); | |
608 | + for(int index = 0; index < namespaceList.size(); index++) { | |
609 | + String item = namespaceList.get(index); | |
610 | + items.add(item); | |
611 | + | |
612 | + if(item.equals(WikiRepository.PROPERTY_MAIN) == true) { | |
613 | + comboBoxNamespace.getSelectionModel().select(index); | |
614 | + } | |
615 | + } | |
616 | + } | |
617 | + | |
618 | + /* | |
619 | + @FXML private TableColumn tableColumnCheck; | |
620 | + @FXML private TableColumn tableColumnTitle; | |
621 | + @FXML private TableColumn tableColumnContent; | |
622 | + @FXML private TableColumn tableColumnRefs; | |
623 | + */ | |
624 | + | |
625 | + private void buildTableViewPageList() throws Exception { | |
626 | + String namespace = comboBoxNamespace.getSelectionModel().getSelectedItem(); | |
627 | + HashMap<String, PageData> pageMap = wikiEngine_.queryPageNamespace(namespace); | |
628 | + ObservableList<PageData> observableList = FXCollections.observableArrayList(); | |
629 | + | |
630 | + tableColumnCheck.setGraphic(new CheckBox()); | |
631 | + tableColumnCheck.setCellValueFactory(new PropertyValueFactory<PageData, String>("uuid")); | |
632 | + tableColumnTitle.setCellValueFactory(new PropertyValueFactory<PageData, String>("uuid")); | |
633 | + tableColumnContent.setCellValueFactory(new PropertyValueFactory<PageData, String>("introduction")); | |
634 | + | |
635 | + for(String key: pageMap.keySet()) { | |
636 | + observableList.add(pageMap.get(key)); | |
637 | + } | |
638 | + tableViewContentList.setItems(observableList); | |
639 | + } | |
640 | + | |
604 | 641 | /** |
605 | 642 | * A要素のクリックリスナーを登録する。 |
606 | 643 | * @param webEngine |
607 | 644 | */ |
608 | 645 | private void setLinkClickListner(WebEngine webEngine) { |
609 | - webEngine.getLoadWorker().stateProperty().addListener( | |
610 | - new ChangeListener<State>() { | |
611 | - | |
612 | - @Override | |
613 | - public void changed(ObservableValue<? extends State> arg0, State oldState, State newState) { | |
614 | - WebView webView = getWebView(); | |
615 | - EventListener listener = new EventListener() { | |
616 | - @Override | |
617 | - public void handleEvent(org.w3c.dom.events.Event event) { | |
618 | - try { | |
619 | - MouseEvent mouseEvent = (MouseEvent)event; | |
620 | - EventTarget target = mouseEvent.getCurrentTarget(); | |
621 | - if(isExternalLink(target) == true) { | |
622 | - /* | |
623 | - * WebEngineのデフォルトの動作(リンク先ページをロード)をキャンセル | |
624 | - */ | |
625 | - event.preventDefault(); | |
626 | - externalLinkHandle(target); | |
627 | - } | |
628 | - else { | |
629 | - internalLinkHandle(target); | |
630 | - } | |
631 | - } catch (Exception e) { | |
632 | - e.printStackTrace(); | |
646 | + webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() { | |
647 | + @Override | |
648 | + public void changed(ObservableValue<? extends State> arg0, State oldState, State newState) { | |
649 | + WebView webView = getWebView(); | |
650 | + EventListener listener = new EventListener() { | |
651 | + @Override | |
652 | + public void handleEvent(org.w3c.dom.events.Event event) { | |
653 | + try { | |
654 | + MouseEvent mouseEvent = (MouseEvent)event; | |
655 | + EventTarget target = mouseEvent.getCurrentTarget(); | |
656 | + if(isExternalLink(target) == true) { | |
657 | + /* | |
658 | + * WebEngineのデフォルトの動作(リンク先ページをロード)をキャンセル | |
659 | + */ | |
660 | + event.preventDefault(); | |
661 | + externalLinkHandle(target); | |
633 | 662 | } |
663 | + else { | |
664 | + internalLinkHandle(target); | |
665 | + } | |
666 | + } catch (Exception e) { | |
667 | + e.printStackTrace(); | |
634 | 668 | } |
669 | + } | |
635 | 670 | |
636 | - /** | |
637 | - * targetが外部リンクか判定する。 | |
638 | - * @param target | |
639 | - * @return | |
640 | - */ | |
641 | - private boolean isExternalLink(EventTarget target) { | |
642 | - final ArrayList<String> schemeList = new ArrayList<String>() { | |
643 | - private static final long serialVersionUID = 1L; | |
644 | - { add("http://"); } | |
645 | - { add("https://"); } | |
646 | - { add("file://"); } | |
647 | - }; | |
648 | - | |
649 | - boolean isExternal = false; | |
650 | - | |
651 | - for(String scheme: schemeList) { | |
652 | - if(target.toString().startsWith(scheme) == true) { | |
653 | - isExternal = true; | |
654 | - break; | |
655 | - } | |
671 | + /** | |
672 | + * targetが外部リンクか判定する。 | |
673 | + * @param target | |
674 | + * @return | |
675 | + */ | |
676 | + private boolean isExternalLink(EventTarget target) { | |
677 | + final ArrayList<String> schemeList = new ArrayList<String>() { | |
678 | + private static final long serialVersionUID = 1L; | |
679 | + { add("http://"); } | |
680 | + { add("https://"); } | |
681 | + { add("file://"); } | |
682 | + }; | |
683 | + | |
684 | + boolean isExternal = false; | |
685 | + | |
686 | + for(String scheme: schemeList) { | |
687 | + if(target.toString().startsWith(scheme) == true) { | |
688 | + isExternal = true; | |
689 | + break; | |
656 | 690 | } |
657 | - | |
658 | - return isExternal; | |
659 | 691 | } |
660 | 692 | |
661 | - /** | |
662 | - * ExternalLinkを処理する。 | |
663 | - * @param target | |
664 | - * @throws Exception | |
693 | + return isExternal; | |
694 | + } | |
695 | + | |
696 | + /** | |
697 | + * ExternalLinkを処理する。 | |
698 | + * @param target | |
699 | + * @throws Exception | |
700 | + */ | |
701 | + private void externalLinkHandle(EventTarget target) throws Exception { | |
702 | + String targetpath = target.toString(); | |
703 | + if(targetpath.startsWith("file:///") == true) { | |
704 | + targetpath = URLDecoder.decode(targetpath, "UTF-8"); | |
705 | + } | |
706 | + /* | |
707 | + * 既定のブラウザを起動してリンク先ページを開く | |
665 | 708 | */ |
666 | - private void externalLinkHandle(EventTarget target) throws Exception { | |
667 | - String targetpath = target.toString(); | |
668 | - if(targetpath.startsWith("file:///") == true) { | |
669 | - targetpath = URLDecoder.decode(targetpath, "UTF-8"); | |
670 | - } | |
709 | + Desktop.getDesktop().browse(new URI(targetpath)); | |
710 | + } | |
711 | + | |
712 | + /** | |
713 | + * InternalLinkを処理する。 | |
714 | + * @param target | |
715 | + * @throws Exception | |
716 | + */ | |
717 | + private void internalLinkHandle(EventTarget target) throws Exception { | |
718 | + String pageTitle = URLDecoder.decode(target.toString(), "UTF-8"); | |
719 | + | |
720 | + HTMLAnchorElement anchor = (HTMLAnchorElement)target; | |
721 | + String uuid = anchor.getAttribute(WikiEngine.ATTRIBUTE_JCR_UUID); | |
722 | + HashMap<String, PageData> pageDataMap; | |
723 | + if(uuid != null) { | |
724 | + pageDataMap = wikiEngine_.queryPageUUID(uuid); | |
725 | + } | |
726 | + else { | |
727 | + pageDataMap = wikiEngine_.queryPageTitle(pageTitle); | |
728 | + } | |
729 | + if(pageDataMap.size() == 1) { | |
730 | + wikiEngine_.setCurrentPage(pageTitle, pageDataMap); | |
731 | + loadWikiContent(); | |
732 | + } | |
733 | + else { | |
734 | + File linkpath = new File(pageTitle); | |
735 | + | |
671 | 736 | /* |
672 | - * 既定のブラウザを起動してリンク先ページを開く | |
737 | + * リンク先にファイルが存在しない場合 | |
738 | + * 編集画面へ遷移 | |
673 | 739 | */ |
674 | - Desktop.getDesktop().browse(new URI(targetpath)); | |
675 | - } | |
740 | + String absoluteLinkpath = linkpath.getAbsolutePath(); | |
676 | 741 | |
677 | - /** | |
678 | - * InternalLinkを処理する。 | |
679 | - * @param target | |
680 | - * @throws Exception | |
681 | - */ | |
682 | - private void internalLinkHandle(EventTarget target) throws Exception { | |
683 | - String pageTitle = URLDecoder.decode(target.toString(), "UTF-8"); | |
684 | - | |
685 | - HTMLAnchorElement anchor = (HTMLAnchorElement)target; | |
686 | - String uuid = anchor.getAttribute(WikiInternalLinkInlineParser.JCR_UUID); | |
687 | - HashMap<String, PageData> pageDataMap; | |
688 | - if(uuid != null) { | |
689 | - pageDataMap = wikiEngine_.queryNodePageUUID(uuid); | |
690 | - } | |
691 | - else { | |
692 | - pageDataMap = wikiEngine_.queryNodePageTitle(pageTitle); | |
693 | - } | |
694 | - if(pageDataMap.size() == 1) { | |
695 | - wikiEngine_.setPageTitle(pageTitle, pageDataMap); | |
696 | - loadWikiContent(); | |
742 | + if(absoluteLinkpath.contains("\\attaches")) { | |
743 | + /* | |
744 | + * 添付ファイルのパス名の場合 | |
745 | + */ | |
746 | + String contentDir = absoluteLinkpath.substring(0, absoluteLinkpath.lastIndexOf("\\attaches")); | |
747 | + EditAttachFilesDialog dialog = new EditAttachFilesDialog(new File(contentDir)); | |
748 | + dialog.showDialog(primaryStage_, resourceBundle_); | |
697 | 749 | } |
698 | - else { | |
699 | - File linkpath = new File(pageTitle); | |
700 | - | |
750 | + else if(target.toString().contains("#")) { | |
701 | 751 | /* |
702 | - * リンク先にファイルが存在しない場合 | |
703 | - * 編集画面へ遷移 | |
752 | + * ページ内セクションリンク | |
704 | 753 | */ |
705 | - String absoluteLinkpath = linkpath.getAbsolutePath(); | |
706 | - | |
707 | - if(absoluteLinkpath.contains("\\attaches")) { | |
708 | - /* | |
709 | - * 添付ファイルのパス名の場合 | |
710 | - */ | |
711 | - String contentDir = absoluteLinkpath.substring(0, absoluteLinkpath.lastIndexOf("\\attaches")); | |
712 | - EditAttachFilesDialog dialog = new EditAttachFilesDialog(new File(contentDir)); | |
713 | - dialog.showDialog(primaryStage_, resourceBundle_); | |
714 | - } | |
715 | - else if(target.toString().contains("#")) { | |
716 | - /* | |
717 | - * ページ内セクションリンク | |
718 | - */ | |
719 | - jumpToSectionLink(target); | |
720 | - } | |
721 | - else { | |
722 | - buildEditView(target.toString()); | |
723 | - } | |
754 | + jumpToSectionLink(target); | |
755 | + } | |
756 | + else { | |
757 | + buildEditView(target.toString()); | |
724 | 758 | } |
725 | - | |
726 | 759 | } |
727 | - }; | |
728 | - | |
729 | - if(newState == State.SUCCEEDED) { | |
730 | - Document doc = webView.getEngine().getDocument(); | |
731 | - NodeList listA = doc.getElementsByTagName("a"); | |
732 | - | |
733 | - for(int index = 0; index < listA.getLength(); index++) { | |
734 | - ((EventTarget)listA.item(index)).addEventListener("click", listener, false); | |
735 | - } | |
736 | - getImageViewLoading().setVisible(false); | |
737 | - webView.setVisible(true); | |
760 | + | |
738 | 761 | } |
762 | + }; | |
763 | + | |
764 | + if(newState == State.SUCCEEDED) { | |
765 | + Document doc = webView.getEngine().getDocument(); | |
766 | + NodeList listA = doc.getElementsByTagName("a"); | |
767 | + | |
768 | + for(int index = 0; index < listA.getLength(); index++) { | |
769 | + ((EventTarget)listA.item(index)).addEventListener("click", listener, false); | |
770 | + } | |
771 | + getImageViewLoading().setVisible(false); | |
772 | + webView.setVisible(true); | |
739 | 773 | } |
740 | - }); | |
774 | + } | |
775 | + }); | |
741 | 776 | } |
742 | 777 | } |
@@ -231,7 +231,7 @@ public class WikiRepository { | ||
231 | 231 | * @return HashMap<String, PageData> |
232 | 232 | * @throws Exception |
233 | 233 | */ |
234 | - public HashMap<String, PageData> queryNodeNamespace(String namespace) throws Exception { | |
234 | + public HashMap<String, PageData> queryPageNamespace(String namespace) throws Exception { | |
235 | 235 | Query query = queryMgr_.createQuery( |
236 | 236 | "SELECT * " |
237 | 237 | + " FROM [nt:unstructured]" |
@@ -253,7 +253,7 @@ public class WikiRepository { | ||
253 | 253 | * @return HashMap<String, PageData> |
254 | 254 | * @throws Exception |
255 | 255 | */ |
256 | - public HashMap<String, PageData> queryNodePageUUID(String uuid) throws Exception { | |
256 | + public HashMap<String, PageData> queryPageUUID(String uuid) throws Exception { | |
257 | 257 | Query query = queryMgr_.createQuery( |
258 | 258 | "SELECT * " |
259 | 259 | + " FROM [nt:unstructured]" |
@@ -276,7 +276,7 @@ public class WikiRepository { | ||
276 | 276 | * @return HashMap<String, PageData> |
277 | 277 | * @throws Exception |
278 | 278 | */ |
279 | - public HashMap<String, PageData> queryNodePageTitle(String pageTitle) throws Exception { | |
279 | + public HashMap<String, PageData> queryPageTitle(String pageTitle) throws Exception { | |
280 | 280 | String namespace = PROPERTY_MAIN; |
281 | 281 | String title = pageTitle; |
282 | 282 |
@@ -309,7 +309,7 @@ public class WikiRepository { | ||
309 | 309 | * @return String |
310 | 310 | * @throws Exception |
311 | 311 | */ |
312 | - public HashMap<String, PageData> queryFullTextSearch(String searchKey) throws Exception { | |
312 | + public HashMap<String, PageData> queryPageFullTextSearch(String searchKey) throws Exception { | |
313 | 313 | Query query = queryMgr_.createQuery( |
314 | 314 | "SELECT * " |
315 | 315 | + " FROM [nt:unstructured]" |
@@ -341,6 +341,17 @@ public class WikiRepository { | ||
341 | 341 | |
342 | 342 | return pageDataMap; |
343 | 343 | } |
344 | + | |
345 | + /** | |
346 | + * NamespaceList getter | |
347 | + * @return Value[] | |
348 | + * @throws Exception | |
349 | + */ | |
350 | + public Value[] getNamespaceList() throws Exception { | |
351 | + Node namespace = session_.getNode("/" + NODE_WIKIROOT + "/" + NODE_NAMESPACE); | |
352 | + | |
353 | + return namespace.getProperty(PROPERTY_NAMESPACE).getValues(); | |
354 | + } | |
344 | 355 | |
345 | 356 | /** |
346 | 357 | * Now node setter. |
@@ -13,6 +13,7 @@ import javax.jcr.Property; | ||
13 | 13 | import org.apache.xerces.impl.dv.util.Base64; |
14 | 14 | |
15 | 15 | import com.wiki.standalone.moxkiriya.PageData; |
16 | +import com.wiki.standalone.moxkiriya.WikiEngine; | |
16 | 17 | import com.wiki.standalone.moxkiriya.WikiRepository; |
17 | 18 | import com.wiki.standalone.moxkiriya.util.FileTypeDeterminator; |
18 | 19 |
@@ -40,8 +41,8 @@ public class WikiInternalLinkInlineParser extends WikiInlineParserBase { | ||
40 | 41 | private static final String END_TAG = "</a>\n"; |
41 | 42 | |
42 | 43 | /** jcr_uuid 独自属性 */ |
43 | - public static final String JCR_UUID = "data-jcr_uuid"; | |
44 | - | |
44 | + public static final String ATTRIBUTE_JCR_UUID = WikiEngine.ATTRIBUTE_JCR_UUID; | |
45 | + | |
45 | 46 | /** img開始タグ */ |
46 | 47 | private static final String IMAGE_START_TAG = "<img src="; |
47 | 48 |
@@ -115,7 +116,7 @@ public class WikiInternalLinkInlineParser extends WikiInlineParserBase { | ||
115 | 116 | String mediaType = null; |
116 | 117 | StringBuffer databuf = new StringBuffer(""); |
117 | 118 | |
118 | - HashMap<String, PageData> pageDataMap = wikiRepository_.queryNodePageTitle(linkpath_); | |
119 | + HashMap<String, PageData> pageDataMap = wikiRepository_.queryPageTitle(linkpath_); | |
119 | 120 | PageData.FileData fileData = null; |
120 | 121 | |
121 | 122 | if(pageDataMap.size() > 0) { |
@@ -291,7 +292,7 @@ public class WikiInternalLinkInlineParser extends WikiInlineParserBase { | ||
291 | 292 | buf.append("\""); |
292 | 293 | buf.append(linkpath_ + "\" "); |
293 | 294 | |
294 | - HashMap<String, PageData> pageDataMap = wikiRepository_.queryNodePageTitle(linkpath_); | |
295 | + HashMap<String, PageData> pageDataMap = wikiRepository_.queryPageTitle(linkpath_); | |
295 | 296 | if(pageDataMap.size() == 0) { |
296 | 297 | buf.append(STYLE_CLASS_NOEXIST); |
297 | 298 | } |
@@ -299,7 +300,7 @@ public class WikiInternalLinkInlineParser extends WikiInlineParserBase { | ||
299 | 300 | Set<String> key = pageDataMap.keySet(); |
300 | 301 | PageData pageData = pageDataMap.get(key.iterator().next()); |
301 | 302 | Node node = pageData.getNode(); |
302 | - buf.append(" " + JCR_UUID + "=\""); | |
303 | + buf.append(" " + ATTRIBUTE_JCR_UUID + "=\""); | |
303 | 304 | buf.append(node.getProperty(Property.JCR_UUID).getString()); |
304 | 305 | buf.append("\""); |
305 | 306 | } |
@@ -44,6 +44,13 @@ key.Edit.TextField.InputPathname: - Input pathname - | ||
44 | 44 | key.Edit.ComboBox.Category.PromptText: - Select a category. - |
45 | 45 | key.Edit.ComboBox.Category.Item.None: None |
46 | 46 | |
47 | +key.PageList.Label.Namespace: Namespace: | |
48 | +key.PageList.Label.Redraw: Redraw | |
49 | +key.Table.Row.Select: Sel | |
50 | +key.Table.Row.Title: Title | |
51 | +key.Table.Row.Content: Content | |
52 | +key.Table.Row.Refs: Refs | |
53 | + | |
47 | 54 | key.webView.Hyperlink.Reload: Reload |
48 | 55 | |
49 | 56 | key.Dialog.Message.Cancel.Editing: Cancel editing? |