Exemple #1
0
  private void initOutputLocation() {
    // currently, the save location is populated deterministically by the combination of
    // the users's input

    final RootPanel outputPanel = RootPanel.get("output");
    output = new TextBox();
    output.setVisibleLength(150);
    output.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(final ChangeEvent event) {
            outputPathUserSpecified = true;
            updateOutputLocation();
          }
        });
    outputPanel.add(output);

    final RootPanel outputWarning = RootPanel.get("outputWarning");
    outputValidationPanel = new ValidationPanel(2);

    outputWarning.add(outputValidationPanel);

    connectOutputLocationAndFileTable();
    // Fire userChanged to get the output location updated
    userChanged();
    updateOutputLocation();
  }
  public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get();

    Image img = new Image("/PokerLogo.jpg");
    img.setSize("200px", "100px");
    rootPanel.add(img);

    LoginWidget login = new LoginWidget();
    login.setStyleName("LoginWidget");
    rootPanel.add(login);
  }
Exemple #3
0
 private void finalizeFileTableInit() {
   files = new FileTable();
   final RootPanel filePanel = RootPanel.get("fileTable");
   filePanel.add(files);
   connectOutputLocationAndFileTable();
   connectTitleAndFileTable();
 }
Exemple #4
0
  @SuppressWarnings("deprecation")
  private void intAuthorizedUserGUI() {
    final ClientFactory clientFactory = GWT.create(ClientFactory.class);
    SiteHeader header = clientFactory.getHeader();
    // user.setAdmin(true);
    if (user.getAdmin()) {
      header.setVisibleAdminButtons();
      header.setVisibleOperatorButtons();
    } else {
      header.setVisibleOperatorButtons(user.getRoles());
    }
    header.setVisibleFooterAndHeader();
    RootPanel rootLayoutPanel = RootPanel.get("container");
    rootLayoutPanel.add(contentPanel);
    contentPanel.setStyleName("content-container");

    ActivityMapper activityMapper = new CustomActivityMapper(clientFactory);
    ActivityManager activityManager =
        new ActivityManager(activityMapper, clientFactory.getEventBus());
    activityManager.setDisplay(contentPanel);

    PlaceHistoryHandler historyHandler =
        new PlaceHistoryHandler((PlaceHistoryMapper) GWT.create(CustomPlaceHistoryMapper.class));
    historyHandlerRegistration =
        historyHandler.register(
            clientFactory.getPlaceController(), clientFactory.getEventBus(), new AboutPagePlace());
    historyHandler.handleCurrentHistory();
    setWaitingBlockVisible(false);
  }
Exemple #5
0
  public void init(String rootPanelId, ApplicationConnection applicationConnection) {
    DOM.sinkEvents(getWidget().getElement(), Event.ONKEYDOWN | Event.ONSCROLL);

    // iview is focused when created so element needs tabIndex
    // 1 due 0 is at the end of natural tabbing order
    DOM.setElementProperty(getWidget().getElement(), "tabIndex", "1");

    RootPanel root = RootPanel.get(rootPanelId);

    // Remove the v-app-loading or any splash screen added inside the div by
    // the user
    root.getElement().setInnerHTML("");

    String themeName = applicationConnection.getConfiguration().getThemeName();
    // Remove chars that are not suitable for style names
    themeName = themeName.replaceAll("[^a-zA-Z0-9]", "");
    root.addStyleName(themeName);

    root.add(getWidget());

    if (applicationConnection.getConfiguration().isStandalone()) {
      // set focus to iview element by default to listen possible keyboard
      // shortcuts. For embedded applications this is unacceptable as we
      // don't want to steal focus from the main page nor we don't want
      // side-effects from focusing (scrollIntoView).
      getWidget().getElement().focus();
    }
  }
Exemple #6
0
 public void onModuleLoad() {
   RootPanel root = RootPanel.get();
   root.add(view);
   root.addDomHandler(view, KeyDownEvent.getType());
   controller.initAndStartWith(clock);
   view.initAndRender();
 }
  // PostData page contains a list of Posts
  //  Created when user clicks "View Posts"
  public void viewPostData(List<PostData> posts) {
    if (posts == null) return;

    RootPanel rootPanel = RootPanel.get();
    rootPanel.clear();
    makeMenuBar(rootPanel);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    rootPanel.add(horizontalPanel, 10, 79);

    makeSideBar(horizontalPanel);

    VerticalPanel dataListPanel = new VerticalPanel();
    horizontalPanel.add(dataListPanel);

    FlowPanel flowPanel = new FlowPanel();
    dataListPanel.add(flowPanel);

    Label programTitlebar = new Label("GusList");
    programTitlebar.addStyleName("appTitleBar");
    programTitlebar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flowPanel.add(programTitlebar);

    makePostTable(posts, flowPanel, dataListPanel);
  }
  @Override
  public void onModuleLoad() {

    // Add the chat widget
    RootPanel panel = RootPanel.get("ChatWidget");
    panel.add(new ChatWidget());
  }
  private void buildSuggestorSync(String query) {

    suggestor = new SuggestImpl(query);

    RootPanel rp = RootPanel.get();
    rp.add(suggestor);

    moveSuggestorTo(x, y);
  }
Exemple #10
0
  //  Welcome Page is main app page
  public void viewWelcomePage() {
    RootPanel rootPanel = RootPanel.get();
    rootPanel.clear();
    makeMenuBar(rootPanel);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    rootPanel.add(horizontalPanel, 10, 79);
    horizontalPanel.setSize("412px", "211px");

    makeSideBar(horizontalPanel);
  }
Exemple #11
0
 private void finalizeSpectrumQa(final List<SpectrumQaParamFileInfo> list) {
   if (list == null || list.isEmpty()) {
     DOM.setStyleAttribute(DOM.getElementById("spectrumQaRow"), "display", "none");
   } else {
     DOM.setStyleAttribute(DOM.getElementById("spectrumQaRow"), "display", "");
     spectrumQaSetupPanel = new SpectrumQaSetupPanel(list);
     final RootPanel rootSpectrumQaPanel = RootPanel.get("spectrumQa");
     rootSpectrumQaPanel.add(spectrumQaSetupPanel);
   }
   showPageContentsAfterLoad();
 }
  public void onModuleLoad() {

    Label lblHelloWorld = new Label("hello world");
    rootPanel.add(lblHelloWorld, 10, 10);

    Button btnNew = new Button("new");
    btnNew.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            AddOption();
          }
        });
    rootPanel.add(btnNew, 10, 33);
    btnNew.setSize("41px", "29px");

    rootPanel.add(verticalPanel, 10, 77);
    verticalPanel.setSize("100px", "100px");

    OptionBox optionBox = new OptionBox();
    verticalPanel.add(optionBox);
  }
 @Override
 protected void gwtSetUp() throws Exception {
   stepDelayMillis = 0;
   RootPanel rootPanel = RootPanel.get();
   rootPanel.getElement().getStyle().setHeight(800, Unit.PX);
   PickupDragController dragController = new PickupDragController(rootPanel, true);
   for (int i = 0; i < 8; i++) {
     FocusPanel panel = newRedFocusPanel(i);
     rootPanel.add(panel, i * 125, 0);
     dragController.makeDraggable(panel);
   }
 }
Exemple #14
0
  // Helper method to make row of menuss on top of View
  public void makeMenuBar(RootPanel rp) {
    MenuBar menuBar = new MenuBar(false);
    rp.add(menuBar, 94, 39);

    MenuItem menuHomeItem =
        new MenuItem(
            "Home",
            false,
            new Command() {
              public void execute() {
                viewWelcomePage();
              }
            });
    menuHomeItem.setHTML("Home");
    menuBar.addItem(menuHomeItem);
    menuBar.addSeparator(new MenuItemSeparator());

    MenuItem menuSearchItem =
        new MenuItem(
            "Search",
            false,
            new Command() {
              public void execute() {
                doPostSearch();
              }
            });
    menuSearchItem.setHTML("Search");
    menuBar.addItem(menuSearchItem);
    menuBar.addSeparator(new MenuItemSeparator());

    MenuItem menuSignOutItem =
        new MenuItem(
            "Log Out",
            false,
            new Command() {
              public void execute() {
                control.handleSignOutRequest();
              }
            });
    menuSignOutItem.setHTML("Log Out");
    menuBar.addItem(menuSignOutItem);
    menuBar.addSeparator(new MenuItemSeparator());

    MenuItem menuContactItem = new MenuItem("Contact", false, (Command) null);
    menuContactItem.setHTML("Contact");
    menuBar.addItem(menuContactItem);
    menuBar.addSeparator(new MenuItemSeparator());

    MenuItem menuHelpItem = new MenuItem("Help", false, (Command) null);
    menuHelpItem.setHTML("Help");
    menuBar.addItem(menuHelpItem);
  }
  public EditorController(String divID, int width, int height) {

    VerticalPanel vp = new VerticalPanel();
    HorizontalPanel hp = new HorizontalPanel();

    SimplePanel topToolBoxWrapper = new SimplePanel();

    ToggleButtonListener toggleButtonListener = new ToggleButtonListener();

    topToolBox = new TopToolBox(this, toggleButtonListener);
    topToolBox.setStyleName("jsmoleditor-topToolBox");

    topToolBoxWrapper.setWidget(topToolBox);
    topToolBoxWrapper.setStyleName("jsmoleditor-topTooBoxWrapper");
    topToolBoxWrapper.setWidth(width + "px");

    SimplePanel sideToolBoxWrapper = new SimplePanel();
    elementToolBox = new ElementToolBox(this, toggleButtonListener);

    sideToolBoxWrapper.setWidget(elementToolBox);
    sideToolBoxWrapper.setStyleName("jsmoleditor-elementToolBoxWrapper");
    sideToolBoxWrapper.setHeight((height - 24) + "px");

    VerticalPanel vp2 = new VerticalPanel();

    ExtendedCanvas canvas = new ExtendedCanvas(width - 24, height - 48);
    StatusBar statusBar = new StatusBar(width - 24, 24);
    statusBar.setHTML("Copyright chemhack.com");
    renderer = new CanvasRenderer(this, canvas);

    vp2.add(canvas);
    vp2.add(statusBar);

    hp.add(sideToolBoxWrapper);
    hp.add(vp2);

    vp.add(topToolBoxWrapper);
    vp.add(hp);

    RootPanel rootPanel = RootPanel.get(divID);
    rootPanel.setPixelSize(width, height);
    rootPanel.add(vp);

    KeyboardShortCutEventPreview preview =
        new KeyboardShortCutEventPreview(this); // TODO deal with multiple editor instance?

    DOM.addEventPreview(preview);

    EditorMouseListener listener = new EditorMouseListener(this);
    canvas.addMouseListener(listener);
    canvas.addMouseWheelListener(listener);
  }
Exemple #16
0
  public void viewPostEditForm(PostData post) {
    RootPanel rootPanel = RootPanel.get();
    rootPanel.clear();
    makeMenuBar(rootPanel);

    HorizontalPanel mainPanel = new HorizontalPanel();
    rootPanel.add(mainPanel, 10, 79);

    makeSideBar(mainPanel);

    FormPanel submitPanel = makeSubmitPostForm(post);
    mainPanel.add(submitPanel);
  }
Exemple #17
0
 private void finalizeInitReport(
     final Boolean reportEnabled, List<ClientSearchEngine> searchEngines) {
   boolean quameterEnabled = false;
   for (ClientSearchEngine engine : searchEngines) {
     if ("QUAMETER".equals(engine.getEngineConfig().getCode())) {
       quameterEnabled = true;
     }
   }
   if (reportEnabled || quameterEnabled) {
     DOM.setStyleAttribute(DOM.getElementById("reportingRow"), "display", "");
     final RootPanel rootPanel = RootPanel.get("report");
     if (quameterEnabled) {
       quameterCategorySelector = new QuameterCategorySelector(this, this);
       rootPanel.add(quameterCategorySelector);
     }
     if (reportEnabled) {
       reportSetupPanel = new ReportSetupPanel(quameterCategorySelector);
       rootPanel.add(reportSetupPanel);
     }
   } else {
     DOM.setStyleAttribute(DOM.getElementById("reportingRow"), "display", "none");
   }
 }
Exemple #18
0
 private void initEditorToggle() {
   final RootPanel togglePanel = RootPanel.get("paramsToggleButton");
   editorToggle =
       new ToggleButton(new Image("images/triright.png"), new Image("images/tridown.png"));
   editorToggle.setDown(false);
   editorToggle.addStyleName("toggle-button");
   togglePanel.add(editorToggle);
   editorToggle.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(final ClickEvent event) {
           paramsEditor.setEditorExpanded(editorToggle.isDown());
         }
       });
 }
  /** Shows an error message in the errorDiv. */
  protected void showError(String msg, String clientStackTrace, String serverStackTrace) {
    // First, clear whatever error might be currently displayed.
    clearError();

    // All error-related messages will be added to this flow panel.
    RootPanel errorDiv = RootPanel.get("ErrorDiv");
    // FlowPanel fPanel = new FlowPanel();
    // errorDiv.add(fPanel);

    // Add the principle error message.
    Label errorMsg = new Label(msg);
    errorMsg.setStyleName("ErrorMessage");
    errorDiv.add(errorMsg);

    RootPanel straceDiv = RootPanel.get("StackTraceDiv");
    FlowPanel fPanel = new FlowPanel();
    straceDiv.add(fPanel);

    // Client-side stack trace can be revealed/hidden.
    if (clientStackTrace != "") {
      DisclosurePanel strace = new DisclosurePanel("Client stack trace");
      strace.setAnimationEnabled(true);
      strace.setContent(new HTML(clientStackTrace.replace("\n", "<br/>")));
      strace.setStyleName("ClientExceptionTraceBack");
      fPanel.add(strace);
    }

    // Server-side stack trace can be revealed/hidden.
    if (serverStackTrace != "") {
      DisclosurePanel strace = new DisclosurePanel("Server stack trace");
      strace.setAnimationEnabled(true);
      strace.setContent(new HTML(serverStackTrace.replace("\n", "<br/>")));
      strace.setStyleName("ServerExceptionTraceBack");
      fPanel.add(strace);
    }
  }
 public MenuAndPresenterView(RootPanel rootPanel, Integer menuHeightDecreaser) {
   super();
   this.menuHeightDecreaser = menuHeightDecreaser;
   rootPanel.clear();
   rootPanel.add(uiBinder.createAndBindUi(this));
   workAreaPanel.add(getPresenterHolderPanel());
   Window.addResizeHandler(
       new ResizeHandler() {
         @Override
         public void onResize(ResizeEvent event) {
           resizeMenuPanel();
         }
       });
   resizeMenuPanel();
 }
Exemple #21
0
 private void initTitleEditor() {
   final RootPanel titlePanel = RootPanel.get("title");
   title.setVisibleLength(60);
   titlePanel.add(title);
   title.addKeyUpHandler(
       new KeyUpHandler() {
         @Override
         public void onKeyUp(final KeyUpEvent event) {
           userEditedTitle = true;
           updateOutputLocation();
         }
       });
   titleChangeListener = new TitleChangeListener();
   title.addChangeHandler(titleChangeListener);
 }
  private void init(RootPanel root) {
    MenuItem item;
    Command command =
        new Command() {
          public void execute() {
            Window.alert("Click");
          }
        };
    MenuBar menu = new MenuBar();
    MenuBar file = new MenuBar(true);
    MenuBar edit = new MenuBar(true);
    MenuBar view = new MenuBar(true);
    menu.addItem("File", file);
    MenuItem editItem = (MenuItem) menu.addItem("Edit", edit);
    menu.addItem("View", view);
    item = (MenuItem) menu.addItem("Help", command);
    item.setEnabled(false);

    file.addItem("Open", command);
    file.addItem("Close", command);
    file.addItem("Save", command);
    file.addItem("Exit", command);
    edit.addItem("Undo", command);
    edit.addItem("Redo", command);
    edit.addItem("Cut", command);
    edit.addItem("Copy", command);
    edit.addItem("Paste", command);
    editItem.setEnabled(false); // Disable after adding children so they get disabled too
    view.addItem("Date", true, command, MenuItem.Type.CHECK, false);
    view.addItem("Time", true, command, MenuItem.Type.CHECK, true);
    view.addSeparator();
    view.addItem("Radio 1", true, command, MenuItem.Type.RADIO, false);
    view.addItem("Radio 2", true, command, MenuItem.Type.RADIO, true);
    view.addSeparator();
    view.addItem("Radio 3", command, MenuItem.Type.RADIO, false, 1);
    view.addItem("Radio 4", command, MenuItem.Type.RADIO, true, 1);
    view.addSeparator();
    view.addItem("Description", command, MenuItem.Type.CHECK, false);
    view.addItem("Quantity", command, MenuItem.Type.CHECK, true);
    view.addSeparator();
    item = (MenuItem) view.addItem("Disabled", (Command) command, MenuItem.Type.INDENT);
    item.setEnabled(false);
    item = (MenuItem) view.addItem("Enabled", (Command) command, MenuItem.Type.INDENT);
    item.setEnabled(false);
    item.setEnabled(true);

    root.add(menu);
  }
 protected void onDraw() {
   // a GWT widget must be attached to a GWT Panel for its events to fire.
   boolean attached = widget.isAttached();
   if (!attached) {
     RootPanel rp = RootPanel.get(this.getID() + "_widget");
     rp.add(widget);
     String width = DOM.getStyleAttribute(widget.getElement(), "width");
     if (width != null && !width.equals("")) {
       setWidth(width);
     }
     String height = DOM.getStyleAttribute(widget.getElement(), "height");
     if (height != null && !height.equals("")) {
       setHeight(height);
     }
   }
 }
Exemple #24
0
  private void initUserList(final ClientUser[] list) {
    // The user listing is downloaded by an async call.
    final RootPanel userPanel = RootPanel.get("email");
    userPanel.add(users);
    users.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(final ChangeEvent event) {
            userChanged();
          }
        });
    users.addItem(SELECT_USER_STRING, "");
    userInfo.clear();
    for (final ClientUser user : list) {
      users.addItem(user.getName(), user.getEmail());
      userInfo.put(user.getEmail(), user);
    }

    // Select the user according to the cookie stored
    final String userEmail = Cookies.getCookie("email");
    selectUser(userEmail);
  }
Exemple #25
0
  @Override
  public void onModuleLoad() {
    RootPanel root = RootPanel.get("centerDiv");
    root.clear();

    VerticalPanel parent = new VerticalPanel();
    parent.setSize("100%", "100%");
    root.add(parent);

    final FlexTable flexTable = new FlexTable();
    flexTable.setStyleName((String) null);
    flexTable.setText(0, 0, "monetId:");

    final TextBox monetIdTextBox = new TextBox();
    monetIdTextBox.setMaxLength(12);
    monetIdTextBox.setWidth("60px");
    flexTable.setWidget(0, 1, monetIdTextBox);

    flexTable.setText(0, 2, "reason:");

    final TextBox reasonTextBox = new TextBox();
    reasonTextBox.setWidth("100px");
    flexTable.setWidget(0, 3, reasonTextBox);

    flexTable.setText(0, 4, "expire date:");

    VerticalPanel verticalPanel = new VerticalPanel();
    flexTable.setWidget(0, 5, verticalPanel);

    final RadioButton radioButton = new RadioButton("expire", "never expires");
    verticalPanel.add(radioButton);
    radioButton.setValue(true);

    final RadioButton radioButton1 = new RadioButton("expire", "select date");
    verticalPanel.add(radioButton1);

    Button saveButton = new Button("save");
    flexTable.setWidget(0, 6, saveButton);

    parent.add(flexTable);

    final DatePicker datePicker = new DatePicker();
    datePicker.setValue(new Date());
    flexTable.setWidget(1, 0, datePicker);
    flexTable.getFlexCellFormatter().setColSpan(1, 0, 7);
    flexTable.getFlexCellFormatter().setVisible(1, 0, false);
    flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    radioButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            flexTable.getFlexCellFormatter().setVisible(1, 0, false);
          }
        });

    radioButton1.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            flexTable.getFlexCellFormatter().setVisible(1, 0, true);
          }
        });
    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            int monetId = 0;
            try {
              monetId = Integer.parseInt(monetIdTextBox.getText());
            } catch (NumberFormatException e) {
              Window.alert("wrong monetid");
              return;
            }
            String reason = reasonTextBox.getText();
            Date expire = null;
            if (radioButton1.getValue()) {
              expire = datePicker.getValue();
            }
            if (expire != null && expire.getTime() <= System.currentTimeMillis()) {
              Window.alert("Wrong expire date");
              return;
            }

            JSONObject json = new JSONObject();
            json.put("monetId", new JSONNumber(monetId));
            json.put("reason", new JSONString(reason));
            String date = "";
            if (expire != null)
              date = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(expire);
            json.put("expire", new JSONString(date));

            service.add(
                json.toString(),
                new AsyncCallback<String>() {

                  @Override
                  public void onSuccess(String result) {
                    monetIdTextBox.setValue("");
                    reasonTextBox.setValue("");
                    flexTable.getFlexCellFormatter().setVisible(1, 0, false);
                    getList(page, size);
                    Window.alert("add blacklist success");
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    Window.alert("add black list failed");
                  }
                });
          }
        });

    Column<BlackListRowData, Number> monetColumn =
        new Column<BlackListRowData, Number>(new NumberCell()) {
          @Override
          public Number getValue(BlackListRowData object) {
            return object.getMonetId();
          }
        };
    cellTable.addColumn(monetColumn, "monetid");

    TextColumn<BlackListRowData> reasonColumn =
        new TextColumn<BlackListRowData>() {
          @Override
          public String getValue(BlackListRowData object) {
            return object.getReason();
          }
        };
    cellTable.addColumn(reasonColumn, "reason");

    Column<BlackListRowData, Date> expireColum =
        new Column<BlackListRowData, Date>(new DateCell()) {
          @Override
          public Date getValue(BlackListRowData object) {
            return object.getExpire();
          }
        };
    cellTable.addColumn(expireColum, "expire date");

    Column<BlackListRowData, String> opColumn =
        new Column<BlackListRowData, String>(new ButtonCell()) {
          @Override
          public String getValue(BlackListRowData object) {
            return "remove";
          }
        };
    cellTable.addColumn(opColumn, "");
    opColumn.setFieldUpdater(
        new FieldUpdater<BlackListRowData, String>() {
          @Override
          public void update(int index, BlackListRowData object, String value) {
            service.delete(
                object.getMonetId(),
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    Window.alert("remove blacklist failed");
                  }

                  @Override
                  public void onSuccess(String result) {
                    getList(page, size);
                    Window.alert("remove blacklist success");
                  }
                });
          }
        });
    getList(page, size);
    parent.add(cellTable);
  }
  private void makeMenus(RootPanel rootPanel) {
    // set up the popup menu that appears when you click on a person
    popup = new PopupPanel();

    MenuBar personMenu = new MenuBar(true);

    MenuBar addMenu = new MenuBar(true);
    addMenu.addItem(
        "1 son",
        new Command() {
          public void execute() {
            addChildren("1 son");
            popup.hide();
          }
        });
    addMenu.addItem(
        "1 daughter",
        new Command() {
          public void execute() {
            addChildren("1 daughter");
            popup.hide();
          }
        });
    addMenu.addItem(
        "2 sons",
        new Command() {
          public void execute() {
            addChildren("2 sons");
            popup.hide();
          }
        });
    addMenu.addItem(
        "2 daughters",
        new Command() {
          public void execute() {
            addChildren("2 daughters");
            popup.hide();
          }
        });
    addMenu.addItem(
        "3 sons",
        new Command() {
          public void execute() {
            addChildren("3 sons");
            popup.hide();
          }
        });
    addMenu.addItem(
        "3 daughters",
        new Command() {
          public void execute() {
            addChildren("3 daughters");
            popup.hide();
          }
        });
    addMenu.addItem(
        "Spouse+son",
        new Command() {
          public void execute() {
            addSpouse("Spouse+son");
            popup.hide();
          }
        });
    addMenu.addItem(
        "Spouse+daughter",
        new Command() {
          public void execute() {
            addSpouse("Spouse+daughter");
            popup.hide();
          }
        });
    Parents =
        new MenuItem(
            "Parents",
            new Command() {
              public void execute() {
                addParents();
                popup.hide();
              }
            });
    addMenu.addItem(Parents);
    personMenu.addItem("Add", addMenu);

    MenuBar changeMenu = new MenuBar(true);

    MenuBar changeAff = new MenuBar(true);
    changeAff.addItem(
        "Affected",
        new Command() {
          public void execute() {
            currentPerson.affection = PelicanPerson.affected;
            updateDisplay();
            popup.hide();
          }
        });
    changeAff.addItem(
        "Unaffected",
        new Command() {
          public void execute() {
            currentPerson.affection = PelicanPerson.unaffected;
            updateDisplay();
            popup.hide();
          }
        });
    changeMenu.addItem("Affection", changeAff);

    MenuBar changeSex = new MenuBar(true);
    changeSex.addItem(
        "Male",
        new Command() {
          public void execute() {
            currentPerson.sex = PelicanPerson.male;
            updateDisplay();
            popup.hide();
          }
        });
    changeSex.addItem(
        "Female",
        new Command() {
          public void execute() {
            currentPerson.sex = PelicanPerson.female;
            updateDisplay();
            popup.hide();
          }
        });
    changeMenu.addItem("Sex", changeSex);

    personMenu.addItem("Change", changeMenu);

    personMenu.addItem(
        "Delete",
        new Command() {
          public void execute() {
            deletePerson(currentPerson);
            popup.hide();
          }
        });

    personMenu.addItem(
        "Cancel",
        new Command() {
          public void execute() {
            popup.hide();
          }
        });

    MenuBar popupMenu = new MenuBar();
    popupMenu.addItem("Edit", personMenu);
    popupMenu.setAutoOpen(true);
    popup.add(popupMenu);

    // main menu
    MenuBar mainMenu = new MenuBar();
    mainMenu.setWidth("50px");
    mainMenu.setAnimationEnabled(true);

    MenuBar editMenu = new MenuBar(true);
    editMenu.setAnimationEnabled(true);

    editMenu.addItem(
        "New Pedigree",
        new Command() {
          public void execute() {
            newPedigree();
            updateDisplay();
          }
        });
    undoItem =
        new MenuItem(
            "Undo",
            new Command() {
              public void execute() {
                if (historyPosition > 1) {
                  historyPosition--;
                  Vector<PelicanPerson> savedPed =
                      (Vector<PelicanPerson>) history.elementAt(historyPosition - 1);
                  loadPedigree(savedPed);
                  pedHasChanged = true;
                  updateDisplay();
                }
              }
            });
    editMenu.addItem(undoItem);
    redoItem =
        new MenuItem(
            "Redo",
            new Command() {
              public void execute() {
                if (historyPosition < history.size()) {
                  historyPosition++;
                  Vector<PelicanPerson> savedPed =
                      (Vector<PelicanPerson>) history.elementAt(historyPosition - 1);
                  loadPedigree(savedPed);
                  pedHasChanged = true;
                  updateDisplay();
                }
              }
            });
    editMenu.addItem(redoItem);
    editMenu.addItem(
        "Renumber",
        new Command() {
          public void execute() {
            renumberAll();
            updateDisplay();
          }
        });
    mainMenu.addItem(new MenuItem("Edit", editMenu));

    rootPanel.add(mainMenu);
  }
Exemple #27
0
  @Override
  public void onModuleLoad() {
    box = new AutoProgressMessageBox("Por favor espere", "Carregando sistema...");
    box.setProgressText("Iniciando...");
    box.auto();
    box.show();

    Timer t =
        new Timer() {

          // float i;
          @Override
          public void run() {
            // box.updateProgress(i / 100, "{0}% Completo");
            // i += 10;
            // ageitar contadores
            servico.iniciaSistema(
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    AlertMessageBox d =
                        new AlertMessageBox(
                            "Desculpe", "Erro ao carregar sistema." + caught.getMessage());
                    // d.addHideHandler(hideHandler);
                    d.show();
                    // cancel();

                  }

                  @Override
                  public void onSuccess(String result) {
                    // AlertMessageBox d = new AlertMessageBox("Alerta", "OK");
                    // d.addHideHandler(hideHandler);
                    // d.show();
                  }
                });
            // if (i > 100) {
            //  cancel();

            // }
            box.hide();
            cancel();
          }
        };
    t.scheduleRepeating(3000);

    // painel principal
    rootPanel = RootPanel.get();

    Image image_5 = new Image("imagens/imagemPojeto.png");
    rootPanel.add(image_5, 0, 0);
    image_5.setSize("100%", "570px");

    final Label lblLogin = new Label("Login:"******"Senha:");
    rootPanel.add(lblSenha, 627, 285);

    // botao criar conta
    final TextButton txtbtnCriarContaAgora = new TextButton("Criar Conta Agora");
    txtbtnCriarContaAgora.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            CriarConta conta = new CriarConta();
            conta.load();
          }
        });
    rootPanel.add(txtbtnCriarContaAgora, 329, 360);

    Hyperlink htmlEsqueceuASenha = new Hyperlink("Esqueceu a senha?", true, "");
    // htmlEsqueceuASenha.setStyleName("serverResponseLabelError");
    htmlEsqueceuASenha.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            SenhaEsquecida senhaEsquecida = new SenhaEsquecida();
            senhaEsquecida.carregar();
          }
        });

    final TextBox textBox = new TextBox();
    // rootPanel.add(textBox, 676, 200);

    final PasswordTextBox passwordTextBox = new PasswordTextBox();

    passwordTextBox.setSize("161px", "16px");

    // botao logar
    final TextButton txtbtnLogar = new TextButton("Logar");
    txtbtnLogar.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            servico.getSenhaUsuarioLogin(
                textBox.getText(),
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    AlertMessageBox d = new AlertMessageBox("Alerta", caught.getMessage());
                    d.show();
                  }

                  @Override
                  public void onSuccess(String result) {
                    if (passwordTextBox.getText().equals(result)) {
                      Logado log = new Logado(textBox.getText().trim(), result);
                      rootPanel.add(log.asWidget());
                    } else {
                      AlertMessageBox d = new AlertMessageBox("Alerta", "Senha incorreta.");
                      d.show();
                    }
                  }
                });
          }
        });
    rootPanel.add(txtbtnLogar, 676, 315);
    rootPanel.add(textBox, 676, 250);
    rootPanel.add(passwordTextBox, 678, 285);
    rootPanel.add(htmlEsqueceuASenha, 676, 342);
  }
  /** This is the entry point method. */
  public void onModuleLoad() {

    RootPanel rootPanel = RootPanel.get();
    rootPanel.add(new HTML("<h1>Welcome</h1>"));
    rootPanel.add(new HTML("<p>Sample GWT project.</p>"));
  }
Exemple #29
0
  public void onModuleLoad() {
    RootPanel RootTXOriginal = RootPanel.get("Original");
    RootPanel RootMenu = RootPanel.get("Menu");
    RootTXOriginal.setSize("100%", "100%");
    RootMenu.setStyleName("Root");
    RootTXOriginal.setStyleName("Root");

    MenuBar menuBar = new MenuBar(false);
    RootMenu.add(menuBar);
    menuBar.setWidth("100%");

    mntmNewItem = new MenuItem("New item", false, (Command) null);
    mntmNewItem.setEnabled(false);
    mntmNewItem.setHTML("Language Editor : " + LenguajeActual.getName());
    menuBar.addItem(mntmNewItem);

    MenuItemSeparator separator = new MenuItemSeparator();
    menuBar.addSeparator(separator);

    MenuItem mntmNewItem_2 =
        new MenuItem(
            "New item",
            false,
            new Command() {
              public void execute() {
                int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget();
                Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget);
                {
                  ((PanelDecorador) WidgetActual).saveAll();
                }
              }
            });
    mntmNewItem_2.setHTML("Save");
    menuBar.addItem(mntmNewItem_2);

    MenuItemSeparator separator_1 = new MenuItemSeparator();
    menuBar.addSeparator(separator_1);

    MenuItem mntmNewItem_1 =
        new MenuItem(
            "New item",
            false,
            new Command() {
              public void execute() {
                int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget();
                //	Window.alert(Integer.toString(actual_widget2));
                //	int actual_widget=event.getItem();
                // Window.alert(Integer.toString(actual_widget));
                Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget);
                if (!((PanelDecorador) WidgetActual).isSaved())
                  if (Window.confirm(
                      "The tab is modificated and not saved, Do you want to save the modification")) {
                    ((PanelDecorador) WidgetActual).saveAll();
                  }
                Controlador.change2AdminLenguaje();
              }
            });
    mntmNewItem_1.setHTML("Back");
    menuBar.addItem(mntmNewItem_1);

    decoratedTabPanel = new DecoratedTabPanel();

    RootTXOriginal.add(decoratedTabPanel);
    decoratedTabPanel.setSize("100%", "100%");

    String tamano = "875px";

    // Esta encima porque sino salta error al setear la tab del decorador.
    MainWindowEditor MWE = new MainWindowEditor(LenguajeActual);
    decoratedTabPanel.add(MWE, "Main Window", true);
    MWE.setWidth(tamano);

    // Debajo de la declaracion sino da IndexOutOfBounds
    decoratedTabPanel.selectTab(0);

    // Ollente para pasar de pestaña
    decoratedTabPanel.addBeforeSelectionHandler(
        new BeforeSelectionHandler<Integer>() {
          public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget();
            //	Window.alert(Integer.toString(actual_widget2));
            //	int actual_widget=event.getItem();
            //	Window.alert(Integer.toString(actual_widget));
            Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget);
            if (!((PanelDecorador) WidgetActual).isSaved())
              if (Window.confirm(
                  "The tab is modificated and not saved, Do you want to save the modification"))
                ((PanelDecorador) WidgetActual).saveAll();
          }
        });

    SpecificationsEditor Specifications = new SpecificationsEditor(LenguajeActual);
    decoratedTabPanel.add(Specifications, "Specifications", true);
    Specifications.setWidth(tamano);

    FilterEditor Filter = new FilterEditor(LenguajeActual);
    decoratedTabPanel.add(Filter, "Filter", true);
    Filter.setWidth(tamano);

    AnnotationEditor Anotation = new AnnotationEditor(LenguajeActual);
    decoratedTabPanel.add(Anotation, "Annotation", true);
    Anotation.setWidth(tamano);

    BrowserEditor Browser = new BrowserEditor(LenguajeActual);
    decoratedTabPanel.add(Browser, "Browser", true);
    Browser.setWidth(tamano);

    VariosEditor varios = new VariosEditor(LenguajeActual);
    decoratedTabPanel.add(varios, "Others", true);
    varios.setWidth(tamano);
  }
  public void onModuleLoad() {

    // Listener CodeMirror
    // TODO Erreur JSNI avec FireFox
    CodeMirrorEditorWrapper.addOnChangeHandler(this);
    CodeMirrorEditorWrapper.setFileOpened("");

    // get Divs
    RootPanel buttonBar = RootPanel.get("buttonBar");
    RootPanel editor = RootPanel.get("editor");
    systemFileRoot = RootPanel.get("fileSystem");

    // add editor's content
    Grid gridEditor = new Grid(1, 1);

    // textArea Display codeMirror's stuff
    textAreaCodeShow = new HTML();
    textAreaCodeShow.setStyleName("textAreaCodeShow");

    gridEditor.setWidget(0, 0, textAreaCodeShow);

    editor.add(gridEditor);

    // add buttonBar's Content
    Grid grid = new Grid(2, 2);
    buttonBar.add(grid);
    buttonBar.setStyleName("buttonBarGrid");

    Label labelError = new Label();
    labelError.setVisible(false);
    labelError.setStyleName("labelError");

    login = new StringBuilder();
    password = new StringBuilder();

    toolStripMenu = new ToolStripMenu();
    formOpen = new FormOpen(labelError, toolStripMenu, this, systemFileRoot, login, password);
    formNew = new FormNew(labelError, toolStripMenu, this, systemFileRoot, login, password);

    toolStripMenu.setIHMCodeMirror(this);
    toolStripMenu.setFormNew(formNew);
    toolStripMenu.setFormOpen(formOpen);

    grid.setWidget(0, 0, toolStripMenu);
    grid.setWidget(1, 0, labelError);

    // shortcut keyboard for fun ~~ different behaviour between browser
    HandlerRegistration logHandler =
        Event.addNativePreviewHandler(
            new NativePreviewHandler() {

              @Override
              public void onPreviewNativeEvent(NativePreviewEvent event) {
                ne = event.getNativeEvent();

                if (ne.getType().equals("keydown")
                    && ne.getCtrlKey()
                    && (ne.getKeyCode() == 'n' || ne.getKeyCode() == 'N')) {
                  ne.preventDefault();
                  Scheduler.get()
                      .scheduleDeferred(
                          new ScheduledCommand() {
                            @Override
                            public void execute() {
                              if (formNew.isVisible()) {
                                formNew.hide();
                              } else {
                                formNew.show();
                              }
                            }
                          });
                } else if (ne.getType().equals("keydown")
                    && ne.getCtrlKey()
                    && (ne.getKeyCode() == 'o' || ne.getKeyCode() == 'O')) {
                  ne.preventDefault();
                  Scheduler.get()
                      .scheduleDeferred(
                          new ScheduledCommand() {
                            @Override
                            public void execute() {
                              if (formOpen.isVisible()) {
                                formOpen.hide();
                              } else {
                                formOpen.show();
                              }
                            }
                          });
                } else if (ne.getType().equals("keydown")
                    && ne.getCtrlKey()
                    && (ne.getKeyCode() == 's' || ne.getKeyCode() == 'S')) {
                  ne.preventDefault();

                  Scheduler.get()
                      .scheduleDeferred(
                          new ScheduledCommand() {
                            @Override
                            public void execute() {
                              if (!toolStripMenu.getBtnSave().isDisabled()) {
                                // fonction to call for saving
                                pushContentEditorToRepo();
                              }
                            }
                          });
                }
              }
            });

    // Auto-Save
    int savePeriod = 5000000;
    Scheduler.get()
        .scheduleFixedDelay(
            new RepeatingCommand() {
              @Override
              public boolean execute() {
                if (!toolStripMenu.getBtnSave().isDisabled()) {
                  // fonction to call for saving
                  pushContentEditorToRepo();
                }
                return true;
              }
            },
            savePeriod);
  }