/** Capture an image for all ViewManagers */ public void captureAll() { List vms = getViewManagers(); String filename = FileManager.getWriteFile(FileManager.FILTER_IMAGE, FileManager.SUFFIX_JPG); if (filename == null) { return; } String root = IOUtil.stripExtension(filename); String ext = IOUtil.getFileExtension(filename); StringBuffer sb = new StringBuffer("<html>"); sb.append("Since there were multiple images they were written out as:<ul>"); for (int i = 0; i < vms.size(); i++) { ViewManager vm = (ViewManager) vms.get(i); String name = vm.getName(); if ((name == null) || (name.trim().length() == 0)) { name = "" + (i + 1); } if (vms.size() != 1) { filename = root + name + ext; } sb.append("<li> " + filename); vm.writeImage(filename); } sb.append("</ul></html>"); if (vms.size() > 1) { GuiUtils.showDialog("Captured Images", GuiUtils.inset(new JLabel(sb.toString()), 5)); } }
public void stopControlRemoteDesktop(String remoteUserName) throws Exception { log.info("stopControlRemoteDesktop " + remoteUserName); VncViewer viewer = viewerMap.get("vncview_" + remoteUserName); if (viewer != null) { viewer.setViewOnly(true); MaxVncPanelWindow component = ViewManager.getComponent(MaxVncPanelWindow.class); if (component.isVisible()) { VncViewPanel viewPanel = component.getVncViewPanel(); viewPanel.getAskforControlButton().setEnabled(true); viewPanel.getStopControlButton().setEnabled(false); } else { DockingLayoutMeetingPanel dockingLayoutMeetingPanel = ViewManager.getComponent(DockingLayoutMeetingPanel.class); View findInViewMap = dockingLayoutMeetingPanel.findInViewMap("vncview_" + remoteUserName); if (findInViewMap != null) { VncViewPanel viewPanel = (VncViewPanel) findInViewMap.getComponent(); viewPanel.getAskforControlButton().setEnabled(true); viewPanel.getStopControlButton().setEnabled(false); } } ShareFileServerUtil.getInstance() .startScreenShareToOneClientCallBack( DataUtil.getLoginInfo().getConfno(), remoteUserName, DataUtil.getLoginInfo().getUsername(), "DESKTOP_NOTCONTROL", "-1"); } }
// 主动关闭,或被远端主动关闭 public void closeDesktopView(String remoteUserName) throws Exception { log.info("closeDesktopView"); VncViewer viewer = viewerMap.get("vncview_" + remoteUserName); if (viewer != null) { viewer.setCustomProperty("IsDestroy", "true"); viewer.setEnabled(false); viewer.disconnect(); viewer.destroy(); // dispose! } DockingLayoutMeetingPanel dockingLayoutMeetingPanel = ViewManager.getComponent(DockingLayoutMeetingPanel.class); View findInViewMap = dockingLayoutMeetingPanel.findInViewMap("vncview_" + remoteUserName); if (findInViewMap != null) { // dockingLayoutMeetingPanel.removePanel("vncview_"+remoteUserName); } dockingLayoutMeetingPanel.removePanel("vncview_" + remoteUserName); MaxVncPanelWindow component = ViewManager.getComponent(MaxVncPanelWindow.class); component.setVncViewPanel(null); component.dispose(); viewerMap.put("vncview_" + remoteUserName, null); ShareFileServerUtil.getInstance() .startScreenShareToOneClientCallBack( DataUtil.getLoginInfo().getConfno(), remoteUserName, DataUtil.getLoginInfo().getUsername(), "DESKTOP_STOPVIWE", "-1"); }
public void startScreenShareToOneClientCallBack( String sharerUserName, String userName, String status, String repeaterid) throws Exception { log.info( "startScreenShareToOneClientCallBack " + sharerUserName + "," + userName + "," + status + "," + repeaterid); if (status.equals("ERROR")) { // DockingLayoutMeetingPanel panel = // DataUtil.getValue(DataUtil.Key.DockingLayoutMeetingPanel); if (screenshareflag) { addToWaitList(userName, repeaterid, false); } // if (panel.getStopScreenShareMI().isEnabled()) { //// Thread.sleep(2000); // addToWaitList(userName, repeaterid,false); // } MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class); MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName); if (memberListItemByName != null) { memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_FREE); memberPanel.repaint(); } } else if (status.equals("SUCCESS")) { MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class); MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName); if (memberListItemByName != null) { memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_VIEW); // memberListItemByName.repaint(); memberPanel.repaint(); } } else if (status.equals("DESKTOP_CONTROL")) { MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class); MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName); if (memberListItemByName != null) { memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_CONTROL); memberPanel.repaint(); } } else if (status.equals("DESKTOP_NOTCONTROL")) { MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class); MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName); if (memberListItemByName != null) { memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_VIEW); memberPanel.repaint(); } } else if (status.equals("DESKTOP_STOPVIWE")) { MemberListPanel memberPanel = ViewManager.getComponent(MemberListPanel.class); MemberListItem memberListItemByName = memberPanel.getMemberListItemByName(userName); if (memberListItemByName != null) { memberListItemByName.setShareDesktopState(Constants.MEMBER_STATUS_SHAREDESKTOP_FREE); // memberListItemByName.repaint(); memberPanel.repaint(); } } }
/** * Set the {@link ViewManager} whose window was last active. * * @param viewManager The last active view manager */ public void setLastActiveViewManager(ViewManager viewManager) { if (lastActiveViewManager != null) { lastActiveViewManager.setLastActive(false); } lastActiveViewManager = viewManager; if (lastActiveViewManager != null) { lastActiveViewManager.setLastActive(true); } }
/** * Find the view manager in the given list that is defined by the given view descriptor. * * @param viewDescriptor The view descriptor * @param vms List of ViewManagers * @return The view manager or null if none found */ public static ViewManager findViewManagerInList(ViewDescriptor viewDescriptor, List vms) { for (int i = 0; i < vms.size(); i++) { ViewManager vm = (ViewManager) vms.get(i); if (vm.isDefinedBy(viewDescriptor)) { return vm; } else { } } return null; }
/** * Remove all view managers * * @param andDestroyThem If true then also call destroy */ public void removeAllViewManagers(boolean andDestroyThem) { List local = new ArrayList(viewManagers); for (int i = 0; i < local.size(); i++) { ViewManager vm = (ViewManager) local.get(i); removeViewManager(vm); if (andDestroyThem) { vm.destroy(); } } }
/** * Do the initialization of the unpersisted {@link ViewManager}. * * @param newViewManagers List of view managers to unpersist */ public void unpersistViewManagers(List newViewManagers) { try { for (int i = 0; i < newViewManagers.size(); i++) { ViewManager newViewManager = (ViewManager) newViewManagers.get(i); newViewManager.initAfterUnPersistence(getIdv()); } } catch (Exception exc) { logException("Unpersisting view manager", exc); } }
/** * Get all of the view managers of the given class * * @param c ViewManager class * @return List of ViewManagers */ public List getViewManagers(Class c) { List result = new ArrayList(); List vms = getViewManagers(); for (int i = 0; i < vms.size(); i++) { ViewManager vm = (ViewManager) vms.get(i); if (c.isAssignableFrom(vm.getClass())) { result.add(vm); } } return result; }
public void revertVncViewPanel(VncViewPanel panel) throws Exception { log.info("revertVncViewPanel"); DockingLayoutMeetingPanel dockingLayoutMeetingPanel = ViewManager.getComponent(DockingLayoutMeetingPanel.class); dockingLayoutMeetingPanel.updatePanel(panel, "vncview_" + panel.getUsername()); MaxVncPanelWindow component = ViewManager.getComponent(MaxVncPanelWindow.class); component.setVncViewPanel(null); component.dispose(); panel.getDesktopScrollPane().getComponent(0).repaint(); panel.getMaxViewButton().setVisible(true); panel.getRevertViewButton().setVisible(false); }
public void actionPerformed(java.awt.event.ActionEvent event) { if (TRACE) System.out.println("CutPanelView actionPerformed: view: " + viewName); if (event.getSource() == closeButn) { JToggleButton jtb = (JToggleButton) event.getSource(); jtb.setSelected(false); // System.out.println("Close!"); vm.hideView(this); toolbarButton.setSelected(false); } else if (toolbarButton.isSelected()) { vm.showView(this); } else vm.hideView(this); }
public void updateViewExtraData(int tag, Object extraData) { UiThreadUtil.assertOnUiThread(); ViewManager viewManager = mTagsToViewManagers.get(tag); if (viewManager == null) { throw new IllegalViewOperationException("ViewManager for tag " + tag + " could not be found"); } View viewToUpdate = mTagsToViews.get(tag); if (viewToUpdate == null) { throw new IllegalViewOperationException( "Trying to update view with tag " + tag + " which " + "doesn't exist"); } viewManager.updateExtraData(viewToUpdate, extraData); }
public void updateProperties(int tag, CatalystStylesDiffMap props) { UiThreadUtil.assertOnUiThread(); ViewManager viewManager = mTagsToViewManagers.get(tag); if (viewManager == null) { throw new IllegalViewOperationException("ViewManager for tag " + tag + " could not be found"); } View viewToUpdate = mTagsToViews.get(tag); if (viewToUpdate == null) { throw new IllegalViewOperationException( "Trying to update view with tag " + tag + " which doesn't exist"); } viewManager.updateProperties(viewToUpdate, props); }
private void readNotification(JSONObject root) { JSONObject data = (JSONObject) root.get("data"); Notificacion n = new Notificacion(); n.setDate(Date.valueOf((String) root.get("date"))); n.setTime(Time.valueOf((String) root.get("time"))); n.setIdDevice((String) root.get("idDevice")); n.setIdPaciente((Long) data.get("idPaciente")); n.setIdContenido((Long) data.get("idPictograma")); n.setIdContexto((Long) data.get("idContexto")); // TODO si no existe el alumno con id/idDevice de la notificación, guardarlo Paciente paciente = new PacienteDAO().getById(n.getIdPaciente(), n.getIdDevice()); if (paciente == null) { paciente = new Paciente( n.getIdPaciente().intValue(), n.getIdDevice(), (String) data.get("nombre"), (String) data.get("apellido"), ((String) data.get("sexo")).charAt(0)); new PacienteDAO().guardar(paciente); } ViewManager.getInstance().showNotification(n); }
/** * Set the {@link ucar.visad.display.DisplayMaster} * * @param master The display master */ protected void setDisplayMaster(DisplayMaster master) { super.setDisplayMaster(master); try { NavigatedDisplay navDisplay = (NavigatedDisplay) master; if (tmpVertRangeUnit != null) { navDisplay.setVerticalRangeUnit(tmpVertRangeUnit); } if (tmpVerticalRange != null) { navDisplay.setVerticalRange(tmpVerticalRange[0], tmpVerticalRange[1]); } navDisplay.setCursorStringOn(false); final RubberBandBox rbb = navDisplay.getRubberBandBox(); if (rbb != null) { rbb.addAction( new ActionImpl("Box Change") { public void doAction() throws VisADException, RemoteException { Gridded2DSet bounds = rbb.getBounds(); if (bounds != null) { rubberBandBoxChanged(); } } }); } } catch (Exception e) { logException("setDisplayMaster", e); } }
public void getRepeaterIDCallBack(Map<String, Integer> repeaterids) throws Exception { log.info("getRepeaterIDCallBack"); if (screenshareflag) { if (!looThread.isAlive()) { looThread.start(); } Iterator<Entry<String, Integer>> iterator = repeaterids.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<java.lang.String, java.lang.Integer> entry = (Map.Entry<java.lang.String, java.lang.Integer>) iterator.next(); String remoteUserName = entry.getKey().substring(entry.getKey().indexOf("-") + 1); if (!remoteUserName.equals(DataUtil.getLoginInfo().getUsername())) { addToWaitList(remoteUserName, entry.getValue() + "", true); } } // DockingLayoutMeetingPanel panel = // DataUtil.getValue(DataUtil.Key.DockingLayoutMeetingPanel); // panel.getStartScreenShareMI().setEnabled(false); // panel.getStopScreenShareMI().setEnabled(true); MainFrame mainFrame = ViewManager.getComponent(MainFrame.class); mainFrame .getShareDesktopButton() .setText(StringUtil.getUIString("DockingLayoutMeetingPanel.stopScreenShareMI.text")); mainFrame.getShareDesktopButton().setEnabled(true); // screenshareflag = false; } }
/** * Handle the receipt of shared data * * @param from Who is it from * @param dataId What is it * @param data Here it is */ public void receiveShareData(Sharable from, Object dataId, Object[] data) { if (!getInitDone()) { return; } if ((from != null) && !from.getClass().equals(getClass())) { return; } if (dataId.equals(SHARE_MATRIX)) { try { lastSharedMatrix = (double[]) data[0]; setDisplayMatrix(lastSharedMatrix); matrixChanged(); } catch (Exception e) { logException("setDisplayMatrix", e); } return; } if (dataId.equals(SHARE_RUBBERBAND)) { // System.out.println("NVM: Rubber Band Box changed from share"); notifyDisplayControls(SHARE_RUBBERBAND); return; } super.receiveShareData(from, dataId, data); }
/** Handle an animation time change */ protected void animationTimeChanged() { super.animationTimeChanged(); if (cursorReadoutWindow != null) { cursorReadoutWindow.updateReadout(); } }
public void dispatchCommand(int reactTag, int commandId, @Nullable ReadableArray args) { UiThreadUtil.assertOnUiThread(); View view = mTagsToViews.get(reactTag); if (view == null) { throw new IllegalViewOperationException( "Trying to send command to a non-existing view " + "with tag " + reactTag); } ViewManager viewManager = mTagsToViewManagers.get(reactTag); if (viewManager == null) { throw new IllegalViewOperationException( "ViewManager for view tag " + reactTag + " could not be found"); } viewManager.receiveCommand(view, commandId, args); }
@SuppressWarnings("unchecked") public AbstractPresenter(Class<V> viewClass) { this.viewClass = viewClass; implClass = (Class<V>) ViewManager.getViewImplCls(viewClass); if (implClass == null) { throw new MyCollabException("Can not find the implementation for view " + viewClass); } }
/** * Writes the location of the views of the known {@link Note}s. * * @param out the stream to write into * @throws IOException if this method can't write into <code>out</code> */ public void write(DataOutputStream out) throws IOException { PropertyTransformer transformer = new PropertyTransformer(); out.writeInt(locations.size()); for (Map.Entry<Note, Tuple<DockStation, DockableProperty>> location : locations.entrySet()) { out.writeUTF(location.getKey().getId()); out.writeUTF(manager.getName(location.getValue().getA())); transformer.write(location.getValue().getB(), out); } }
/** * Writes the location of the views of the known {@link Note}s. * * @param element the xml-element to write into, the attributes of <code>element</code> will not * be changed */ public void writeXML(XElement element) throws IOException { PropertyTransformer transformer = new PropertyTransformer(); for (Map.Entry<Note, Tuple<DockStation, DockableProperty>> location : locations.entrySet()) { XElement xnote = element.addElement("note"); xnote.addString("id", location.getKey().getId()); xnote.addString("station", manager.getName(location.getValue().getA())); transformer.writeXML(location.getValue().getB(), xnote); } }
/** Cleanup when destroying this object. */ public void destroy() { viewpointControl = null; if (readout != null) { readout.destroy(); } readout = null; super.destroy(); }
/** * Add components to the properties dialog * * @param tabbedPane the tabbed pane to add to */ protected void addPropertiesComponents(JTabbedPane tabbedPane) { super.addPropertiesComponents(tabbedPane); // set vertical range "visible" checkbox to current status of // individual vert axis visibility, independent of global // 'show display scales' switch vertRangeWidget = getViewpointControl() .makeVerticalRangeWidget(getNavigatedDisplay().getVerticalRangeVisible()); tabbedPane.add("Vertical Scale", GuiUtils.topLeft(vertRangeWidget)); }
/** * Add the new view manager into the list if we don't have one with the {@link ViewDescriptor} of * the new view manager already. * * @param newViewManager The new view manager */ public void addViewManager(ViewManager newViewManager) { ViewManager vm = findViewManagerInList(newViewManager.getViewDescriptor()); if (vm == null) { synchronized (viewManagers) { viewManagers.add(newViewManager); } try { Trace.call1("VMManager calling ViewManager.init"); newViewManager.init(); Trace.call2("VMManager calling ViewManager.init"); } catch (Exception exc) { logException("Adding view manager", exc); } setLastActiveViewManager(newViewManager); } getIdvUIManager().viewManagerAdded(newViewManager); }
public void createView( int rootViewTagForContext, int tag, String className, @Nullable CatalystStylesDiffMap initialProps) { UiThreadUtil.assertOnUiThread(); ViewManager viewManager = mViewManagers.get(className); View view = viewManager.createView(mRootViewsContext.get(rootViewTagForContext), mJSResponderHandler); mTagsToViews.put(tag, view); mTagsToViewManagers.put(tag, viewManager); // Use android View id field to store React tag. This is possible since we don't inflate // React views from layout xmls. Thus it is easier to just reuse that field instead of // creating another (potentially much more expensive) mapping from view to React tag view.setId(tag); if (initialProps != null) { viewManager.updateProperties(view, initialProps); } }
/** Invoked by React to create a new node with a given tag, class name and properties. */ public void createView(int tag, String className, int rootViewTag, ReadableMap props) { ViewManager viewManager = mViewManagers.get(className); ReactShadowNode cssNode = viewManager.createShadowNodeInstance(); ReactShadowNode rootNode = mShadowNodeRegistry.getNode(rootViewTag); cssNode.setReactTag(tag); cssNode.setViewClassName(className); cssNode.setRootNode(rootNode); cssNode.setThemedContext(rootNode.getThemedContext()); mShadowNodeRegistry.addNode(cssNode); CatalystStylesDiffMap styles = null; if (props != null) { styles = new CatalystStylesDiffMap(props); cssNode.updateProperties(styles); } if (!cssNode.isVirtual()) { mNativeViewHierarchyOptimizer.handleCreateView(cssNode, rootViewTag, styles); } }
/** * Reads the location of the views of all known <code>Note</code>s. * * @param element the xml-element to read from */ public void readXML(XElement element) { PropertyTransformer transformer = new PropertyTransformer(); for (XElement xnote : element.getElements("note")) { Note note = model.getNote(xnote.getString("id")); DockStation station = manager.getStation(xnote.getString("station")); DockableProperty property = transformer.readXML(xnote); if (note != null) { locations.put(note, new Tuple<DockStation, DockableProperty>(station, property)); } } }
/** * Required interface for ActionEvents, to implement ActionListener for the UI objects such as * JButton-s and MenuItem-s * * @param event an ActionEvent */ public void actionPerformed(ActionEvent event) { String cmd = event.getActionCommand(); if (cmd.equals(CMD_NAV_ZOOMIN)) { getNavigatedDisplay().zoom(ZOOM_FACTOR); } else if (cmd.equals(CMD_NAV_ROTATELEFT)) { getNavigatedDisplay().rotateZ(-5.0); } else if (cmd.equals(CMD_NAV_ROTATERIGHT)) { getNavigatedDisplay().rotateZ(5.0); } else if (cmd.equals(CMD_NAV_ZOOMOUT)) { getNavigatedDisplay().zoom(1.0 / (double) ZOOM_FACTOR); } else if (cmd.equals(CMD_NAV_HOME)) { try { getNavigatedDisplay().resetProjection(); } catch (Exception exc) { } } else if (cmd.equals(CMD_NAV_RIGHT)) { getNavigatedDisplay().translate(-TRANSLATE_FACTOR, 0.0); } else if (cmd.equals(CMD_NAV_LEFT)) { getNavigatedDisplay().translate(TRANSLATE_FACTOR, 0.0); } else if (cmd.equals(CMD_NAV_UP)) { getNavigatedDisplay().translate(0.0, -TRANSLATE_FACTOR); } else if (cmd.equals(CMD_NAV_DOWN)) { getNavigatedDisplay().translate(0.0, TRANSLATE_FACTOR); } else if (cmd.equals(CMD_NAV_SMALLZOOMIN)) { getNavigatedDisplay().zoom(ZOOM_FACTOR); } else if (cmd.equals(CMD_NAV_SMALLZOOMOUT)) { getNavigatedDisplay().zoom(1.0 / ZOOM_FACTOR); } else if (cmd.equals(CMD_NAV_SMALLROTATELEFT)) { getNavigatedDisplay().rotateZ(-2.0); } else if (cmd.equals(CMD_NAV_SMALLROTATERIGHT)) { getNavigatedDisplay().rotateZ(2.0); } else if (cmd.equals(CMD_NAV_SMALLTILTUP)) { getNavigatedDisplay().rotateX(-2.0); } else if (cmd.equals(CMD_NAV_SMALLTILTDOWN)) { getNavigatedDisplay().rotateX(2.0); } else if (cmd.equals(CMD_NAV_SMALLRIGHT)) { getNavigatedDisplay().translate(-0.02, 0.0); } else if (cmd.equals(CMD_NAV_SMALLLEFT)) { getNavigatedDisplay().translate(0.02, 0.0); } else if (cmd.equals(CMD_NAV_SMALLUP)) { getNavigatedDisplay().translate(0.0, -0.02); } else if (cmd.equals(CMD_NAV_SMALLDOWN)) { getNavigatedDisplay().translate(0.0, 0.02); } else { super.actionPerformed(event); return; } checkHistoryMatrix(); }
/** * The BooleanProperty identified byt he given id has changed. Apply the change to the display. * * @param id Id of the changed BooleanProperty * @param value Its new value * @throws Exception problem handeling the change */ protected void handleBooleanPropertyChange(String id, boolean value) throws Exception { if (id.equals(PREF_SHOWCURSOR)) { if (readout != null) { readout.setActive(value); } } else if (id.equals(PREF_3DCLIP)) { if (hasDisplayMaster()) { getNavigatedDisplay().enableClipping(value); } } else { super.handleBooleanPropertyChange(id, value); } }