示例#1
0
  /**
   * **************************************************** Constructs AppW for applets
   *
   * @param undoActive if true you can undo by CTRL+Z and redo by CTRL+Y
   * @param ae article element
   * @param gf frame
   * @param dimension 3 for 3d, 2 otherwise
   * @param laf look and feel
   */
  public AppWapplet(
      ArticleElement ae,
      GeoGebraFrameBoth gf,
      final boolean undoActive,
      int dimension,
      GLookAndFeel laf) {
    super(ae, dimension, laf, null);
    this.frame = gf;
    setAppletHeight(frame.getComputedHeight());
    setAppletWidth(frame.getComputedWidth());

    this.useFullGui =
        !isApplet()
            || ae.getDataParamShowAlgebraInput(false)
            || ae.getDataParamShowToolBar(false)
            || ae.getDataParamShowMenuBar(false)
            || ae.getDataParamEnableRightClick();

    Log.info(
        "GeoGebra "
            + GeoGebraConstants.VERSION_STRING
            + " "
            + GeoGebraConstants.BUILD_DATE
            + " "
            + Window.Navigator.getUserAgent());
    initCommonObjects();
    initing = true;

    this.euclidianViewPanel = new EuclidianDockPanelW(this, allowStylebar());
    // (EuclidianDockPanelW)getGuiManager().getLayout().getDockManager().getPanel(App.VIEW_EUCLIDIAN);
    this.canvas = this.euclidianViewPanel.getCanvas();
    canvas.setWidth("1px");
    canvas.setHeight("1px");
    canvas.setCoordinateSpaceHeight(1);
    canvas.setCoordinateSpaceWidth(1);
    initCoreObjects(undoActive, this);
    afterCoreObjectsInited();
    resetFonts();
    Browser.removeDefaultContextMenu(this.getArticleElement());
    if (ae.getDataParamApp() && !this.getLAF().isSmart()) {
      RootPanel.getBodyElement().addClassName("application");
    }
    if (this.showMenuBar()) {
      // opening file -> this was inited before
      if (getLoginOperation() == null) {
        initSignInEventFlow(new LoginOperationW(this), ae.isEnableUsageStats());
      }
    } else {
      if (Browser.runningLocal() && ae.isEnableUsageStats()) {
        new GeoGebraTubeAPIWSimple(has(Feature.TUBE_BETA)).checkAvailable(null);
      }
    }
  }
示例#2
0
 private void refreshSplitLayoutPanel() {
   if (frame != null
       && frame.getWidgetCount() != 0
       && frame.getWidgetIndex(getSplitLayoutPanel()) == -1
       && frame.getWidgetIndex(oldSplitLayoutPanel) != -1) {
     int wi = frame.getWidgetIndex(oldSplitLayoutPanel);
     frame.remove(oldSplitLayoutPanel);
     frame.insert(getSplitLayoutPanel(), wi);
     oldSplitLayoutPanel = getSplitLayoutPanel();
     Browser.removeDefaultContextMenu(getSplitLayoutPanel().getElement());
   }
 }
示例#3
0
 /**
  * When using the default functionality of the browser, getting/setting clipboard contents is
  * solved quite well, and it uses the external clipboard. Thus this method is redundant in case
  * it's called from paste event! For the same reason, it is not called from there.
  *
  * <p>However, we may call the same thing from GeoGebraWeb context menu, and in that case the form
  * of this method is just Okay.
  *
  * @return String
  */
 public static String getClipboardContents(Runnable onFocusChange) {
   String clipboard = null;
   if (isChromeWebapp()) { // use chrome web app paste API
     clipboard = getSystemClipboardChromeWebapp();
     if (onFocusChange != null) {
       onFocusChange.run();
     }
   } else if (Browser.isInternetExplorer()) {
     clipboard = getSystemClipboardIE();
   } else { // use internal clipboard
     clipboard = staticClipboardString;
   }
   return clipboard;
 }
示例#4
0
  /**
   * When using the default functionality of the browser, getting/setting clipboard contents is
   * solved quite well, and it uses the external clipboard. Thus this method is redundant in case
   * it's called from copy or cut events, maybe does the same thing twice in Internet Explorer.
   *
   * <p>However, we may call the same thing from GeoGebraWeb context menu, and in that case the form
   * of this method is just Okay. Note that in order to make the staticClipboardString function well
   * from context menu, we need to set it every case this method is called, and every case the
   * cut/paste events happen.
   *
   * @param value String
   */
  public static void setClipboardContents(String value, Runnable onFocusChange) {
    if (isChromeWebapp()) { // use chrome web app copy API
      copyToSystemClipboardChromeWebapp(value);
      if (onFocusChange != null) {
        onFocusChange.run();
      }
    } else if (Browser.isInternetExplorer()) {
      // App.debug("is IE");
      copyToSystemClipboardIE(value);
    }
    // use internal clipboard too, every time
    staticClipboardString = value;

    copyToSystemClipboard(value);
  }
示例#5
0
  private void attachSplitLayoutPanel() {
    boolean oldSLPanelChanged = oldSplitLayoutPanel == getSplitLayoutPanel() ? false : true;
    oldSplitLayoutPanel = getSplitLayoutPanel();

    if (oldSplitLayoutPanel != null) {
      if (getArticleElement().getDataParamShowMenuBar(false)) {
        this.splitPanelWrapper = new HorizontalPanel();
        // TODO
        splitPanelWrapper.add(oldSplitLayoutPanel);
        if (this.menuShowing) {
          splitPanelWrapper.add(frame.getMenuBar(this));
        }
        frame.add(splitPanelWrapper);

      } else {
        frame.add(oldSplitLayoutPanel);
      }
      Browser.removeDefaultContextMenu(getSplitLayoutPanel().getElement());

      if (has(Feature.FIX_KEYBOARD_POSITION) && !oldSLPanelChanged) {
        return;
      }

      ClickStartHandler.init(
          oldSplitLayoutPanel,
          new ClickStartHandler() {
            @Override
            public void onClickStart(int x, int y, final PointerEventType type) {
              updateAVStylebar();

              if (!CancelEventTimer.cancelKeyboardHide()) {
                Timer timer =
                    new Timer() {
                      @Override
                      public void run() {
                        getAppletFrame().keyBoardNeeded(false, null);
                      }
                    };
                timer.schedule(0);
              }
            }
          });
    }
  }