Author: solomax
Date: Mon Mar 20 03:07:47 2017
New Revision: 1787683

URL: http://svn.apache.org/viewvc?rev=1787683&view=rev
Log:
[OPENMEETINGS-551] WB is renewed (initial prototype)

Added:
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.html
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.html
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/fabric.js
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/fabric.min.js
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js
    
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/font.png
   (with props)
    
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/line.png
   (with props)
    
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/menupointer.png
   (with props)
    
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/paintbrush.png
   (with props)
    
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/rectangle.png
   (with props)
Modified:
    openmeetings/application/trunk/openmeetings-web/pom.xml
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FolderPanel.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java
    openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/room.css
    
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/theme.css

Modified: openmeetings/application/trunk/openmeetings-web/pom.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/pom.xml?rev=1787683&r1=1787682&r2=1787683&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/pom.xml (original)
+++ openmeetings/application/trunk/openmeetings-web/pom.xml Mon Mar 20 03:07:47 
2017
@@ -432,17 +432,6 @@
                </dependency>
                <dependency>
                        <groupId>org.wicketstuff</groupId>
-                       <artifactId>wicketstuff-whiteboard</artifactId>
-                       <version>${wickets.version}</version>
-                       <exclusions>
-                               <exclusion>
-                                       <groupId>org.apache.wicket</groupId>
-                                       
<artifactId>wicket-native-websocket-tomcat</artifactId>
-                               </exclusion>
-                       </exclusions>
-               </dependency>
-               <dependency>
-                       <groupId>org.wicketstuff</groupId>
                        <artifactId>wicketstuff-select2</artifactId>
                        <version>${wickets.version}</version>
                </dependency>

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FolderPanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FolderPanel.java?rev=1787683&r1=1787682&r2=1787683&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FolderPanel.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FolderPanel.java
 Mon Mar 20 03:07:47 2017
@@ -114,11 +114,6 @@ public class FolderPanel extends Panel {
                                        
getBean(FileExplorerItemDao.class).update((FileExplorerItem)fi);
                                }
                        }
-
-                       @Override
-                       public void onEdit(AjaxRequestTarget target) {
-                               super.onEdit(target);
-                       }
                };
                drag.add(name.add(AttributeModifier.append("title", 
r.getName())));
                add(drop.add(drag).setOutputMarkupId(true));

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java?rev=1787683&r1=1787682&r2=1787683&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
 Mon Mar 20 03:07:47 2017
@@ -65,6 +65,7 @@ import org.apache.openmeetings.web.room.
 import org.apache.openmeetings.web.room.activities.Activity;
 import org.apache.openmeetings.web.room.menu.RoomMenuPanel;
 import org.apache.openmeetings.web.room.sidebar.RoomSidebar;
+import org.apache.openmeetings.web.room.wb.WbPanel;
 import org.apache.openmeetings.web.user.record.JpgRecordingResourceReference;
 import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
@@ -84,7 +85,6 @@ import org.apache.wicket.request.resourc
 import org.apache.wicket.request.resource.ResourceReference;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
-import org.wicketstuff.whiteboard.WhiteboardBehavior;
 
 import com.github.openjson.JSONObject;
 import com.googlecode.wicket.jquery.core.JQueryBehavior;
@@ -152,6 +152,7 @@ public class RoomPanel extends BasePanel
                                        waitApplyModeration.open(target);
                                }
                        }
+                       wb.update(target);
                }
        };
        private RedirectMessageDialog roomClosed;
@@ -160,6 +161,7 @@ public class RoomPanel extends BasePanel
        private RoomMenuPanel menu;
        private RoomSidebar sidebar;
        private ActivitiesPanel activities;
+       private final WbPanel wb;
        private String sharingUser = null;
        private String recordingUser = null;
        private String publishingUser = null; //TODO add
@@ -168,6 +170,7 @@ public class RoomPanel extends BasePanel
        public RoomPanel(String id, Room r) {
                super(id);
                this.r = r;
+               this.wb = new WbPanel("whiteboard", this);
                //TODO check here and set
                //private String recordingUser = null;
                //private String sharingUser = null;
@@ -209,9 +212,7 @@ public class RoomPanel extends BasePanel
                                }
                        }
                };
-               WebMarkupContainer wb = new WebMarkupContainer("whiteboard");
-               room.add(wbArea.add(wb.setOutputMarkupId(true)));
-               room.add(new WhiteboardBehavior("1", wb.getMarkupId(), null, 
null, null));
+               room.add(wbArea.add(wb));
                room.add(roomEnter);
                room.add(sidebar = new RoomSidebar("sidebar", this));
                room.add(activities = new ActivitiesPanel("activities", this));
@@ -379,18 +380,19 @@ public class RoomPanel extends BasePanel
                                                }
                                                break;
                                        case rightUpdated:
-                                               sidebar.updateUsers(handler);
+                                               sidebar.update(handler);
                                                menu.update(handler);
+                                               wb.update(handler);
                                                break;
                                        case roomEnter:
-                                               sidebar.updateUsers(handler);
+                                               sidebar.update(handler);
                                                menu.update(handler);
                                                // TODO should this be fixed?
                                                //activities.addActivity(new 
Activity(m, Activity.Type.roomEnter), handler);
                                                break;
                                        case roomExit:
                                                //TODO check user/remove tab
-                                               sidebar.updateUsers(handler);
+                                               sidebar.update(handler);
                                                activities.add(new Activity(m, 
Activity.Type.roomExit), handler);
                                                break;
                                        case roomClosed:

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js?rev=1787683&r1=1787682&r2=1787683&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
 Mon Mar 20 03:07:47 2017
@@ -58,16 +58,27 @@ function initVideo(_options) {
 
 function setRoomSizes() {
        var w = $(window).width() - $(".room.sidebar.left").width() - 5;
-       $(".room.wb.area").width(w);
-       $(".room.wb.area .wb").width(w);
+       var area = $(".room.wb.area");
+       area.width(w);
+       var wb = area.find(".wb");
+       wb.width(w);
 
        var h = $(window).height() - $('#menu').height();
        $(".room.sidebar.left").height(h);
        var p = $(".room.sidebar.left .tabs");
-       p.height(h - 5);
-       $(".user.list", p).height(h - $("ul", p).height() - $(".user.header", 
p).height() - 10);
-       $(".room.wb.area").height(h);
-       $(".room.wb.area .wb").height(h);
+       var hh = h - 5;
+       p.height(hh);
+       $(".user.list", p).height(hh - $("ul", p).height() - $(".user.header", 
p).height() - 5);
+       area.height(h);
+       wb.height(hh);
+       var wbTabs = wb.find(".tabs.ui-tabs");
+       wbTabs.height(hh);
+       var tabPanels = wbTabs.find(".ui-tabs-panel");
+       var wbah = hh - 5 - wbTabs.find("ul.ui-tabs-nav").height();
+       tabPanels.height(wbah);
+       if (tabPanels.data('fabric')) {
+               tabPanels.data('resize')(w, wbah);
+       }
 }
 function roomReload(event, ui) {
        window.location.reload();

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java?rev=1787683&r1=1787682&r2=1787683&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java
 Mon Mar 20 03:07:47 2017
@@ -365,7 +365,7 @@ public class RoomSidebar extends Panel {
                roomFiles.setReadOnly(!showFiles, handler);
        }
 
-       public void updateUsers(IPartialPageRequestHandler handler) {
+       public void update(IPartialPageRequestHandler handler) {
                updateShowFiles(handler);
                updateUsers();
                selfRights.setVisible(room.getRoom().isAllowUserQuestions() || 
room.getClient().hasRight(Right.moderator));

Added: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.html
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.html?rev=1787683&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.html
 (added)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.html
 Mon Mar 20 03:07:47 2017
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<html xmlns:wicket="http://wicket.apache.org";>
+<wicket:panel>
+       <canvas></canvas>
+       <div class="tools ui-state-active vertical clear" style="display: none; 
position: absolute; top: 20px; right: 0px;">
+               <div class="bumper"></div>
+               <div wicket:message="title:72" class="ui-widget-header om-icon 
big pointer"></div>
+               <div wicket:message="title:73" class="ui-widget-header om-icon 
big text"></div>
+               <div wicket:message="title:74" class="ui-widget-header om-icon 
big paint"></div>
+               <div wicket:message="title:75" class="ui-widget-header om-icon 
big line"></div>
+               <div wicket:message="title:77" class="ui-widget-header om-icon 
big rect"></div>
+               <div wicket:message="title:4" class="ui-widget-header om-icon 
big settings"></div>
+       </div>
+       <div class="wb-settings ui-corner-all ui-widget-content" 
style="display: none; bottom: 100px; right: 100px;">
+               <div wicket:message="title:843" class="header 
ui-dialog-titlebar ui-corner-all ui-widget-header ui-helper-clearfix 
ui-draggable-handle">
+                       <span class="ui-dialog-title"><wicket:message 
key="843"/></span>
+                       <button type="button" class="ui-button ui-corner-all 
ui-widget ui-button-icon-only ui-dialog-titlebar-close" 
wicket:message="title:85">
+                               <span class="ui-button-icon ui-icon 
ui-icon-closethick"></span>
+                               <span class="ui-button-icon-space"> </span>
+                               <wicket:message key="85"/>
+                       </button>
+               </div>
+               <div class="tab props">
+                       <div class="prop-row">
+                               <div class="block lbl" 
wicket:message="title:546"><wicket:message key="545"/></div>
+                               <div class="block input"><input 
class="wb-dim-x" type="text" maxlength="4" readonly="readonly"/></div>
+                               <div class="block lbl" 
wicket:message="title:550"><wicket:message key="549"/></div>
+                               <div class="block input"><input 
class="wb-dim-w" type="text" maxlength="4" readonly="readonly"/></div>
+                               <div class="block input" style="width: 
2em;"><input class="wb-prop-color" type="color" value="#ff6600" 
wicket:message="title:424"/></div>
+                               <div class="block but"><button 
class="wb-prop-lock-color" wicket:message="title:426">&nbsp;</button></div>
+                               <div class="block input"><input 
class="wb-prop-width" type="number" min="1" max="100" value="2" 
wicket:message="title:429"/></div>
+                               <div class="block but"><button 
class="wb-prop-i" wicket:message="title:86">I</button></div>
+                       </div>
+                       <div class="prop-row">
+                               <div class="block lbl" 
wicket:message="title:548"><wicket:message key="547"/></div>
+                               <div class="block input"><input 
class="wb-dim-y" type="text" maxlength="4" readonly="readonly"/></div>
+                               <div class="block lbl" 
wicket:message="title:552"><wicket:message key="551"/></div>
+                               <div class="block input"><input 
class="wb-dim-h" type="text" maxlength="4" readonly="readonly"/></div>
+                               <div class="block input" style="width: 
2em;"><input class="wb-prop-fill" type="color" value="#ffff33" 
wicket:message="title:427"/></div>
+                               <div class="block but"><button 
class="wb-prop-lock-fill" wicket:message="title:428">&nbsp;</button></div>
+                               <div class="block input"><input 
class="wb-prop-opacity" type="number" min="1" max="100" value="100" 
wicket:message="title:553"/></div>
+                               <div class="block but"><button 
class="wb-prop-b" wicket:message="title:87">B</button></div>
+                       </div>
+               </div>
+       </div>
+</wicket:panel>
+</html>

Added: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.java?rev=1787683&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.java
 (added)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbArea.java
 Mon Mar 20 03:07:47 2017
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.web.room.wb;
+
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.request.resource.JavaScriptResourceReference;
+import org.apache.wicket.request.resource.ResourceReference;
+
+public class WbArea extends Panel {
+       private static final long serialVersionUID = 1L;
+       private final static ResourceReference FABRIC_JS_REFERENCE = new 
JavaScriptResourceReference(WbArea.class, "fabric.js");
+
+       public WbArea(String id) {
+               super(id);
+               setOutputMarkupId(true);
+       }
+
+       @Override
+       public void renderHead(IHeaderResponse response) {
+               super.renderHead(response);
+               
response.render(JavaScriptHeaderItem.forReference(FABRIC_JS_REFERENCE));
+               
response.render(OnDomReadyHeaderItem.forScript(String.format("initArea('%s');", 
getMarkupId())));
+       }
+}

Added: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html?rev=1787683&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
 (added)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
 Mon Mar 20 03:07:47 2017
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<html xmlns:wicket="http://wicket.apache.org";>
+<wicket:panel>
+       <div class="tabs" wicket:id="tabs"></div>
+
+       <wicket:fragment wicket:id="tab-fragment">
+               <a wicket:id="link">[title]</a>
+       </wicket:fragment>
+</wicket:panel>
+</html>

Added: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java?rev=1787683&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
 (added)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
 Mon Mar 20 03:07:47 2017
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.web.room.wb;
+
+import static org.apache.openmeetings.web.app.Application.getBean;
+
+import org.apache.openmeetings.core.data.whiteboard.WhiteboardCache;
+import org.apache.openmeetings.db.entity.room.Room.Right;
+import org.apache.openmeetings.web.room.RoomPanel;
+import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+import org.apache.wicket.markup.head.PriorityHeaderItem;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.request.resource.JavaScriptResourceReference;
+import org.apache.wicket.request.resource.ResourceReference;
+
+public class WbPanel extends Panel {
+       private static final long serialVersionUID = 1L;
+       private final WbTabbedPanel tabs;
+       private boolean readOnly = true;
+       private final RoomPanel rp;
+
+       public WbPanel(String id, RoomPanel rp) {
+               super(id);
+               this.rp = rp;
+               setOutputMarkupId(true);
+
+               
getBean(WhiteboardCache.class).get(rp.getRoom().getId()).getWhiteboards();//TODO
+               add(tabs = new WbTabbedPanel("tabs", this));
+               tabs.setOutputMarkupId(true);// FIXME TODO add Sortable for 
tabs add(new Sortable<T>)
+               tabs.addWb("Whiteboard 1");
+       }
+
+       private static ResourceReference newResourceReference() {
+               return new JavaScriptResourceReference(WbPanel.class, "wb.js");
+       }
+
+       @Override
+       public void renderHead(IHeaderResponse response) {
+               super.renderHead(response);
+               response.render(new 
PriorityHeaderItem(JavaScriptHeaderItem.forReference(newResourceReference())));
+       }
+
+       public boolean isReadOnly() {
+               return readOnly;
+       }
+
+       public WbPanel setReadOnly(boolean readOnly) {
+               this.readOnly = readOnly;
+               return this;
+       }
+
+       public WbPanel update(IPartialPageRequestHandler handler) {
+               readOnly = !rp.getClient().hasRight(Right.whiteBoard);
+               if (handler != null) {
+                       tabs.reload(handler);
+                       handler.appendJavaScript("setRoomSizes();");
+               }
+               return this;
+       }
+}

Added: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.html
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.html?rev=1787683&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.html
 (added)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.html
 Mon Mar 20 03:07:47 2017
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<wicket:panel xmlns:wicket="http://wicket.apache.org";>
+       <ul>
+               <li wicket:id="tabs">
+                       <wicket:container wicket:id="tab"></wicket:container>
+               </li>
+       </ul>
+       <div wicket:id="panels">[panel]</div>
+       
+       <wicket:fragment wicket:id="tab-fragment">
+               <a wicket:id="link">[title]</a><span wicket:id="close" 
class='ui-icon ui-icon-close' 
+                               wicket:message="title:85" 
role='presentation'><wicket:message key="85"/></span>
+       </wicket:fragment>
+</wicket:panel>

Added: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.java?rev=1787683&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.java
 (added)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbTabbedPanel.java
 Mon Mar 20 03:07:47 2017
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.web.room.wb;
+
+import static org.apache.wicket.AttributeModifier.append;
+
+import java.util.ArrayList;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.AjaxEditableLabel;
+import org.apache.wicket.extensions.markup.html.tabs.ITab;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+import com.googlecode.wicket.jquery.ui.widget.tabs.TabbedPanel;
+
+public class WbTabbedPanel extends TabbedPanel {
+       private static final long serialVersionUID = 1L;
+       private final WbPanel wb;
+
+       public WbTabbedPanel(String id, WbPanel wb) {
+               super(id, new ArrayList<>());
+               setOutputMarkupId(true);
+               this.wb = wb;
+       }
+
+       @Override
+       protected void onConfigure() {
+               super.onConfigure();
+               //setActiveTab(selectedIdx);
+       }
+
+       @Override
+       public void onActivate(AjaxRequestTarget target, int index, ITab tab) {
+               //selectedIdx = index;
+       }
+
+       @Override
+       protected WebMarkupContainer newTabContainer(String id, String tabId, 
ITab tab, int index) {
+               WebMarkupContainer t = new Fragment(id, "tab-fragment", 
WbTabbedPanel.this);
+               final Component link = wb.isReadOnly()
+                               ? newTitleLabel("link", tab.getTitle())
+                               : new AjaxEditableLabel<String>("link", 
tab.getTitle()) {
+                                               private static final long 
serialVersionUID = 1L;
+
+                                               @Override
+                                               protected String 
getLabelAjaxEvent() {
+                                                       return "dblclick";
+                                               }
+
+                                               @Override
+                                               protected void 
onSubmit(AjaxRequestTarget target) {
+                                                       super.onSubmit(target);
+                                               }
+                               };
+               link.add(append("href", "#" + tabId), append("class", 
"ui-tabs-anchor"), append("title", tab.getTitle()));
+
+               WebMarkupContainer close = new WebMarkupContainer("close");
+               t.add(link, close.setVisible(!wb.isReadOnly()));
+               return t;
+       }
+
+       public void addWb(final String name) {
+               add(new ITab() {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       public boolean isVisible() {
+                               return true;
+                       }
+
+                       @Override
+                       public IModel<String> getTitle() {
+                               return Model.of(name);
+                       }
+
+                       @Override
+                       public WebMarkupContainer getPanel(String containerId) {
+                               return new WbArea(containerId);
+                       }
+               });
+       }
+}


Reply via email to