Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Redmine #186] - add the welcome tab on application startup

  • Loading branch information...
commit c653b5ab77da82f3531274c6ebe87df85f7ca6ac 1 parent 1f6198f
@kamilors kamilors authored
View
61 mongoui-fx/src/main/java/com/droidpark/mongoui/component/MongoUITab.java
@@ -0,0 +1,61 @@
+package com.droidpark.mongoui.component;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import com.droidpark.mongoui.util.Language;
+import com.droidpark.mongoui.util.LanguageConstants;
+
+import javafx.scene.control.Tab;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.web.WebView;
+
+public class MongoUITab extends Tab implements UITab {
+
+ AnchorPane pane;
+ WebView webView;
+
+ public MongoUITab() {
+ init();
+ }
+
+ private void init() {
+ pane = new AnchorPane();
+ webView = new WebView();
+ webView.prefHeightProperty().bind(pane.heightProperty());
+ webView.prefWidthProperty().bind(pane.widthProperty());
+ pane.getChildren().add(webView);
+ setContent(pane);
+ setText(Language.get(LanguageConstants.TAB_LABEL_WELCOME));
+ loadContent();
+ }
+
+ private void loadContent() {
+ String page = getStream("mongoui/welcome.html");
+ webView.getEngine().loadContent(page);
+ }
+
+ private String getStream(String file) {
+ try {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream(file);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+ StringBuilder builder = new StringBuilder();
+ String line = null;
+ while((line = reader.readLine()) != null) {
+ builder.append(line);
+ }
+ return builder.toString();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void destroy() {
+ webView.prefHeightProperty().unbind();
+ webView.prefWidthProperty().unbind();
+ }
+
+}
View
7 mongoui-fx/src/main/java/com/droidpark/mongoui/component/ResultTab.java
@@ -1,12 +1,9 @@
package com.droidpark.mongoui.component;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.apache.log4j.Logger;
import org.bson.types.ObjectId;
@@ -25,7 +22,6 @@
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
-import com.mongodb.util.JSON;
import static com.droidpark.mongoui.util.LanguageConstants.*;
@@ -44,8 +40,6 @@
import javafx.scene.control.Tab;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
-import javafx.scene.control.TextArea;
-import javafx.scene.control.TextField;
import javafx.scene.control.TitledPane;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
@@ -53,7 +47,6 @@
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
-import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.util.Callback;
View
13 mongoui-fx/src/main/java/com/droidpark/mongoui/form/MainForm.java
@@ -1,6 +1,5 @@
package com.droidpark.mongoui.form;
-import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -17,14 +16,10 @@
import javafx.scene.control.Accordion;
import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
-import javafx.scene.control.ContextMenu;
-import javafx.scene.control.Label;
-import javafx.scene.control.MenuItem;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.SplitPane;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
-import javafx.scene.control.TextField;
import javafx.scene.control.TitledPane;
import javafx.scene.control.ToolBar;
import javafx.scene.control.TreeItem;
@@ -34,15 +29,13 @@
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
-import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
-import javafx.scene.web.WebView;
import javafx.stage.Stage;
import static com.droidpark.mongoui.util.LanguageConstants.*;
-import com.droidpark.mongoui.component.ModalDialog;
+import com.droidpark.mongoui.component.MongoUITab;
import com.droidpark.mongoui.dialog.ConnectionDialog;
import com.droidpark.mongoui.dialog.ManageCollectionDialog;
import com.droidpark.mongoui.task.AddTabTask;
@@ -52,7 +45,6 @@
import com.droidpark.mongoui.util.DBTreeEnum;
import com.droidpark.mongoui.util.ImageUtil;
import com.droidpark.mongoui.util.Language;
-import com.droidpark.mongoui.util.LanguageConstants;
import com.droidpark.mongoui.util.Log4jTextAreaAppender;
import com.droidpark.mongoui.util.MongoUtil;
import com.droidpark.mongoui.util.Util;
@@ -60,7 +52,6 @@
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
-import com.mongodb.Mongo;
public class MainForm extends Application {
@@ -234,6 +225,8 @@ private void initTabPane() {
tabPane.prefWidthProperty().bind(centerPane.widthProperty());
tabPane.prefHeightProperty().bind(centerPane.heightProperty());
centerPane.getChildren().add(tabPane);
+ MongoUITab welcomeTab = new MongoUITab();
+ tabPane.getTabs().add(welcomeTab);
}
private void initToolBarButtons() {
View
2  mongoui-fx/src/main/java/com/droidpark/mongoui/util/LanguageConstants.java
@@ -42,4 +42,6 @@
public static final String LABEL_PORT = "label.port";
public static final String LABEL_USERNAME = "label.username";
public static final String LABEL_PASSWORD = "label.password";
+
+ public static final String TAB_LABEL_WELCOME = "tab.label.welcome";
}
View
3  mongoui-fx/src/main/java/com/droidpark/mongoui/util/MongoUtil.java
@@ -1,11 +1,8 @@
package com.droidpark.mongoui.util;
-import java.net.UnknownHostException;
-
import org.apache.log4j.Logger;
import com.mongodb.Mongo;
-import com.mongodb.MongoException;
public class MongoUtil {
View
4 mongoui-fx/src/main/resources/english.lang.properties
@@ -37,4 +37,6 @@ label.port=Port
label.username=Username
label.password=Password
-message.are_you_sure=Are you sure?
+message.are_you_sure=Are you sure?
+
+tab.label.welcome=MongoUI
View
34 mongoui-fx/src/main/resources/mongoui/welcome.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>MongoUI</title>
+ <style type="text/css">
+ body {font-size: 10pt; font-family: Tahoma; color: #333;}
+ .title {padding: 5px; border-bottom: 1px solid #ccc; font-weight: bold; color: #1b1b1b;}
+ .text {padding: 5px;}
+ </style>
+</head>
+<body>
+ <div class="content">
+ <div class="title">
+ Welcome to MongoUI
+ </div>
+ <div class="text">
+ The MongoUI an Administrator Tool for MongoDB. <br />
+ Can be management all mongodb functions. <br />
+ <ul>
+ <li>Database Management</li>
+ <li>User Management</li>
+ <li>Collection Management</li>
+ <li>Index Management</li>
+ <li>Document Management</li>
+ <li>Stored JavaScript Management</li>
+ <li>Sharding Tools</li>
+ <li>Server Status</li>
+ <li>Runnable Javascripts</li>
+ </ul>
+ </div>
+ </div>
+</body>
+</html>

0 comments on commit c653b5a

Please sign in to comment.
Something went wrong with that request. Please try again.