Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Creating UI layout

  • Loading branch information...
commit ccb90b3758550123ea58dcf3b5c828b2b23a07cc 1 parent ffe56b7
Chris Kaminski authored
16 src/main/java/com/darthcoder/JMSTestServlet/MainServlet.java
View
@@ -67,15 +67,15 @@ void addPrimerMessage() {
msg.setText("A message from MessageServlet");
msg.setStringProperty("name", "MessageServlet");
- sender.send(msg);
- } catch (JMSException e) {
+ sender.send(msg);
+ } catch (JMSException e) {
throw new RuntimeException(e);
} catch (NamingException e) {
// TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
- try {
- if (queueConnection != null) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (queueConnection != null) {
queueConnection.close();
}
} catch (JMSException e) { //ignore
@@ -118,7 +118,7 @@ void runMessageListener(HttpServletRequest request, HttpServletResponse response
msgSession.close();
conn.close();
ctx.close();
- } catch (NamingException e) {
+ } catch (NamingException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
@@ -136,7 +136,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
response.getWriter().write(jmsdata);
} catch (IOException e) {
- e.printStackTrace();
+ e.printStackTrace();
}
} else if (action.equals("jmsmessages") ) {
runMessageListener(request, response);
131 src/main/webapp/css/styles.css
View
@@ -0,0 +1,131 @@
+body {
+ margin: 0px;
+ padding: 2px;
+ height: 100%;
+}
+
+div {
+ padding: 2px;
+}
+
+#topbar {
+ height: 100px;
+ background: gray;
+}
+
+#leftbar {
+ float: left;
+ width: 280px;
+ background: darkgreen;
+ height: 100%
+}
+
+#content {
+ margin-left:280px;
+ background: red;
+ height:100%; /* IE6: treaded as min-height*/
+}
+
+
+/* http://www.queness.com/post/1696/create-a-beautiful-looking-custom-dialog-box-with-jquery-and-css3 */
+#dialog-overlay {
+
+ /* set it to fill the whil screen */
+ width:100%;
+ height:100%;
+
+ /* transparency for different browsers */
+ filter:alpha(opacity=50);
+ -moz-opacity:0.5;
+ -khtml-opacity: 0.5;
+ opacity: 0.5;
+ background:#000;
+
+ /* make sure it appear behind the dialog box but above everything else */
+ position:absolute;
+ top:0; left:0;
+ z-index:3000;
+
+ /* hide it by default */
+ display:none;
+}
+
+
+#dialog-box {
+
+ /* css3 drop shadow */
+ -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
+ -moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
+
+ /* css3 border radius */
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+
+ background:#eee;
+ /* styling of the dialog box, i have a fixed dimension for this demo */
+ width:328px;
+
+ /* make sure it has the highest z-index */
+ position:absolute;
+ z-index:5000;
+
+ /* hide it by default */
+ display:none;
+}
+
+#dialog-box .dialog-content {
+ /* style the content */
+ text-align:left;
+ padding:10px;
+ margin:13px;
+ color:#666;
+ font-family:arial;
+ font-size:11px;
+}
+
+#dialog-button {
+ /* styles for button */
+ margin:10px auto 0 auto;
+ text-align:center;
+ display: block;
+ width:50px;
+ padding: 5px 10px 6px;
+ color: #fff;
+ text-decoration: none;
+ font-weight: bold;
+ line-height: 1;
+
+ /* button color */
+ background-color: #e33100;
+
+ /* css3 implementation :) */
+ /* rounded corner */
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+
+ /* drop shadow */
+ -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
+ -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
+
+ /* text shaow */
+ text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
+ border-bottom: 1px solid rgba(0,0,0,0.25);
+ position: relative;
+ cursor: pointer;
+
+}
+
+#dialog-button:hover {
+ background-color: #c33100;
+}
+
+/* extra styling */
+#dialog-box .dialog-content p {
+ font-weight:700; margin:0;
+}
+
+#dialog-box .dialog-content ul {
+ margin:10px 0 10px 20px;
+ padding:0;
+ height:50px;
+}
26 src/main/webapp/index.jsp
View
@@ -3,6 +3,10 @@
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js" ></script>
+ <link rel="stylesheet" type="text/css" href="css/styles.css" />
+
+<script type="text/javascript" src="js/dialog.js"></script>
+
<script type="text/javascript">
$(document).ready(function() {
@@ -31,18 +35,36 @@ function startListener() {
}, dataType: "json", complete: startListener, timeout: 30000 });
}
-</script>
+var dialogtext = '<div id="dialog-overlay"></div><div id="dialog-box"><div class="dialog-content">' +
+ '<div id="dialog-message"></div><a href="#" id="dialog-button">Close</a></div></div>';
+
+function newMessage() {
+ window.alert("hello world alert");
+ popup("hello world!");
+}
+</script>
</head>
<body>
+
+<div id="topbar">
Connection Factory: <select id="CFactory" name="CFactory"> <option value=""/> </select> Custom: <input type="text" name="CFactoryCustom"/> <br/>
Source: <select id="Source" name="Source"> <option value="" /> </select> Custom: <input type="text" name="SourceCustom"/> <br/>
ReplyTo: <select id="ReplyTo" name="ReplyTo"> <option value=""/> </select> Custom: <input type="text" name="ReplyToCustom"/> <br/>
<input type="radio" name="ConnectionType" value="Queue">Queue</input>
<input type="radio" name="ConnectionType" value="Topic">Topic</input>
<input type="submit" name="submitbutton" value="Start Listening" onClick='startListener()'/>
-<br/>
+<input type="button" name="newmsgbutton" value="New Message" onClick='newMessage()' />
+</div>
+
+<div id="leftbar">
+asdf
+</div>
+
+<div id="content">
+asdf123
+</div>
</body>
</html>
38 src/main/webapp/js/dialog.js
View
@@ -0,0 +1,38 @@
+$(document).ready(function () {
+
+ // if user clicked on button, the overlay layer or the dialogbox, close the dialog
+ $('#dialog-button, #dialog-overlay, #dialog-box').click(function () {
+ $('#dialog-overlay, #dialog-box').hide();
+ return false;
+ });
+
+ // if user resize the window, call the same function again
+ // to make sure the overlay fills the screen and dialogbox aligned to center
+ $(window).resize(function () {
+
+ //only do it if the dialog box is not hidden
+ if (!$('#dialog-box').is(':hidden')) popup();
+ });
+
+
+});
+
+//Popup dialog
+function popup(message) {
+
+ // get the screen height and width
+ var maskHeight = $(document).height();
+ var maskWidth = $(window).width();
+
+ // calculate the values for center alignment
+ var dialogTop = (maskHeight/3) - ($('#dialog-box').height());
+ var dialogLeft = (maskWidth/2) - ($('#dialog-box').width()/2);
+
+ // assign values to the overlay and dialog box
+ $('#dialog-overlay').css({height:maskHeight, width:maskWidth}).show();
+ $('#dialog-box').css({top:dialogTop, left:dialogLeft}).show();
+
+ // display the message
+ $('#dialog-message').html(message);
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.