public boolean semanticEventBefore(SemanticEvent se, String msg) { String title = getAttr("title"); if (super.semanticEventBefore(se, msg)) return true; else if (triggerMsg_ == msg && title != null) { INode menu = (INode) se.getOut(); SemanticEvent nse = new SemanticEvent( getBrowser(), MSG_NEW, this); // rather than "event newVWindow "+winclass so can use == below, and rather // than ...+winclass because may have several instances all creating // SignalVWindow'es createUI("button", title, nse, menu, "Tool", false); } return false; }
public boolean semanticEventAfter(SemanticEvent se, String msg) { // System.out.println("outlineOpen on active_="+active_+", msg="+msg); if (Outliner.MSG_MADE == msg) { Object o = se.getArg(); if (o instanceof Node) { active_ = true; ((Node) o).addObserver(this); Browser br = getBrowser(); br.eventq(new SemanticEvent(br, Executive.MSG_SUMMARY, "ON")); } } else if (!active_) { // nothing -- page fully on screen } else if (DocumentPopup.MSG_CREATE_DOCPOPUP == msg && se.getIn() != getBrowser().getSelectionSpan()) { // null)) { -- just plain-doc popup // System.out.println("**** f/b createMenu "+super.toString()+", in="+se.getIn()); INode menu = (INode) se.getOut(); createUI( "button", "Fully Collapse Outline", "event " + OutlineSpan.MSG_CLOSE_ALL, menu, "SPECIFIC", false); createUI( "button", "Fully Open (or Space to smart scroll)", "event " + Executive.MSG_SUMMARY + " OFF; event outlineOpenAll", menu, "SPECIFIC", false); /* } else if (msg.startsWith("outline")) { //if (first_/* && false* /) { CLGeneral gs = (CLGeneral)getDocument().getStyleSheet().get("excerpt"); if (gs.getSize()!=CLGeneral.INVALID) { gs.setElide(CLGeneral.BOOLINVALID); gs.setSize(CLGeneral.INVALID); for (Iterator<> i=excerptSpans_.iterator(); i.hasNext(); ) ((Span)i.next()).markDirty(); // Span class only marks dirty if set } //} */ } else if (OutlineSpan.MSG_OPEN == msg) { Object o = se.getArg(); if (o instanceof OutlineSpan) outActive_ = (OutlineSpan) o; // System.out.println("outlineOpen on "+o+" / "+outActive_.getStart().leaf.getNextLeaf()); } else if (Executive.MSG_SUMMARY == msg) { Object o = se.getArg(); if (o instanceof String) { // CLGeneral gs = (CLGeneral)getDocument().getStyleSheet().get("excerpt"); /* if ("ON".equalsIgnoreCase((String)o)) { gs.setElide(CLGeneral.FALSE); gs.setSize(10); outActive_=null; } else { gs.setElide(CLGeneral.BOOLINVALID); gs.setSize(CLGeneral.INVALID); }*/ StyleSheet ss = getDocument().getStyleSheet(); if (ssl_ == null) { ssl_ = new ArrayList<Object>(6); for (StyleSheet ssn = ss; ssn != null; ssn = ssn.getCascade()) { Object sse = ssn.get("excerpt"); if (sse != null) { ssl_.add(ssn); ssl_.add(sse); } } // if (excerpt_==null) excerpt_ = (CLGeneral)ss.get("excerpt"); } // System.out.println(ss.getName()+" => excerpt "+excerpt_); if ("ON".equalsIgnoreCase((String) o)) { for (int i = 0, imax = ssl_.size(); i < imax; i += 2) ((StyleSheet) ssl_.get(i)).put("excerpt", (ContextListener) ssl_.get(i + 1)); // ss.put("excerpt", excerpt_); outActive_ = null; // System.out.println("putting excerpt in "+getDocument().getFirstLeaf()+" // "+excerpt_.getSize()+" / "+excerpt_.getElide()); } else { // ss.remove("excerpt"); for (int i = 0, imax = ssl_.size(); i < imax; i += 2) ((StyleSheet) ssl_.get(i)).remove("excerpt"); } // for (Iterator<> i=excerptSpans_.iterator(); i.hasNext(); ) ((Span)i.next()).markDirty(); // -- execsum already reformats whole tree } } else if (Document.MSG_CLOSE == msg) { for (int i = 0, imax = ssl_.size(); i < imax; i += 2) ((StyleSheet) ssl_.get(i)).put("excerpt", (ContextListener) ssl_.get(i + 1)); // getDocument().getStyleSheet().put("excerpt", excerpt_); // stylesheet shared, so // restore! } return super.semanticEventAfter(se, msg); }