Ejemplo n.º 1
0
  /** This is the entry point method. */
  @Override
  public void onModuleLoad() {

    FormUtil.setupUncaughtExceptionHandler();

    FormUtil.retrieveUserDivParameters();

    Context.startup();

    // FormDesignerWidget designer = new FormDesignerWidget(true,true,true);

    // Hook the window resize event, so that we can adjust the UI.
    Window.addResizeHandler(this);

    // Get rid of scrollbars, and clear out the window's built-in margin,
    // because we want to take advantage of the entire client area.
    Window.enableScrolling(false);
    Window.setMargin("0px");

    // Different themes use different background colors for the body
    // element, but IE only changes the background of the visible content
    // on the page instead of changing the background color of the entire
    // page. By changing the display style on the body element, we force
    // IE to redraw the background correctly.
    RootPanel.getBodyElement().getStyle().setProperty("display", "none");
    RootPanel.getBodyElement().getStyle().setProperty("display", "");

    // Finally, add the designer widget to the RootPanel, so that it will be
    // displayed.
    RootPanel.get().add(loginView);

    FormUtil.dlg
        .hide(); // Temporary fix This comes from the form designer where it loads and never closes
  }
  private void showSettingsPanel(Settings settings) {

    final SettingsPopupPanel panel = new SettingsPopupPanel(settings);
    panel.setModal(true);
    panel.setPopupPosition(
        RootPanel.getBodyElement().getClientWidth() / 2 - 150,
        RootPanel.getBodyElement().getClientHeight() / 2 - 150);
    panel.show();
    panel.addCloseHandler(
        new CloseHandler<PopupPanel>() {

          @Override
          public void onClose(CloseEvent<PopupPanel> event) {
            // Send notification???
          }
        });
  }
Ejemplo n.º 3
0
  private void initGUI(final GUIInfo info) {
    // Prepare a value manager that will include all forms spanned in each
    // tab
    vm = new ValuesManager();

    // Create all the tabs each one for a specific setup step
    tabs = new TabSet();
    tabs.setWidth(500);
    tabs.setHeight(250);

    Tab registrationTab = setupRegistration(vm);
    Tab repositoryTab = setupRepository(vm);
    Tab databaseTab = setupDatabase(vm);
    Tab languageTab = setupLanguage(vm);
    Tab smtpTab = setupSmtp(vm);
    tabs.setTabs(registrationTab, repositoryTab, databaseTab, languageTab, smtpTab);

    // This is the button used to confirm each step
    submit = new IButton();
    submit.setTitle(I18N.message("next"));
    submit.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onSubmit(info);
          }
        });

    // Prepare the heading panel with Logo and Title
    // Prepare the logo image to be shown inside the login form
    Label header = new Label(I18N.message("setup"));
    header.setStyleName("setupHeader");
    header.setIcon(Util.brandUrl("logo.png"));
    header.setIconWidth(205);
    header.setIconHeight(40);
    header.setHeight(45);

    // Prepare a panel to layout setup components
    VLayout layout = new VLayout();
    layout.setHeight(500);
    layout.setWidth(400);
    layout.setMembersMargin(5);
    layout.addMember(header);
    layout.addMember(tabs);
    layout.addMember(submit);

    // Panel for horizontal centering
    VLayout vPanel = new VLayout();
    vPanel.setDefaultLayoutAlign(Alignment.CENTER);
    vPanel.setWidth100();
    vPanel.setHeight(300);
    vPanel.addMember(layout);

    RootPanel.get().add(vPanel);

    // Remove the loading frame
    RootPanel.getBodyElement().removeChild(RootPanel.get("loadingWrapper").getElement());
  }
Ejemplo n.º 4
0
  @Override
  protected void gwtSetUp() throws Exception {

    // Kinetic needs a special div in the DOM
    Element div = DOM.createDiv();
    RootPanel.getBodyElement().appendChild(div);

    // Setup stage
    stage = Kinetic.createStage(div, 400, 400);
    layer = Kinetic.createLayer();
    stage.add(layer);
  }
Ejemplo n.º 5
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);
      }
    }
  }
Ejemplo n.º 6
0
  /**
   * Updates the auto hide partner from the parent widget.
   *
   * <p>If there is any invalid user input the parent widget should not be closed automatically.
   *
   * <p>
   */
  protected void updateCloseBehavior() {

    if (isEnabled()) {
      if (!m_isValidTime && isValidTime()) {
        m_isValidTime = true;
        m_popup.setAutoHideEnabled(true);
      } else if (m_isValidTime && !isValidTime()) {
        m_isValidTime = false;
        m_popup.setAutoHideEnabled(false);
      }

      if (!m_isValidDateBox && isValideDateBox()) {
        m_isValidDateBox = true;
        if (m_autoHideParent != null) {
          m_autoHideParent.removeAutoHidePartner(RootPanel.getBodyElement().getParentElement());
        }
      } else if (m_isValidDateBox && !isValideDateBox()) {
        m_isValidDateBox = false;
        if (m_autoHideParent != null) {
          m_autoHideParent.addAutoHidePartner(RootPanel.getBodyElement().getParentElement());
        }
      }
    }
  }
 @Override
 public void findCourse() {
   iFilter.setAriaLabel(
       isAllowFreeTime() ? ARIA.courseFinderFilterAllowsFreeTime() : ARIA.courseFinderFilter());
   AriaStatus.getInstance().setText(ARIA.courseFinderDialogOpened());
   if (iTabs != null) for (CourseFinderTab tab : iTabs) tab.changeTip();
   center();
   RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
   Scheduler.get()
       .scheduleDeferred(
           new ScheduledCommand() {
             public void execute() {
               iFilter.setFocus(true);
             }
           });
 }
Ejemplo n.º 8
0
  public static void cleanUI() {

    Element bodyElem = RootPanel.getBodyElement();

    List<Element> toRemove = new ArrayList<Element>();
    for (int i = 0, n = DOM.getChildCount(bodyElem); i < n; ++i) {
      Element elem = DOM.getChild(bodyElem, i);
      String nodeName = getNodeName(elem);
      if (!"script".equals(nodeName) && !"iframe".equals(nodeName)) {
        toRemove.add(elem);
      }
    }

    for (int i = 0, n = toRemove.size(); i < n; ++i) {
      DOM.removeChild(bodyElem, toRemove.get(i));
    }

    // RootPanel.get().clear();
  }
Ejemplo n.º 9
0
  @Override
  public void onModuleLoad() {
    SafeHtmlUserInterface<User> ui;

    //    // When bypassing the magic-method, we need a lot of reflection to make a template work.
    //    GwtReflect.magicClass(UserToDiv.class);
    //    GwtReflect.magicClass(AlwaysTrue.class);
    //    GwtReflect.magicClass(ToHtmlUiRenderer.class);
    //    GwtReflect.magicClass(SafeHtmlUserInterface.class);
    //    GwtReflect.magicClass(UserModel.class);
    //    GwtReflect.magicClass(User.class);
    //
    //
    //    UserInterfaceFactory factory =
    // X_Inject.<UserInterfaceFactory>instance(UserInterfaceFactory.class);
    //    ui = factory.createUi(UserToDiv.class, SafeHtmlUserInterface.class);
    ui =
        X_AutoUi.<User, SafeHtmlUserInterface<User>>makeUi(
            null, UserToDiv.class, SafeHtmlUserInterface.class);

    X_Log.info(getClass(), ui, "" + ui.renderUi(new UserModel("email", "id", "name")));

    RootPanel.getBodyElement().setInnerHTML(ui.getSafeHtmlBuilder().toSafeHtml().asString());
  }
Ejemplo n.º 10
0
  /** This is the entry point method. */
  public void onModuleLoad() {
    // Pointer to CSS manager. It has to go first!
    GWT.<Resources>create(Resources.class).css().ensureInjected();
    // Log messages
    logger.fine("Loading eMarkingWeb interface");
    logger.fine(Navigator.getPlatform());
    logger.fine(Navigator.getUserAgent());
    logger.fine(Navigator.getAppName());
    logger.fine(Navigator.getAppCodeName());
    logger.fine(Navigator.getAppVersion());

    // List of errors after trying to initialize
    ArrayList<String> errors = new ArrayList<String>();

    // Get id for eMarkingWeb's DIV tag
    final String eMarkingDivId = "emarking";
    if (RootPanel.get(eMarkingDivId) == null) {
      errors.add("Can not initalize. eMarkingWeb requires an existing DIV tag with id: emarking.");
      return;
    }

    RootPanel.get(eMarkingDivId).add(new Label("Loading"));

    int draftId = 0;
    int preferredWidth = 860;
    boolean showRubric = true;
    boolean showColors = false;

    try {
      // First, if there's a URL parameter, replace the value
      if (Window.Location.getParameter("id") != null) {
        draftId = Integer.parseInt(Window.Location.getParameter("id"));
      }

      // Validate that the submission id is a positive integer
      if (draftId <= 0) {
        errors.add("Submission id must be a non negative integer.");
      }

      String cookie_width = Cookies.getCookie("emarking_width");

      if (cookie_width != null) {
        preferredWidth = Integer.parseInt(cookie_width);
      }

      // Validate that the preferredWidth is a positive integer greater than 10
      if (preferredWidth <= 10) {
        errors.add("Preferred width should be a positive integer greater than 10.");
      }

      // Validate that the preferredWidth is a positive integer greater than 10
      if (preferredWidth <= 10) {
        errors.add("Preferred width should be a positive integer greater than 10.");
      }

      String cookie_showrubric = Cookies.getCookie("emarking_showrubric");

      if (cookie_showrubric != null) {
        showRubric = Integer.parseInt(cookie_showrubric) == 1;
      }

      String cookie_showcolors = Cookies.getCookie("emarking_showcolors");

      if (cookie_showcolors != null) {
        showColors = Integer.parseInt(cookie_showcolors) == 1;
      }

      logger.fine(
          "ShowRubric: "
              + showRubric
              + " Show colors:"
              + showColors
              + " Preferred width:"
              + preferredWidth);
    } catch (Exception e) {
      logger.severe(e.getMessage());
      errors.add(
          "Error in HTML for eMarkingWeb can not initalize. Invalid submissionId value (must be integer).");
    }

    // Read div attribute for readonly
    String moodleurl = null;
    if (RootPanel.get(eMarkingDivId).getElement().getAttribute("moodleurl") != null)
      moodleurl = RootPanel.get(eMarkingDivId).getElement().getAttribute("moodleurl");
    logger.fine("Moodle ajax url: " + moodleurl);

    if (moodleurl == null) errors.add("Invalid Moodle ajax url");

    // If there are errors die with a configuration message
    if (errors.size() > 0) {
      Label errorsLabel = new Label();
      String text = "";
      for (int i = 0; i < errors.size(); i++) {
        text += "\n" + errors.get(i);
      }
      errorsLabel.setText(text);
      errorsLabel.setTitle("Fatal error while initializing eMarking-Web");

      RootPanel.get(eMarkingDivId).clear();
      RootPanel.get(eMarkingDivId).add(errorsLabel);
    } else {
      // Set eMarking's main interface submission id according to HTML
      MarkingInterface.setDraftId(draftId);

      EMarkingConfiguration.setShowRubricOnLoad(showRubric);
      EMarkingConfiguration.setColoredRubric(showColors);

      // Ajax URL in moodle
      AjaxRequest.moodleUrl = moodleurl;

      // Automagically resize popup to use most of the window
      int width = screenWidth();
      int height = screenHeight();

      // Preferred width can not be bigger than the screen
      if (width < preferredWidth) {
        preferredWidth = width;
      }

      //  Resize the popup window and move it to the top left corner
      Window.resizeTo(preferredWidth, height);
      Window.moveTo(0, 0);

      // Initialize eMarking's interface
      markingInterface = new MarkingInterface();
      markingInterfacetwo = new MarkingInterface();

      // Add eMarking to the browser
      RootPanel.get(eMarkingDivId).clear();
      RootPanel.get(eMarkingDivId).add(markingInterface);
      RootPanel.getBodyElement().focus();
    }
  }