Java Apache Wicket Context Menu Setup

The ShieldUI ContextMenu Apache Wicket widget offers streamlined setup and deployment of our libraries.

Since it is a wrapper of our JavaScript ShieldUI ContextMenu component, you need to include the references to the CSS and JavaScript resources in the HEAD section of your webpage:

<!DOCTYPE html>
<html>
<head>
<title>Shield Chart</title>
<meta charset="utf-8" />

<link rel="stylesheet" type="text/css" href="css/shieldui-all.min.css" />
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/shieldui-all.min.js"></script>

</head>
<body>
    <ul wicket:id="contextMenu" >
    <li>Cut</li>
	<li>Copy</li>
	<li>Paste</li>
</ul>

<div id="contexttarget" style="margin-left:40px; width:400px; height:300px; display:inline-block; background-color: #e3e3e3;">
    <ul style="margin-top:100px; margin-left:100px;">
        <li>Row One</li>
        <li>Row Two</li>
    </ul>
</div>

<style>
      .mymenu {
          width: 50px;
      }
</style>

</body>
</html>

The ContextMenu widget is initialized and added it to your wicket page like in the following example:

final ContextMenu contextMenu = new ContextMenu("contextMenu");
add(contextMenu);

contextMenu.getOptions()
	.setCls("mymenu")
	.setTarget("#contexttarget")
	.setFilter("li");

To see more information on this wrapper, please refer to the following startup guide.