Пример #1
0
  /** Redraws app for GUI (with menu) */
  public static void redrawGuiWithMenu() {

    bodySplitter.clear();
    bodySplitter.addSouth(ft, 23);
    bodySplitter.addWest(leftMenu, 280);
    bodySplitter.add(contentPanel);
    leftMenu.setHeight("100%");
    contentPanel.setHeight("100%");
  }
Пример #2
0
  public BaseView(PartStackUIResources resources) {
    container = new DockLayoutPanel(Style.Unit.PX);
    container.getElement().setAttribute("role", "part");
    container.setSize("100%", "100%");
    container.getElement().getStyle().setOutlineStyle(Style.OutlineStyle.NONE);
    initWidget(container);

    toolBar = new DockLayoutPanel(Style.Unit.PX);
    toolBar.addStyleName(resources.partStackCss().ideBasePartToolbar());
    toolBar.getElement().setAttribute("role", "toolbar");
    toolBar.addDomHandler(
        new MouseUpHandler() {
          @Override
          public void onMouseUp(MouseUpEvent event) {
            // activate last focused element if user clicked on part header
            if (lastFocused != null) {
              lastFocused.setFocus(true);
            }
          }
        },
        MouseUpEvent.getType());
    container.addNorth(toolBar, 23);

    // this hack used for adding box shadow effect to toolbar
    toolBar.getElement().getParentElement().getStyle().setOverflow(Style.Overflow.VISIBLE);

    toolbarHeader = new DockLayoutPanel(Style.Unit.PX);
    toolbarHeader.getElement().setAttribute("role", "toolbar-header");
    toolBar.addNorth(toolbarHeader, 22);

    titleLabel = new Label();
    titleLabel.setStyleName(resources.partStackCss().ideBasePartTitleLabel());
    toolbarHeader.addWest(titleLabel, 200);

    SVGImage minimize = new SVGImage(resources.collapseExpandIcon());
    minimize.getElement().setAttribute("name", "workBenchIconMinimize");
    minimizeButton = new ToolButton(minimize);

    minimizeButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            minimize();
          }
        });

    addToolButton(minimizeButton);

    if (minimizeButton.getElement() instanceof elemental.dom.Element) {
      Tooltip.create(
          (elemental.dom.Element) minimizeButton.getElement(),
          PositionController.VerticalAlign.BOTTOM,
          PositionController.HorizontalAlign.MIDDLE,
          "Hide");
    }
  }
  protected void initDockLayoutPanel() {
    if (dockLayoutPanel != null) return;
    if (leftPanel == null) leftPanel = new LeftPanel(this, businessService);

    RootPanel.get().clear();
    dockLayoutPanel = new DockLayoutPanel(Unit.PX);

    dockLayoutPanel.addNorth(new TopBar(this), 25);
    dockLayoutPanel.addWest(leftPanel, 225);
    mainPanel = new MainPanel(this);
    dockLayoutPanel.add(mainPanel);
  }
Пример #4
0
  public ShellView() {
    shell = new DockLayoutPanel(Style.Unit.PX);

    header = new SimpleLayoutPanel();
    navigation = new SimpleLayoutPanel();
    content = new SimpleLayoutPanel();

    shell.addNorth(header, 75);
    shell.addWest(navigation, 275);
    shell.add(content);

    initWidget(shell);
  }
    @Override
    protected void finalizeObject(DockLayoutPanel widget) {

      if (northWidget != null) {
        widget.addNorth(northWidget, northSize);
      }
      if (southWidget != null) {
        widget.addSouth(southWidget, southSize);
      }
      if (eastWidget != null) {
        widget.addEast(eastWidget, eastSize);
      }
      if (westWidget != null) {
        widget.addWest(westWidget, westSize);
      }
      for (Widget centerWidget : centerWidgets) {
        widget.add(centerWidget);
      }
    }
Пример #6
0
  public void onModuleLoad() {
    mainPanel = new DockLayoutPanel(Unit.EM);
    mainCenterPanel = new FlowPanel();
    headerPanel = new EmontoHeaderPanel();
    headerPanel.addClickHandler(this);
    searchPanel = new EmontoSearchPanel();
    aboutPanel = new EmontoAboutPanel();
    contactPanel = new EmontoContactPanel();
    footerPanel = new EmontoFooterPanel();
    browsePanel = new EmontoBrowsePanel();

    mainPanel.addNorth(headerPanel, 15);
    mainPanel.addSouth(footerPanel, 2);
    mainPanel.addEast(new HTML(""), 4);
    mainPanel.addWest(new HTML(""), 4);
    mainPanel.add(mainCenterPanel);
    setActivePage(ActivePage.ABOUT);

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel.get().add(mainPanel);

    // initialize the ontology knowledge base on the server side
    AsyncCallback<Void> callback =
        new AsyncCallback<Void>() {
          public void onFailure(Throwable caught) {
            // TODO: Do something with errors. (e.g. status message: not connected!)
          }

          public void onSuccess(Void result) {
            // TODO: Do something on success (e.g. status message: connected!)
          }
        };

    kbSvc.initializeKB(callback);
  }
 @Override
 public void add(DockLayoutPanel pnl, Widget widget, double size) {
   pnl.addWest(widget, size);
 }
Пример #8
0
  public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get();
    RootPanel RootMenu = RootPanel.get("Menu");

    MenuBar menuBar = new MenuBar(false);
    RootMenu.add(menuBar);

    MenuItem CloseBoton =
        new MenuItem(
            "Close",
            false,
            new Command() {
              public void execute() {
                if (ActualUser.getUser().getProfile().equals(Constants.PROFESSOR))
                  Controlador.change2Administrator();
                else if (ActualUser.getUser().getProfile().equals(Constants.STUDENT))
                  Controlador.change2MyActivities();
              }
            });
    menuBar.addItem(CloseBoton);

    SimplePanel simplePanel = new SimplePanel();
    rootPanel.add(simplePanel, 0, 25);
    simplePanel.setSize("100%", "100%");

    DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.EM);
    simplePanel.setWidget(dockLayoutPanel);
    dockLayoutPanel.setSize("100%", "100%");

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    dockLayoutPanel.addWest(verticalPanel, 32.2);
    verticalPanel.setSize("100%", "100%");

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(horizontalPanel_1);
    horizontalPanel_1.setWidth("100%");

    VerticalPanel PanelCampos = new VerticalPanel();
    PanelCampos.setSpacing(10);
    horizontalPanel_1.add(PanelCampos);
    PanelCampos.setWidth("100%");

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    PanelCampos.add(horizontalPanel_2);
    horizontalPanel_2.setWidth("100%");

    Label lblNewLabel = new Label("Nombre");
    horizontalPanel_2.add(lblNewLabel);

    NameText = new TextBox();
    NameText.setMaxLength(25);
    NameText.setVisibleLength(25);
    horizontalPanel_2.add(NameText);
    NameText.setWidth("90%");
    String Nombre = "";
    if ((ActualUser.getUser().getName() != null) && (!ActualUser.getUser().getName().isEmpty()))
      Nombre = ActualUser.getUser().getName();
    NameText.setText(Nombre);

    HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    PanelCampos.add(horizontalPanel_3);
    horizontalPanel_3.setWidth("100%");

    Label lblNewLabel_1 = new Label("Apellidos");
    horizontalPanel_3.add(lblNewLabel_1);

    ApellidosText = new TextBox();
    ApellidosText.setVisibleLength(25);
    ApellidosText.setMaxLength(120);
    horizontalPanel_3.add(ApellidosText);
    ApellidosText.setWidth("90%");
    String Apellido = "";
    if ((ActualUser.getUser().getLastName() != null)
        && (!ActualUser.getUser().getLastName().isEmpty()))
      Apellido = ActualUser.getUser().getLastName();
    ApellidosText.setText(Apellido);

    HorizontalPanel horizontalPanel_4 = new HorizontalPanel();
    horizontalPanel_4.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    PanelCampos.add(horizontalPanel_4);
    horizontalPanel_4.setWidth("100%");

    SimplePanel simplePanel_1 = new SimplePanel();
    horizontalPanel_4.add(simplePanel_1);

    Button btnNewButton = new Button("Save");
    simplePanel_1.setWidget(btnNewButton);
    btnNewButton.setSize("100%", "100%");
    btnNewButton.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });

    btnNewButton.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterPush");
          }
        });

    btnNewButton.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });

    btnNewButton.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {

            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterOver");
          }
        });

    btnNewButton.setStyleName("gwt-ButtonCenter");
    btnNewButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            UserApp AU = ActualUser.getUser();
            AU.setName(NameText.getText());
            AU.setLastName(ApellidosText.getText());
            LoadingPanel.getInstance().center();
            LoadingPanel.getInstance().setLabelTexto("Updating...");
            bookReaderServiceHolder.saveUser(
                AU,
                new AsyncCallback<Boolean>() {

                  public void onSuccess(Boolean result) {
                    bookReaderServiceHolder.loadUserById(
                        ActualUser.getUser().getId(),
                        new AsyncCallback<UserApp>() {

                          public void onSuccess(UserApp result) {
                            ActualUser.setUser(result);
                            bookReaderServiceHolder.updateRenameOfUser(
                                result.getId(),
                                new AsyncCallback<Void>() {

                                  public void onSuccess(Void result) {

                                    LoadingPanel.getInstance().hide();
                                    if (ActualUser.getUser()
                                        .getProfile()
                                        .equals(Constants.PROFESSOR))
                                      Controlador.change2Administrator();
                                    else if (ActualUser.getUser()
                                        .getProfile()
                                        .equals(Constants.STUDENT))
                                      Controlador.change2MyActivities();
                                  }

                                  public void onFailure(Throwable caught) {
                                    LoadingPanel.getInstance().hide();
                                    Window.alert(
                                        "I can refresh the old anotations, please re-save your name to fix it");
                                  }
                                });
                          }

                          public void onFailure(Throwable caught) {
                            Window.alert(
                                "I can reload the update User, if you want to show the new userInformation please reload the page");
                            LoadingPanel.getInstance().hide();
                          }
                        });
                  }

                  public void onFailure(Throwable caught) {
                    Window.alert("Error updating User.");
                    LoadingPanel.getInstance().hide();
                  }
                });
          }
        });

    VerticalPanel verticalPanel_1 = new VerticalPanel();
    verticalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    dockLayoutPanel.add(verticalPanel_1);
    verticalPanel_1.setSize("100%", "100%");

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel_1.add(horizontalPanel);

    Image image = new Image("Logo.jpg");
    horizontalPanel.add(image);
  }