private Perspective getTmpPerspective(Perspective fallback) { for (Perspective perspective : tmpPerspectives) { if (perspective.getId().equals("tmp")) { return perspective; } } return fallback; }
private static boolean algebraVisible(Perspective p2) { if (p2 == null || p2.getDockPanelData() == null) { return false; } for (DockPanelData dp : p2.getDockPanelData()) { if (dp.getViewId() == App.VIEW_ALGEBRA) { return dp.isVisible() && !dp.isOpenInFrame(); } } return false; }
/** * Check if just the euclidian view is visible in the document just loaded. * * @return */ private boolean isJustEuclidianVisible() { if (tmpPerspectives == null) { return true; } Perspective docPerspective = getTmpPerspective(null); if (docPerspective == null) { return true; } boolean justEuclidianVisible = false; for (DockPanelData panel : docPerspective.getDockPanelData()) { if ((panel.getViewId() == App.VIEW_EUCLIDIAN) && panel.isVisible()) { justEuclidianVisible = true; } else if (panel.isVisible()) { justEuclidianVisible = false; break; } } return justEuclidianVisible; }
@Override public void afterLoadFileAppOrNot() { closePerspectivesPopup(); if (!getLAF().isSmart()) { removeSplash(); } String perspective = getArticleElement().getDataParamPerspective(); if (!isUsingFullGui()) { if (showConsProtNavigation() || !isJustEuclidianVisible() || perspective.length() > 0) { useFullGui = true; } } frame.setApplication(this); if (!isUsingFullGui()) { buildSingleApplicationPanel(); } else { ((DockManagerW) getGuiManager().getLayout().getDockManager()).init(frame); Perspective p = null; if (perspective != null) { p = PerspectiveDecoder.decode( perspective, this.getKernel().getParser(), ToolBar.getAllToolsNoMacros(true, false, this)); } getGuiManager().updateFrameSize(); if (articleElement.getDataParamShowAlgebraInput(false)) { Perspective p2 = getTmpPerspective(p); if (!algebraVisible(p2) && getInputPosition() == InputPosition.algebraView) { setInputPosition(InputPosition.bottom, false); p2.setInputPosition(InputPosition.bottom); } } getGuiManager().getLayout().setPerspectives(getTmpPerspectives(), p); } getScriptManager().ggbOnInit(); // put this here from Application // constructor because we have to delay // scripts until the EuclidianView is // shown initUndoInfoSilent(); getEuclidianView1().synCanvasSize(); getAppletFrame().resetAutoSize(); getEuclidianView1().doRepaint2(); stopCollectingRepaints(); frame.splash.canNowHide(); if (!articleElement.preventFocus()) { requestFocusInWindow(); } if (isUsingFullGui()) { if (needsSpreadsheetTableModel()) { getSpreadsheetTableModel(); } refreshSplitLayoutPanel(); // probably this method can be changed by more, // to be more like AppWapplication's method with the same name, // but preferring to change what is needed only to avoid new unknown // bugs if (getGuiManager().hasSpreadsheetView()) { DockPanel sp = getGuiManager().getLayout().getDockManager().getPanel(App.VIEW_SPREADSHEET); if (sp != null) { sp.deferredOnResize(); } } } if (isUsingFullGui()) { updateNavigationBars(); } this.setPreferredSize(new GDimensionW((int) this.getWidth(), (int) this.getHeight())); setDefaultCursor(); GeoGebraFrameW.useDataParamBorder(getArticleElement(), frame); GeoGebraProfiler.getInstance().profileEnd(); onOpenFile(); showStartTooltip(0); setAltText(); adjustViews(); kernel.notifyScreenChanged(); }