/** * Initializes a new hierarchy of partial discs according to a tree of cluster nodes and other * parameters. * * @param <E> Concrete Type of IHierarchyData * @param tree Tree of hierarchy data objects which is used to build the partial disc tree. * @param idType IDType of the hierarchy data objects. * @param dataEventManager Concrete DataEventManager that is responsible for handling and * triggering data specific events. * @param alColorModes List of drawing strategies that shall be used as color modes. */ public <E extends AHierarchyElement<E>> void initHierarchy( Tree<E> tree, E heRoot, ADataEventManager dataEventManager, ArrayList<EPDDrawingStrategyType> alColorModes) { hashPartialDiscs.clear(); selectionManager = new SelectionManager(tree.getNodeIDType()); partialDiscTree = new Tree<PartialDisc>(); navigationHistory.reset(); drawingController.setDrawingState(EDrawingStateType.DRAWING_STATE_FULL_HIERARCHY); LabelManager.get().clearLabels(); drawingStrategyManager.init(pickingManager, uniqueID, alColorModes); PartialDisc pdRoot = new PartialDisc( partialDiscTree, heRoot, drawingStrategyManager.getDefaultDrawingStrategy()); partialDiscTree.setRootNode(pdRoot); partialDiscTree.setLeafIDType(tree.getLeaveIDType()); partialDiscTree.setNodeIDType(tree.getNodeIDType()); hashPartialDiscs.put(heRoot.getID(), pdRoot); // selectionManager.initialAdd(heRoot.getID()); buildTree(tree, heRoot, pdRoot); pdRoot.calculateLargestChildren(); iMaxDisplayedHierarchyDepth = DISP_HIER_DEPTH_DEFAULT; this.dataEventManager = dataEventManager; this.dataEventManager.registerEventListeners(); pdCurrentRootElement = pdRoot; pdCurrentSelectedElement = pdRoot; pdRealRootElement = pdRoot; navigationHistory.addNewHistoryEntry( drawingController.getCurrentDrawingState(), pdCurrentRootElement, pdCurrentSelectedElement, iMaxDisplayedHierarchyDepth); selectionManager.addToType(SelectionType.SELECTION, pdCurrentRootElement.getElementID()); controlBox = new Rectangle(0, 0, 0.3f, 0.2f); upwardNavigationSlider = new OneWaySlider( new Vec2f(controlBox.getMinX() + 0.1f, controlBox.getMinY() + 0.1f), 0.2f, 1f, pdRealRootElement.getHierarchyLevel(), 1, 0, pdRealRootElement.getDepth() - 1); upwardNavigationSlider.setMinSize(80); }
/* * (non-Javadoc) * * @see org.lobobrowser.ua.NavigatorWindowListener#documentAccessed(org. * lobobrowser .ua.NavigatorWindowEvent) */ @Override public void documentAccessed(NavigatorWindowEvent event) { URL url = event.getUrl(); if ("GET".equals(event.getMethod()) && isHistoryRequest(event.getRequestType())) { NavigationHistory.getInstance().addAsRecent(url, null); } }
@Override public ASerializedView getSerializableRepresentation() { SerializedRadialHierarchyView serializedForm = new SerializedRadialHierarchyView(this); serializedForm.setMaxDisplayedHierarchyDepth(iMaxDisplayedHierarchyDepth); serializedForm.setNewSelection(bIsNewSelection); serializedForm.setDefaultDrawingStrategyType( drawingStrategyManager.getDefaultDrawingStrategy().getDrawingStrategyType()); ADrawingState currentDrawingState = drawingController.getCurrentDrawingState(); if (pdCurrentRootElement != null) { if ((currentDrawingState.getType() == EDrawingStateType.DRAWING_STATE_DETAIL_OUTSIDE) || (currentDrawingState.getType() == EDrawingStateType.DRAWING_STATE_FULL_HIERARCHY)) { serializedForm.setDrawingStateType(currentDrawingState.getType()); serializedForm.setRootElementID(pdCurrentRootElement.getElementID()); serializedForm.setSelectedElementID(pdCurrentSelectedElement.getElementID()); serializedForm.setRootElementStartAngle(pdCurrentRootElement.getCurrentStartAngle()); serializedForm.setSelectedElementStartAngle( pdCurrentSelectedElement.getCurrentStartAngle()); } else { HistoryEntry historyEntry = navigationHistory.getCurrentHistoryEntry(); serializedForm.setDrawingStateType(historyEntry.getDrawingState().getType()); serializedForm.setRootElementID(historyEntry.getRootElement().getElementID()); serializedForm.setSelectedElementID(historyEntry.getSelectedElement().getElementID()); serializedForm.setRootElementStartAngle(historyEntry.getRootElementStartAngle()); serializedForm.setSelectedElementStartAngle(historyEntry.getSelectedElementStartAngle()); } } return serializedForm; }
/** Constructor. */ public GLRadialHierarchy(IGLCanvas glCanvas, ViewFrustum viewFrustum) { super(glCanvas, viewFrustum, VIEW_TYPE, VIEW_NAME); ArrayList<SelectionType> alSelectionTypes = new ArrayList<SelectionType>(); alSelectionTypes.add(SelectionType.NORMAL); alSelectionTypes.add(SelectionType.MOUSE_OVER); alSelectionTypes.add(SelectionType.SELECTION); renderStyle = new RadialHierarchyRenderStyle(viewFrustum); renderStyle.setMinViewDimensions( MIN_DISPLAY_WIDTH + MIN_PIXELS_PER_DISPLAYED_LEVEL * DISP_HIER_DEPTH_DEFAULT, MIN_DISPLAY_HEIGHT + MIN_PIXELS_PER_DISPLAYED_LEVEL * DISP_HIER_DEPTH_DEFAULT, this); hashPartialDiscs = new HashMap<Integer, PartialDisc>(); partialDiscTree = new Tree<PartialDisc>(); // iMaxDisplayedHierarchyDepth = DISP_HIER_DEPTH_DEFAULT; navigationHistory = new NavigationHistory(this, null); drawingController = new DrawingController(this, navigationHistory); drawingStrategyManager = new DrawingStrategyManager(dataDomain.getTable().getColorMapper()); navigationHistory.setDrawingController(drawingController); iUpwardNavigationSliderButtonID = 0; iUpwardNavigationSliderID = 0; iUpwardNavigationSliderBodyID = 0; glKeyListener = new GLRadialHierarchyKeyListener(this); bIsAnimationActive = false; // bIsNewSelection = false; }
/** * Sets the maximum displayed hierarchy depth. * * @param iMaxDisplayedHierarchyDepth */ public void setMaxDisplayedHierarchyDepth(int iMaxDisplayedHierarchyDepth) { if (this.iMaxDisplayedHierarchyDepth != iMaxDisplayedHierarchyDepth) { renderStyle.setMinViewDimensions( MIN_DISPLAY_WIDTH + MIN_PIXELS_PER_DISPLAYED_LEVEL * iMaxDisplayedHierarchyDepth, MIN_DISPLAY_HEIGHT + MIN_PIXELS_PER_DISPLAYED_LEVEL * iMaxDisplayedHierarchyDepth, this); bIsNewSelection = false; this.iMaxDisplayedHierarchyDepth = iMaxDisplayedHierarchyDepth; navigationHistory.setCurrentMaxDisplayedHierarchyDepth(iMaxDisplayedHierarchyDepth); setDisplayListDirty(); } }
/** * Gets the chronology menu. * * @return the chronology menu */ public JMenu getChronologyMenu() { JMenu menu = new JMenu("Recent Hosts"); menu.removeAll(); Collection<HostEntry> hostEntries = NavigationHistory.getInstance().getRecentHostEntries(PREFERRED_MAX_MENU_SIZE); for (HostEntry entry : hostEntries) { String urlText = "http://" + entry.getHost(); try { URL url = new URL(urlText); long elapsed = System.currentTimeMillis() - entry.getTimestamp(); String menuText = entry.getHost() + " (" + Timing.getElapsedText(elapsed) + " ago)"; Action action = this.actionPool.createNavigateAction(url); JMenuItem menuItem = menuItem(menuText, action); menuItem.setToolTipText(url.toExternalForm()); menu.add(menuItem); } catch (MalformedURLException mfu) { logger.log(Level.WARNING, "populateRecentHosts(): Bad URL=" + urlText, mfu); } } menu.addSeparator(); menu.add(menuItem("Show All Recent Hosts", new ShowRecentHostsAction(this, window))); return menu; }
/** * Updates the current root element according to the position of the upward navigation silder, * i.e. a parent of the current root element with the hierarchy level of the slider position will * be the new root element. */ private void updateHierarchyAccordingToNavigationSlider() { PartialDisc pdNewRootElement = pdCurrentRootElement.getParentWithLevel(upwardNavigationSlider.getSelectedValue()); if (pdNewRootElement != null) { pdCurrentRootElement = pdNewRootElement; bIsNewSelection = true; PartialDisc pdSelectedElement = drawingController.getCurrentDrawingState().getSelectedElement(); if (pdSelectedElement != null) { pdCurrentSelectedElement = pdSelectedElement; pdSelectedElement.setCurrentStartAngle(0); } navigationHistory.addNewHistoryEntry( drawingController.getCurrentDrawingState(), pdCurrentRootElement, pdCurrentSelectedElement, iMaxDisplayedHierarchyDepth); setDisplayListDirty(); setNewSelection(SelectionType.SELECTION, pdCurrentSelectedElement); } }
/** * Checks for recent entries. * * @return true, if successful */ public boolean hasRecentEntries() { return NavigationHistory.getInstance().hasRecentEntries(); }
/** * Gets the recent locations. * * @param max the max * @return the recent locations */ public Collection<String> getRecentLocations(int max) { return NavigationHistory.getInstance().getRecentItems(max); }
/** * Gets the potential matches. * * @param urlPrefix the url prefix * @param max the max * @return the potential matches */ public Collection<String> getPotentialMatches(String urlPrefix) { return NavigationHistory.getInstance().getHeadMatchItems(urlPrefix); }
/** Go one step back in navigation history. */ public void goForthInHistory() { // handleMouseOver(10); navigationHistory.goForth(); }
/** Go one step back in navigation history. */ public void goBackInHistory() { navigationHistory.goBack(); }