public PainelPesquisarView() {
    hpPainelPesquisar = new HorizontalPanel();
    hpPainelPesquisar.setStyleName("hpPainelPesquisar");

    tbPesquisar = new TextBox();
    tbPesquisar.setStyleName("tbPesquisar");

    btnPesquisar = new Button("");
    btnPesquisar.setStyleName("btnPesquisar");

    hpPainelPesquisar.add(tbPesquisar);
    hpPainelPesquisar.add(btnPesquisar);
    hpPainelPesquisar.setCellWidth(tbPesquisar, "38%");

    hpPainelLabelContatos = new HorizontalPanel();
    hpPainelLabelContatos.setStyleName("hpPainelLabelContatos");

    lbContatos = new Label("Contatos");
    lbContatos.setStyleName("lbContatos");

    hpPainelLabelContatos.add(lbContatos);
    hpPainelLabelContatos.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    hpPainelLabelContatos.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);

    vpPainelPesquisar = new VerticalPanel();
    vpPainelPesquisar.setStyleName("vpPainelPesquisar");

    vpPainelPesquisar.add(hpPainelPesquisar);
    vpPainelPesquisar.add(hpPainelLabelContatos);

    initWidget(vpPainelPesquisar);
  }
Exemplo n.º 2
0
  /**
   * Skeleton of toolbar creation
   *
   * @return
   */
  protected Widget buildStepBar() {
    HorizontalPanel uiToolbar = new HorizontalPanel();
    uiToolbar.setStylePrimaryName("blockSteps");
    uiToolbar.setWidth("100%");
    uiToolbar.setHorizontalAlignment(ALIGN_RIGHT);
    uiToolbar.setVerticalAlignment(ALIGN_MIDDLE);

    // Build stepBar
    int nbSteps = controller.getNbViews();

    Grid table = new Grid(1, nbSteps);
    table.setCellSpacing(3);
    Image currentImg = null;
    for (int i = 0; i < nbSteps; i++) {
      if (i == stepNumber) {
        currentImg = new Image("img/red_round_button.jpg");
      } else if (i < stepNumber) {
        currentImg = new Image("img/green_round_tick.jpg");
      } else {
        currentImg = new Image("img/green_round_button.jpg");
      }
      table.setWidget(0, i, currentImg);
    }

    uiToolbar.add(table);
    return uiToolbar;
  }
Exemplo n.º 3
0
  private Widget createScreenshotPanel() {
    VerticalPanel panel = new VerticalPanel();
    panel.setSize("100%", "100%");

    // background
    Label label2 = new Label("Background");
    panel.add(label2);
    HorizontalPanel bgTypes = new HorizontalPanel();
    bgTypes.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    panel.add(bgTypes);
    screenshotTransparentBt = new RadioButton("scbgtype", "Transparent");
    screenshotTransparentBt.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            updatePreviewCanvas();
          }
        });

    bgTypes.add(screenshotTransparentBt); // stop because not support so far

    screenshotColorBt = new RadioButton("scbgtype", "Color");
    bgTypes.add(screenshotColorBt);

    screenshotColorBox = new ColorBox();
    screenshotColorBox.setValue("#333333");
    bgTypes.add(screenshotColorBox);

    return panel;
  }
Exemplo n.º 4
0
    private void addFileUploadWidget() {
      final FileUpload upload = new FileUpload();
      upload.setWidth("200px");
      upload.setName(getUniqueId());
      uploadForms.add(upload);
      final HorizontalPanel hPanel = new HorizontalPanel();
      hPanel.setHeight("30px");
      hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
      // Don't display ability to remove form if expecting exactly 1 upload or if this is the first
      // upload element
      if (isMultiple() && uploadForms.size() > 1) {
        com.google.gwt.user.client.ui.Image crossImage = new com.google.gwt.user.client.ui.Image();
        crossImage.setUrl(Resources.CROSS);
        crossImage.addClickHandler(
            new com.google.gwt.event.dom.client.ClickHandler() {
              public void onClick(final com.google.gwt.event.dom.client.ClickEvent clickEvent) {
                panel.remove(hPanel);
                uploadForms.remove(hPanel.getWidget(1));
              }
            });
        hPanel.add(crossImage);
      } else {
        com.google.gwt.user.client.ui.VerticalPanel space =
            new com.google.gwt.user.client.ui.VerticalPanel();
        space.setSize("16px", "1px");
        hPanel.add(space);
      }

      hPanel.add(upload);
      panel.add(hPanel);
      if (get() != null) {
        get().markForRedraw();
      }
    }
Exemplo n.º 5
0
  /**
   * Builds the main toolbar.
   *
   * @return the main toolbar
   */
  private HorizontalPanel buildToolBar() {
    HorizontalPanel toolbarPanel = new HorizontalPanel();
    toolbarPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    toolbarPanel.setStyleName("lab-Toolbar");
    toolbarPanel.add(
        buildButton(
            resources.blankFile(),
            "New Project",
            new CreateNewProjectDialogWidget().openDialogForNewProjectCommand()));
    toolbarPanel.add(buildButton(resources.openIcon(), "Open Project", createBlankCommand()));
    toolbarPanel.add(buildButton(resources.saveIcon(), "Save Project", createBlankCommand()));
    toolbarPanel.add(buildSeparator());
    toolbarPanel.add(buildButton(resources.refreshIcon(), "Refresh", createBlankCommand()));
    toolbarPanel.add(buildSeparator());
    toolbarPanel.add(
        buildButton(
            resources.copyIcon(),
            "Clone Project",
            (new GitCloneDialogWidget().openDialogForGITCloneCommand())));
    toolbarPanel.add(buildSeparator());
    toolbarPanel.add(
        buildButton(
            resources.uploadIcon(), "Deploy Project", (new DeployDialog().openMenuDialog())));

    return toolbarPanel;
  }
Exemplo n.º 6
0
  private void buildDialogInfo() {

    if (this._dialogInfo == null) {

      final String[] messages =
          new String[] {
            "Construire une archive zip ou jar contenant le projet GWT.",
            "Afin de réduire le temps de chargement, n'inclure que les fichiers *.gwt.xml.",
            "La taille du fichier archive ne doit pas dépasse 3Mo."
          };

      final HorizontalPanel hPanelSourceDir = new HorizontalPanel();
      hPanelSourceDir.setSpacing(Constantes.SPACING_MIN);
      hPanelSourceDir.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

      this._tbSourceDirName.setWidth("100px");
      this._tbSourceDirName.setValue(this.getSourceDir());
      final Label label = new Label("répertoire racine des sources: ");
      hPanelSourceDir.add(label);
      hPanelSourceDir.add(this._tbSourceDirName);

      this._dialogInfo =
          WidgetUtils.buildDialogBox("Information", messages, hPanelSourceDir, false, null);
    }
  }
Exemplo n.º 7
0
    /*
     * (non-Javadoc)
     *
     * @seecom.google.gwt.widgetideas.table.client.filter.ColumnFilter#
     * createFilterWidget()
     */
    public Widget createFilterWidget() {
      filterTextBox = new TextBox();
      filterTextBox.addStyleName("textBox");
      filterTextBox.addKeyboardListener(
          new KeyboardListener() {
            public void onKeyDown(Widget sender, char keyCode, int modifiers) {}

            public void onKeyPress(Widget sender, char keyCode, int modifiers) {}

            public void onKeyUp(Widget sender, char keyCode, int modifiers) {
              fireColumnFilterChanged(
                  new TextColumnFilterInfo(getColumn(), filterTextBox.getText(), operator));
            }
          });
      if (supportedOperators.length > 1) {
        operatorButton = new PushButton();
        setButtonText(operatorButton, operator);
        operatorButton.addClickListener(clickListener);
        operatorButton.addStyleName("operatorButton");
        HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.addStyleName("columnTextFilter");
        horizontalPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
        horizontalPanel.add(operatorButton);
        horizontalPanel.add(filterTextBox);
        horizontalPanel.setCellWidth(operatorButton, "30px");
        horizontalPanel.setCellWidth(filterTextBox, "100%");
        horizontalPanel.setSpacing(2);
        return horizontalPanel;
      } else {
        return filterTextBox;
      }
    }
Exemplo n.º 8
0
  @Inject
  public MainView(IndexDisplayer indexDisplayer) {

    c.setStyleName("tab");
    c.addStyleName("first");
    p.setStyleName("tab");

    message.setStyleName("messageBar");
    message.setVisible(false);

    int i;
    for (i = 0; i < 5; i++) {
      startIndex.addItem(indexDisplayer.getDisplay(i), Integer.toString(i));
    }
    for (i = 5; i < 10; i++) {
      lastIndex.addItem(indexDisplayer.getDisplay(i), Integer.toString(i));
    }

    startIndex.setSelectedIndex(0);
    lastIndex.setSelectedIndex(0);

    HorizontalPanel hp = new HorizontalPanel();
    hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hp.add(new Label("Start Index: "));
    hp.add(startIndex);
    hp.add(new Label("End Index: "));
    hp.add(lastIndex);
    hp.setSpacing(5);

    bar.add(c);
    bar.add(p);
    bar.setStyleName("tabs");

    mainPanel = new VerticalPanel();
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    clearHistory.setStyleName("link");
    mainPanel.add(clearHistory);

    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    mainPanel.add(hp);
    mainPanel.add(bar);
    mainPanel.add(message);
    mainPanel.add(bodyContainer);
    mainPanel.add(filter);
    mainPanel.add(filterActivate);
    mainPanel.add(filterModule);
    mainPanel.add(hasBeenThere);
    mainPanel.add(broadcastInfo);
    mainPanel.add(showStatus);
    mainPanel.add(activateStatus);
    wait.add(new Label("Wait"));

    initWidget(mainPanel);

    bodyContainer.setStyleName("body");
    bodyContainer.setWidget(new Label("Click on one of the tab to start."));
  }
Exemplo n.º 9
0
  private void initStage1(final FlowPanel div) {
    div.add(new HTMLPanel("h2", "1. Set the start and end dates"));

    HorizontalPanel hpanel = new HorizontalPanel();

    hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    hpanel.setSpacing(10);

    final DatePicker dateFrom = new DatePicker();
    final DatePicker dateTo = new DatePicker();

    hpanel.add(new Label("Start date:"));
    hpanel.add(dateFrom);
    hpanel.add(new Label("End date:"));
    hpanel.add(dateTo);

    final Button cont =
        WidgetFactory.createButton(
            "Continue",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                final long twelveHours = 12 * 60 * 60 * 1000;
                long timeFrom = dateFrom.getValue().getTime() - twelveHours;
                long timeTo = dateTo.getValue().getTime() + twelveHours;

                initStage2(timeFrom, timeTo, div);
              }
            });

    cont.setEnabled(false);
    cont.getElement().addClassName("scran24-admin-button");

    dateFrom.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {
            if (event.getValue() != null && dateTo.getValue() != null) {
              cont.setEnabled(true);
            }
          }
        });

    dateTo.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {
            if (event.getValue() != null && dateFrom.getValue() != null) {
              cont.setEnabled(true);
            }
          }
        });

    div.add(hpanel);
    div.add(cont);
  }
Exemplo n.º 10
0
  public GetSetRegControl2(final int addr, final int reg, String text) {
    super(addr);
    this.label = new Label(text);
    this.editHi = new TextBox();
    this.editLo = new TextBox();
    this.reg = reg;

    editHi.setWidth("25px");
    editLo.setWidth("25px");

    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    panel.add(label);
    panel.add(editHi);
    panel.add(editLo);

    editHi.setEnabled(false);
    editHi.setText("???");
    editLo.setEnabled(false);
    editLo.setText("???");

    Button setButton = new Button("Set");
    setButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            editHi.setEnabled(false);
            editLo.setEnabled(false);

            try {
              int val = Integer.valueOf(editHi.getText()) * 256 + Integer.valueOf(editLo.getText());
              controllersService.setReg(
                  addr,
                  reg,
                  val,
                  new AsyncCallback<Void>() {
                    @Override
                    public void onSuccess(Void result) {
                      editHi.setEnabled(true);
                      editLo.setEnabled(true);
                    }

                    @Override
                    public void onFailure(Throwable caught) {
                      if (caught instanceof AuthException) Window.alert(caught.getMessage());
                    }
                  });
            } catch (NumberFormatException e) {
              refresh();
            }
          }
        });
    panel.add(setButton);

    initWidget(panel);
  }
Exemplo n.º 11
0
 private String getHeaderString(String text, ImageResource imageResource) {
   HorizontalPanel hPanel = new HorizontalPanel();
   hPanel.setSpacing(0);
   hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
   hPanel.add(new Image(imageResource));
   HTML headerText = new HTML(text);
   headerText.setStyleName("cw-StackPanelHeader");
   hPanel.add(headerText);
   return hPanel.getElement().getString();
 }
Exemplo n.º 12
0
  public StatusBarWidget() {
    Binder binder = GWT.create(Binder.class);
    HorizontalPanel hpanel = binder.createAndBindUi(this);
    hpanel.setVerticalAlignment(HorizontalPanel.ALIGN_TOP);

    hpanel.setCellWidth(hpanel.getWidget(2), "100%");

    initWidget(hpanel);

    height_ = 16;
  }
Exemplo n.º 13
0
 /**
  * Skeleton of toolbar creation
  *
  * @return
  */
 protected Widget buildToolbar() {
   HorizontalPanel uiToolbar = new HorizontalPanel();
   uiToolbar.setStylePrimaryName("blockAction");
   uiToolbar.setWidth("100%");
   uiToolbar.setHorizontalAlignment(ALIGN_RIGHT);
   uiToolbar.setVerticalAlignment(ALIGN_MIDDLE);
   uiToolbar.setSpacing(10);
   uiToolbar.setHeight("60px");
   uiToolbar.add(buildStepToolbar());
   return uiToolbar;
 }
Exemplo n.º 14
0
 private Widget createHeaderWidget(String text, ImageResource image) {
   // Add the image and text to a horizontal panel
   HorizontalPanel hPanel = new HorizontalPanel();
   hPanel.setHeight("100%");
   hPanel.setSpacing(0);
   hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
   hPanel.add(new Image(image));
   HTML headerText = new HTML(text);
   headerText.setStyleName("cw-StackPanelHeader");
   hPanel.add(headerText);
   return new SimplePanel(hPanel);
 }
Exemplo n.º 15
0
 @Override
 public void setPlatform(Platform platform) {
   Image image = new Image(Utils.getPlatformIcon(platform));
   image.setTitle(Utils.getPlatformText(platform));
   image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
   Label label = new Label(Utils.getPlatformText(platform));
   targetPlatformPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
   targetPlatformPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
   targetPlatformPanel.add(image);
   targetPlatformPanel.setCellWidth(image, "32px");
   targetPlatformPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
   targetPlatformPanel.add(label);
   label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
 }
Exemplo n.º 16
0
  /**
   * Get a string representation of the header that includes an image and some text.
   *
   * @param text the header text
   * @param image the {@link ImageResource} to add next to the header
   * @return the header as a string
   */
  @ShowcaseSource
  private String getHeaderString(String text, ImageResource image) {
    // Add the image and text to a horizontal panel
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(0);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.add(new Image(image));
    HTML headerText = new HTML(text);
    headerText.setStyleName("cw-StackPanelHeader");
    hPanel.add(headerText);

    // Return the HTML string for the panel
    return hPanel.getElement().getString();
  }
Exemplo n.º 17
0
 @Override
 public void setFeatures(List<Feature> features) {
   for (int i = 0; i < features.size(); i++) {
     Feature feature = features.get(i);
     Image image = new Image(Utils.getFeatureIcon(feature));
     image.setTitle(Utils.getFeatureText(feature));
     image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
     Label label = new Label(Utils.getFeatureText(feature));
     featuresPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
     featuresPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
     featuresPanel.add(image);
     featuresPanel.setCellWidth(image, "32px");
     featuresPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
     featuresPanel.add(label);
     if (i < features.size() - 1) {
       label.getElement().getStyle().setPaddingRight(10, Unit.PX);
     }
     label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
   }
 }
Exemplo n.º 18
0
  private void createGUI() {

    setGlassEnabled(true);
    addStyleName("DialogBox");

    btnOK = new Button();
    btnOK.addClickHandler(this);

    btnCancel = new Button();
    btnCancel.addClickHandler(this);
    btnCancel.addStyleName("cancelBtn");

    buttonPanel = new FlowPanel();
    buttonPanel.addStyleName("DialogButtonPanel");

    messagePanel = new HorizontalPanel();
    messagePanel.addStyleName("Dialog-messagePanel");
    messagePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    messageTextPanel = new VerticalPanel();

    mainPanel = new FlowPanel();
    mainPanel.addStyleName("Dialog-content");
  }
  public SeleccionCatalogoPopupPanel(
      CatalogoClient catalogo,
      Label catalogLabel,
      Label openCatalogLabel,
      EditorActivityPopupPanel yo) {

    super(true);
    Catalogo = catalogo;
    LPrivate = catalogLabel;
    LPublic = openCatalogLabel;
    Father = yo;
    GeneralPanel = new AbsolutePanel();
    setAnimationEnabled(true);
    HorizontalPanel PanelActivityH = new HorizontalPanel();
    PanelActivity = new VerticalPanel();
    EditorZone = new SimplePanel();
    EditorZone.setHeight(Constants.TAMANO_PANEL_EDICION);
    EditorZone.setVisible(false);
    PanelActivity.add(EditorZone);
    PanelActivity.add(PanelActivityH);
    PanelActivityH.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    PanelActivityH.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    PanelActivityH.setSpacing(4);

    GeneralPanel.add(PanelActivity, 0, 0);
    setWidget(GeneralPanel);
    GeneralPanel.setSize(
        Window.getClientWidth() + Constants.PX, Window.getClientHeight() + Constants.PX);
    // PanelActivityH.setSize("100%", "100%");
    // PanelActivity.setSize("100%", "100%");
    PanelActivity.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    PanelActivity.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    SelectTeacherCatalogButton = new Button(SeleccionCatalogoPopupPanel.BOTTON_TEACHER_CATALOG);
    SelectTeacherCatalogButton.setSize("100%", "100%");
    SelectTeacherCatalogButton.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterPush");
          }
        });
    SelectTeacherCatalogButton.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });
    SelectTeacherCatalogButton.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterOver");
          }
        });
    SelectTeacherCatalogButton.setStyleName("gwt-ButtonCenter");
    SelectTeacherCatalogButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            LPrivate.setText("Teacher Catalog :" + Catalogo.getCatalogName());
            LoadingPanel.getInstance().center();
            LoadingPanel.getInstance().setLabelTexto(ConstantsInformation.LOADING);
            bookReaderServiceHolder.loadCatalogById(
                Catalogo.getId(),
                new AsyncCallback<CatalogoClient>() {

                  @Override
                  public void onSuccess(CatalogoClient result) {
                    LoadingPanel.getInstance().hide();
                    Father.setSelectedCatalog(result);
                    Father.setPanel_Selecion_Default_Visibility(true);
                    hide();
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    LoadingPanel.getInstance().hide();
                    Window.alert(ConstantsError.ERROR_LOADING_CATALOG);
                    hide();
                  }
                });
          }
        });
    PanelActivityH.add(SelectTeacherCatalogButton);

    SelectOpenCatalogButton = new Button(SeleccionCatalogoPopupPanel.BOTTON_OPEN_CATALOG);
    SelectOpenCatalogButton.setSize("100%", "100%");
    SelectOpenCatalogButton.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterPush");
          }
        });
    SelectOpenCatalogButton.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenter");
          }
        });
    SelectOpenCatalogButton.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonCenterOver");
          }
        });
    SelectOpenCatalogButton.setStyleName("gwt-ButtonCenter");
    SelectOpenCatalogButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            LPublic.setText("Open Catalog :" + Catalogo.getCatalogName());
            Father.setSelectedCatalogPublic(Catalogo);
            hide();
          }
        });
    PanelActivityH.add(SelectOpenCatalogButton);
    PanelEdicion = new AbsolutePanel();
  }
Exemplo n.º 20
0
    private DocTab(
        ImageResource icon,
        String docId,
        String title,
        String tooltip,
        TabCloseObserver closeHandler) {
      docId_ = docId;

      final HorizontalPanel layoutPanel = new HorizontalPanel();
      layoutPanel.setStylePrimaryName(styles_.tabLayout());
      layoutPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
      layoutPanel.getElement().setDraggable("true");
      layoutPanel.addDomHandler(
          new DragStartHandler() {
            @Override
            public void onDragStart(DragStartEvent evt) {
              evt.getDataTransfer()
                  .setData(
                      getDataTransferFormat(),
                      docId_ + "|" + SourceWindowManager.getSourceWindowId());
              JsObject dt = evt.getDataTransfer().cast();
              dt.setString("effectAllowed", "move");

              // figure out where the cursor is inside the element; because the
              // drag shows an image of the tab, knowing where the cursor is
              // inside that image is necessary for us to know the screen
              // location of the dragged image
              int evtX = evt.getNativeEvent().getClientX();
              ElementEx ele = getElement().cast();
              events_.fireEvent(
                  new DocTabDragInitiatedEvent(
                      docId_,
                      getElement().getClientWidth(),
                      evtX - ele.getBoundingClientRect().getLeft()));
            }
          },
          DragStartEvent.getType());

      HTML left = new HTML();
      left.setStylePrimaryName(styles_.tabLayoutLeft());
      layoutPanel.add(left);

      contentPanel_ = new HorizontalPanel();
      contentPanel_.setTitle(tooltip);
      contentPanel_.setStylePrimaryName(styles_.tabLayoutCenter());
      contentPanel_.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

      if (icon != null) contentPanel_.add(imageForIcon(icon));

      label_ = new Label(title, false);
      label_.addStyleName(styles_.docTabLabel());
      contentPanel_.add(label_);

      appendDirtyMarker();

      Image img = new Image(ThemeResources.INSTANCE.closeTab());
      img.setStylePrimaryName(styles_.closeTabButton());
      img.addStyleName(ThemeStyles.INSTANCE.handCursor());
      contentPanel_.add(img);

      layoutPanel.add(contentPanel_);

      HTML right = new HTML();
      right.setStylePrimaryName(styles_.tabLayoutRight());
      layoutPanel.add(right);

      initWidget(layoutPanel);

      this.sinkEvents(Event.ONCLICK);
      closeHandler_ = closeHandler;
      closeElement_ = img.getElement();
    }
Exemplo n.º 21
0
  public TopToolbar() {
    /*
     * Layout is as follows:
     * +-------------------------------------------------+
     * | Project ▾ | Connect ▾ | Build ▾| Help ▾| Admin ▾ |
     * +-------------------------------------------------+
     */
    HorizontalPanel toolbar = new HorizontalPanel();
    toolbar.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);

    List<DropDownItem> fileItems = Lists.newArrayList();
    List<DropDownItem> connectItems = Lists.newArrayList();
    List<DropDownItem> buildItems = Lists.newArrayList();
    List<DropDownItem> helpItems = Lists.newArrayList();

    // File -> {New Project; Save; Save As; Checkpoint; |; Delete this Project; My Projects;}
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_MY_PROJECTS, MESSAGES.tabNameProjects(), new SwitchToProjectAction()));
    fileItems.add(null);
    fileItems.add(new DropDownItem(WIDGET_NAME_NEW, MESSAGES.newMenuItemButton(), new NewAction()));
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_IMPORTPROJECT, MESSAGES.importProjectButton(), new ImportProjectAction()));
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_IMPORTTEMPLATE,
            MESSAGES.importTemplateButton(),
            new ImportTemplateAction()));
    fileItems.add(
        new DropDownItem(WIDGET_NAME_DELETE, MESSAGES.deleteMenuItemButton(), new DeleteAction()));
    fileItems.add(null);
    fileItems.add(new DropDownItem(WIDGET_NAME_SAVE, MESSAGES.saveMenuItem(), new SaveAction()));
    fileItems.add(
        new DropDownItem(WIDGET_NAME_SAVE_AS, MESSAGES.saveAsMenuItem(), new SaveAsAction()));
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_CHECKPOINT, MESSAGES.checkpointButton(), new CheckpointAction()));
    fileItems.add(null);
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_EXPORTPROJECT, MESSAGES.exportProjectButton(), new ExportProjectAction()));
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_EXPORTALLPROJECTS,
            MESSAGES.exportAllProjectsButton(),
            new ExportAllProjectsAction()));
    fileItems.add(null);
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_UPLOAD_KEYSTORE,
            MESSAGES.uploadKeystoreButton(),
            new UploadKeystoreAction()));
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_DOWNLOAD_KEYSTORE,
            MESSAGES.downloadKeystoreButton(),
            new DownloadKeystoreAction()));
    fileItems.add(
        new DropDownItem(
            WIDGET_NAME_DELETE_KEYSTORE,
            MESSAGES.deleteKeystoreButton(),
            new DeleteKeystoreAction()));

    // Connect -> {Connect to Companion; Connect to Emulator; Connect to USB; Reset Connections}
    connectItems.add(
        new DropDownItem(
            WIDGET_NAME_WIRELESS_BUTTON, MESSAGES.wirelessButton(), new WirelessAction()));
    connectItems.add(
        new DropDownItem(
            WIDGET_NAME_EMULATOR_BUTTON, MESSAGES.emulatorButton(), new EmulatorAction()));
    connectItems.add(
        new DropDownItem(WIDGET_NAME_USB_BUTTON, MESSAGES.usbButton(), new UsbAction()));
    connectItems.add(null);
    connectItems.add(
        new DropDownItem(WIDGET_NAME_RESET_BUTTON, MESSAGES.resetConnections(), new ResetAction()));
    connectItems.add(
        new DropDownItem(
            WIDGET_NAME_HARDRESET_BUTTON, MESSAGES.hardResetConnections(), new HardResetAction()));

    // Build -> {Show Barcode; Download to Computer; Generate YAIL only when logged in as an admin}
    buildItems.add(
        new DropDownItem(
            WIDGET_NAME_BUILD_BARCODE, MESSAGES.showBarcodeButton(), new BarcodeAction()));
    buildItems.add(
        new DropDownItem(
            WIDGET_NAME_BUILD_DOWNLOAD, MESSAGES.downloadToComputerButton(), new DownloadAction()));
    if (AppInventorFeatures.hasYailGenerationOption() && Ode.getInstance().getUser().getIsAdmin()) {
      buildItems.add(null);
      buildItems.add(
          new DropDownItem(
              WIDGET_NAME_BUILD_YAIL, MESSAGES.generateYailButton(), new GenerateYailAction()));
    }

    // Help -> {About, Library, Get Started, Tutorials, Troubleshooting, Forums, Report an Issue}
    helpItems.add(new DropDownItem(WIDGET_NAME_ABOUT, MESSAGES.aboutLink(), new AboutAction()));
    helpItems.add(null);
    helpItems.add(
        new DropDownItem(WIDGET_NAME_LIBRARY, MESSAGES.libraryLink(), new LibraryAction()));
    helpItems.add(
        new DropDownItem(
            WIDGET_NAME_GETSTARTED, MESSAGES.getStartedLink(), new GetStartedAction()));
    helpItems.add(
        new DropDownItem(WIDGET_NAME_TUTORIALS, MESSAGES.tutorialsLink(), new TutorialsAction()));
    helpItems.add(
        new DropDownItem(
            WIDGET_NAME_TROUBLESHOOTING,
            MESSAGES.troubleshootingLink(),
            new TroubleShootingAction()));
    helpItems.add(new DropDownItem(WIDGET_NAME_FORUMS, MESSAGES.forumsLink(), new ForumsAction()));
    helpItems.add(null);
    helpItems.add(
        new DropDownItem(WIDGET_NAME_FEEDBACK, MESSAGES.feedbackLink(), new FeedbackAction()));

    // Create the TopToolbar drop down menus.
    fileDropDown =
        new DropDownButton(WIDGET_NAME_PROJECT, MESSAGES.projectButton(), fileItems, false);
    connectDropDown =
        new DropDownButton(WIDGET_NAME_CONNECT_TO, MESSAGES.connectButton(), connectItems, false);
    buildDropDown =
        new DropDownButton(WIDGET_NAME_BUILD, MESSAGES.buildButton(), buildItems, false);
    helpDropDown = new DropDownButton(WIDGET_NAME_HELP, MESSAGES.helpLink(), helpItems, false);

    // Set the DropDown Styles
    fileDropDown.setStyleName("ode-TopPanelButton");
    connectDropDown.setStyleName("ode-TopPanelButton");
    buildDropDown.setStyleName("ode-TopPanelButton");
    helpDropDown.setStyleName("ode-TopPanelButton");

    // Add the Buttons to the Toolbar.
    toolbar.add(fileDropDown);
    toolbar.add(connectDropDown);
    toolbar.add(buildDropDown);
    toolbar.add(helpDropDown);

    // Only if logged in as an admin, add the Admin Button
    if (Ode.getInstance().getUser().getIsAdmin()) {
      List<DropDownItem> adminItems = Lists.newArrayList();
      adminItems.add(
          new DropDownItem(
              WIDGET_NAME_DOWNLOAD_USER_SOURCE,
              MESSAGES.downloadUserSourceButton(),
              new DownloadUserSourceAction()));
      adminItems.add(
          new DropDownItem(
              WIDGET_NAME_SWITCH_TO_DEBUG,
              MESSAGES.switchToDebugButton(),
              new SwitchToDebugAction()));
      adminDropDown =
          new DropDownButton(WIDGET_NAME_ADMIN, MESSAGES.adminButton(), adminItems, false);
      adminDropDown.setStyleName("ode-TopPanelButton");
      toolbar.add(adminDropDown);
    }

    initWidget(toolbar);
  }
Exemplo n.º 22
0
  public void onModuleLoad() {
    RootPanel RootTXOriginal = RootPanel.get();
    RootPanel RootMenu = RootPanel.get("Menu");
    RootTXOriginal.setSize("100%", "100%");
    RootMenu.setStyleName("Root");
    RootTXOriginal.setStyleName("Root");

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

    MenuItem menuItem = new MenuItem("GroupAdministration", false, (Command) null);
    menuItem.setHTML("Users Administrator");
    menuItem.setEnabled(false);
    menuBar.addItem(menuItem);

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

    MenuItem mntmBack =
        new MenuItem(
            "Back",
            false,
            new Command() {
              public void execute() {
                Controlador.change2Administrator();
              }
            });
    menuBar.addItem(mntmBack);

    MenuItem AddLots =
        new MenuItem(
            "Masive add",
            false,
            new Command() {
              public void execute() {
                PanelAddMasibo PAM = new PanelAddMasibo(YO);
                PAM.setVisible(true);
                PAM.center();
              }
            });
    AddLots.setHTML("Masive add");
    menuBar.addItem(AddLots);

    HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    RootTXOriginal.add(horizontalSplitPanel, 0, 25);
    horizontalSplitPanel.setSize("100%", "100%");

    VerticalPanel verticalPanel = new VerticalPanel();
    horizontalSplitPanel.setLeftWidget(verticalPanel);
    verticalPanel.setSize("100%", "");

    SimplePanel simplePanel = new SimplePanel();
    verticalPanel.add(simplePanel);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    simplePanel.setWidget(horizontalPanel);
    horizontalPanel.setSize("100%", "100%");

    textBox = new TextBox();
    textBox.setVisibleLength(50);
    horizontalPanel.add(textBox);
    textBox.setWidth("90%");

    Button btnNewButton = new Button("New button");
    btnNewButton.setText("+");
    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) {
            String S = ClearText(textBox.getText());
            if (isValidEmail(S)) addText(S);
            else Window.alert(ErrorConstants.ERROR_NO_EMAIL_VALIDO + S);
            textBox.setText("");
          }

          private native boolean isValidEmail(String email) /*-{
	        var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	        var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	        	return !reg1.test(email) && reg2.test(email);
			}-*/;
        });

    horizontalPanel.add(btnNewButton);
    btnNewButton.setWidth("66px");
    btnNewButton.setHTML("+");

    verticalPanel_1 = new VerticalPanel();
    verticalPanel.add(verticalPanel_1);
    verticalPanel_1.setWidth("100%");

    SaveNewUsers = new Button("Save New Users");
    SaveNewUsers.setVisible(false);
    SaveNewUsers.addClickHandler(
        new ClickHandler() {
          private AsyncCallback<Boolean> callback;

          public void onClick(ClickEvent event) {
            Pilallamada = new Stack<UserApp>();
            int Elementos_a_salvar = verticalPanel_1.getWidgetCount();
            for (int i = 0; i < Elementos_a_salvar; i++) {
              Widget Uno = verticalPanel_1.getWidget(i);
              Button Dos = (Button) Uno;
              String Nombre = Dos.getText();
              Pilallamada.add(new UserApp(Nombre, Constants.STUDENT));
            }
            if (!Pilallamada.isEmpty()) {
              callback =
                  new AsyncCallback<Boolean>() {

                    public void onFailure(Throwable caught) {
                      Window.alert("The user could not be saved at this moment");
                      LoadingPanel.getInstance().hide();
                    }

                    public void onSuccess(Boolean result) {
                      LoadingPanel.getInstance().hide();
                      if (!result)
                        Window.alert(
                            "The user "
                                + Pilallamada.peek().getEmail()
                                + " already exists (if you do not see him/her it's because he may be administrator)");
                      Pilallamada.pop();
                      if (!Pilallamada.isEmpty()) {
                        LoadingPanel.getInstance().center();
                        LoadingPanel.getInstance().setLabelTexto("Saving...");
                        bookReaderServiceHolder.saveUser(Pilallamada.peek(), callback);

                      } else {
                        refreshPanel();
                      }
                    }
                  };
              LoadingPanel.getInstance().center();
              LoadingPanel.getInstance().setLabelTexto("Saving...");
              bookReaderServiceHolder.saveUser(Pilallamada.peek(), callback);
            }
            verticalPanel_1.clear();
            SaveNewUsers.setVisible(false);
          }
        });
    SaveNewUsers.addMouseDownHandler(
        new MouseDownHandler() {
          public void onMouseDown(MouseDownEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSavePush");
          }
        });
    SaveNewUsers.addMouseOutHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSave");
          }
        });
    SaveNewUsers.addMouseOverHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSaveOver");
          }
        });
    SaveNewUsers.setStyleName("gwt-ButtonBottonSave");
    //	SaveNewUsers.setStyleName("gwt-MenuItemMio");
    verticalPanel.add(SaveNewUsers);
    SaveNewUsers.setSize("100%", "100%");

    ScrollPanel scrollPanel = new ScrollPanel();
    horizontalSplitPanel.setRightWidget(scrollPanel);
    scrollPanel.setSize("100%", "100%");

    stackPanel_1 = new StackPanelMio();
    scrollPanel.setWidget(stackPanel_1);
    // simplePanel.add(stackPanel_1);

    stackPanel_1.setBotonTipo(new BotonesStackPanelUsersMio("prototipo", new VerticalPanel()));
    stackPanel_1.setBotonClick(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            Long Nombre = ((BotonesStackPanelUsersMio) event.getSource()).getEntidad().getID();
            LoadingPanel.getInstance().center();
            LoadingPanel.getInstance().setLabelTexto("Loading...");
            bookReaderServiceHolder.loadUserById(
                Nombre,
                new AsyncCallback<UserApp>() {

                  public void onFailure(Throwable caught) {
                    LoadingPanel.getInstance().hide();
                  }

                  public void onSuccess(UserApp result) {
                    LoadingPanel.getInstance().hide();
                    if (result.getGroupIds() == null) result.setGroupIds(new ArrayList<Long>());
                    if (!result.getGroupIds().isEmpty())
                      if (Window.confirm(
                          InformationConstants.ARE_YOU_SURE_DELETE_USER
                              + result.getGroupIds().size()
                              + InformationConstants.ARE_YOU_SURE_DELETE_USER2))
                        remove(result.getId());
                      else {
                      }
                    else {
                      if (Window.confirm(
                          "Are you sure you want to delete this user?, he is not a member of any group"))
                        remove(result.getId());
                    }
                  }
                });
          }

          private void remove(Long userId) {

            LoadingPanel.getInstance().center();
            LoadingPanel.getInstance().setLabelTexto("Deleting...");
            bookReaderServiceHolder.deleteUserApp(
                userId,
                new AsyncCallback<Integer>() {

                  public void onFailure(Throwable caught) {
                    LoadingPanel.getInstance().hide();
                    Window.alert("Sorry but the user could not be removed, try again later");
                  }

                  public void onSuccess(Integer result) {
                    LoadingPanel.getInstance().hide();
                    refreshPanel();
                  }
                });
          }
        });

    LoadingPanel.getInstance().center();
    LoadingPanel.getInstance().setLabelTexto("Loading...");
    bookReaderServiceHolder.getUsersApp(
        new AsyncCallback<ArrayList<UserApp>>() {

          public void onFailure(Throwable caught) {
            LoadingPanel.getInstance().hide();
          }

          public void onSuccess(ArrayList<UserApp> result) {
            LoadingPanel.getInstance().hide();
            if (result.size() < 10) {
              for (UserApp User1 : result) {
                String Bienvenida;
                if ((User1.getName() != null) && (!User1.getName().isEmpty()))
                  Bienvenida = User1.getName();
                else Bienvenida = User1.getEmail();
                EntidadUser E = new EntidadUser(Bienvenida, User1.getId());
                stackPanel_1.addBotonLessTen(E);
              }

            } else {
              for (UserApp User1 : result) {
                String Bienvenida;
                if ((User1.getName() != null) && (!User1.getName().isEmpty()))
                  Bienvenida = User1.getName();
                else Bienvenida = User1.getEmail();
                EntidadUser E = new EntidadUser(Bienvenida, User1.getId());
                stackPanel_1.addBoton(E);
              }
            }
            stackPanel_1.setSize("100%", "100%");
            stackPanel_1.ClearEmpty();
          }
        });

    stackPanel_1.setSize("100%", "100%");
  }
Exemplo n.º 23
0
  private void updateSchedule() {
    content.clear();
    content.add(new HTMLPanel("<h1>Update schedule</h1>"));
    HorizontalPanel hpanel = new HorizontalPanel();

    hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    hpanel.setSpacing(10);

    final DatePicker dateFrom = new DatePicker();
    final DatePicker dateTo = new DatePicker();

    final Button update =
        WidgetFactory.createButton(
            "Update",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                final long twelveHours = 12 * 60 * 60 * 1000;
                final long timeFrom = dateFrom.getValue().getTime() - twelveHours;
                final long timeTo = dateTo.getValue().getTime() + twelveHours;

                surveyControl.getParameters(
                    new AsyncCallback<SurveyParameters>() {
                      @Override
                      public void onFailure(Throwable caught) {
                        content.clear();
                        content.add(new HTMLPanel("<p>Server error: </p>" + caught.getMessage()));
                      }

                      @Override
                      public void onSuccess(SurveyParameters result) {
                        surveyControl.setParameters(
                            result.withDates(timeFrom, timeTo),
                            new AsyncCallback<Void>() {
                              @Override
                              public void onFailure(Throwable caught) {
                                content.clear();
                                content.add(
                                    new HTMLPanel("<p>Server error: </p>" + caught.getMessage()));
                              }

                              @Override
                              public void onSuccess(Void result) {
                                Location.reload();
                              }
                            });
                      }
                    });
              }
            });

    update.getElement().addClassName("scran24-admin-button");

    dateFrom.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {
            if (event.getValue() != null && dateTo.getValue() != null) {
              update.setEnabled(true);
            }
          }
        });

    dateTo.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {
            if (event.getValue() != null && dateFrom.getValue() != null) {
              update.setEnabled(true);
            }
          }
        });

    update.setEnabled(false);

    switch (parameters.state) {
      case SUSPENDED:
      case ACTIVE:
        dateFrom.setValue(new Date(parameters.startDate), true);
        dateTo.setValue(new Date(parameters.endDate), true);
        break;
      case NOT_INITIALISED:
        break;
    }

    hpanel.add(new Label("Start date:"));
    hpanel.add(dateFrom);
    hpanel.add(new Label("End date:"));
    hpanel.add(dateTo);

    content.add(hpanel);
    content.add(update);
  }
Exemplo n.º 24
0
  private Widget makeWordSearch() {
    // Make some radio buttons, all in one group.
    final RadioButton standardRadio = new RadioButton("tipPretrage", "Standardna riječ");
    RadioButton dialectRadio = new RadioButton("tipPretrage", "Dijalektna riječ");
    dialectRadio.setValue(true);

    FlowPanel form = new FlowPanel();
    form.setStyleName("form-search");

    FlowPanel innerForm = new FlowPanel();
    innerForm.setStyleName("inner-form-search");

    HorizontalPanel hp = new HorizontalPanel();
    Label lblRijec = new Label("Riječ:");
    lblRijec.setStyleName("form-label");
    hp.add(lblRijec);
    rijec = new TextBox();
    rijec.setStyleName("search-query");
    hp.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    hp.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    hp.add(rijec);
    innerForm.add(hp);

    HorizontalPanel hpMisto = new HorizontalPanel();
    Label lblMisto = new Label("Lokacija:");
    lblMisto.setStyleName("form-label");
    hpMisto.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    hpMisto.add(lblMisto);
    misto = new TextBox();
    misto.setStyleName("search-query");
    hpMisto.add(misto);
    innerForm.add(hpMisto);

    form.add(innerForm);

    FlowPanel panel = new FlowPanel();
    panel.setStyleName("form-search");
    panel.add(standardRadio);
    panel.add(dialectRadio);
    panel.add(form);

    FlowPanel op = new FlowPanel();
    op.setStyleName("kontrole");
    Button searchBtn =
        new Button(
            "Traži",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                bartInstance.table.setRowCount(0);
                if (standardRadio.getValue()) {
                  bartInstance.searchWord(rijec.getText(), 0, misto.getText());
                } else {
                  bartInstance.searchDialectWord(rijec.getText(), 0, misto.getText());
                }

                hide();
              }
            });
    op.add(searchBtn);
    Button closeBtn =
        new Button(
            "Odustani",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });
    op.add(closeBtn);

    searchBtn.setStyleName("btn btn-primary btn-large padded-right");
    closeBtn.setStyleName("btn btn-primary btn-large");

    panel.add(op);

    return panel;
  }
Exemplo n.º 25
0
  public void setGameDetail(final GameDetail detail) {
    final GameInfo info = detail.info;
    CShell.frame.setTitle(info.name);

    // keep our requested game id around
    _gameId = detail.gameId;

    VerticalPanel shot = new VerticalPanel();
    shot.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    shot.add(new ThumbBox(info.shotMedia, MediaDescSize.GAME_SHOT_SIZE));
    shot.add(WidgetUtil.makeShim(5, 5));
    Rating rating =
        new Rating(
            info.rating,
            info.ratingCount,
            detail.memberRating,
            false,
            new RateService() {
              public void handleRate(byte newRating, InfoCallback<RatingResult> callback) {
                _gamesvc.rateGame(_gameId, newRating, callback);
              }
            },
            null);

    shot.add(rating);
    HorizontalPanel mbits = new HorizontalPanel();
    mbits.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    mbits.add(
        MsoyUI.makeShareButton(
            Pages.GAMES,
            Args.compose("d", _gameId),
            _msgs.gdpGame(),
            info.name,
            info.description,
            info.shotMedia));
    shot.add(mbits);
    setWidget(0, 0, shot);
    getFlexCellFormatter().setRowSpan(0, 0, 2);
    getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);

    setWidget(0, 1, new GameNamePanel(info.name, info.genre, info.creator, info.description), 2);

    setWidget(1, 0, new GameBitsPanel(detail));

    FlowPanel play = new FlowPanel();
    play.setStyleName("playPanel");
    play.add(PlayButton.createLarge(_gameId));
    if (info.playersOnline > 0) {
      play.add(MsoyUI.createLabel(_msgs.featuredOnline("" + info.playersOnline), "Online"));
    }
    if (!info.integrated) {
      play.add(MsoyUI.createLabel(_msgs.gdpNoCoins(), null));
    }
    setWidget(1, 1, play, 1, "Play");
    getFlexCellFormatter().setHorizontalAlignment(1, 1, HasAlignment.ALIGN_CENTER);

    // add "Discussions" (if appropriate) and "Shop" button
    Widget buttons = null;
    if (info.groupId > 0) {
      ClickHandler onClick = Link.createHandler(Pages.GROUPS, "f", info.groupId);
      buttons = MsoyUI.createButton(MsoyUI.LONG_THIN, _msgs.gdpDiscuss(), onClick);
    }
    ClickHandler onShop = Link.createHandler(Pages.SHOP, "g", Math.abs(_gameId));
    PushButton shop = MsoyUI.createButton(MsoyUI.MEDIUM_THIN, _msgs.gdpShop(), onShop);
    buttons = (buttons == null) ? shop : MsoyUI.createButtonPair(buttons, shop);
    setWidget(2, 0, buttons);
    getFlexCellFormatter().setRowSpan(0, 0, 3);
    getFlexCellFormatter().setRowSpan(1, 1, 2);

    setWidget(
        3,
        0,
        _tabs =
            new NaviTabPanel(Pages.GAMES) {
              protected Args getTabArgs(int tabIdx) {
                return getTabCode(tabIdx).args(_gameId);
              }
            },
        3);

    // add the about/instructions tab
    addTab(GameDetails.INSTRUCTIONS, _msgs.tabInstructions(), new InstructionsPanel(detail));

    // add comments tab
    addTab(
        GameDetails.COMMENTS,
        _msgs.tabComments(),
        new LazyPanel() {
          protected Widget createWidget() {
            CommentsPanel comments = new CommentsPanel(CommentType.GAME, info.gameId, true);
            comments.expand();
            return comments;
          }
        });

    // add trophies tab, passing in the potentially negative gameId
    addTab(
        GameDetails.TROPHIES,
        _msgs.tabTrophies(),
        new LazyPanel() {
          protected Widget createWidget() {
            return new GameTrophyPanel(_gameId);
          }
        });

    // add top rankings tabs
    if (!CShell.isGuest()) {
      addTab(
          GameDetails.MYRANKINGS,
          _msgs.tabMyRankings(),
          new LazyPanel() {
            protected Widget createWidget() {
              return new TopRankingPanel(info.gameId, true);
            }
          });
    }
    addTab(
        GameDetails.TOPRANKINGS,
        _msgs.tabTopRankings(),
        new LazyPanel() {
          protected Widget createWidget() {
            return new TopRankingPanel(info.gameId, false);
          }
        });

    // if we're the creator of the game or support, add the metrics and logs tabs
    if (info.isCreator(CShell.getMemberId()) || CShell.isSupport()) {
      // addTab(GameDetails.METRICS, _msgs.tabMetrics(), new LazyPanel() {
      //     protected Widget createWidget () {
      //         return new GameMetricsPanel(detail);
      //     }
      // });
      addTab(
          GameDetails.LOGS,
          _msgs.tabLogs(),
          new LazyPanel() {
            protected Widget createWidget() {
              return new GameLogsPanel(info.gameId);
            }
          });
      addTab(
          GameDetails.DEV_LOGS,
          _msgs.tabDevLogs(),
          new LazyPanel() {
            protected Widget createWidget() {
              return new GameLogsPanel(GameInfo.toDevId(info.gameId));
            }
          });
    }
  }
Exemplo n.º 26
0
  /**
   * Requests that the current inventory page be displayed (clearing out any currently displayed
   * item detail view).
   *
   * @param query If non-null, this query is being applied so data must be reloaded from db
   */
  protected void showInventory(final int page, final String query) {
    // don't fiddle with things if the inventory is already showing
    if (!_contents.isAttached()) {
      clear();
      String title =
          (_type == MsoyItemType.NOT_A_TYPE)
              ? _msgs.stuffTitleMain()
              : (_memberId == CShell.getMemberId())
                  ? _msgs.stuffTitle(_dmsgs.xlateItemsType(_type))
                  : _msgs.stuffTitlePlayer(_dmsgs.xlateItemsType(_type));

      add(MsoyUI.createLabel(title, "TypeTitle"));
      add(_search);
      HorizontalPanel row = new HorizontalPanel();
      row.setVerticalAlignment(HorizontalPanel.ALIGN_TOP);
      MsoyItemType[] items =
          CShell.getClientMode().isMinimal() ? MsoyItemType.DJ_ITEMS : MsoyItemType.STUFF_ITEMS;
      row.add(
          new SideBar(
              new SideBar.Linker() {
                public boolean isSelected(MsoyItemType itemType) {
                  return itemType == _type;
                }

                public Widget createLink(String name, MsoyItemType itemType) {
                  return Link.create(name, Pages.STUFF, itemType, _memberId);
                }
              },
              items,
              null));

      row.add(_contents);
      add(row);
      if (_upload != null) {
        add(_upload);
      }
    }

    // determine which filter predicate we should be using
    final Predicate<Item> pred = FILTERS.get(_filters.getSelectedIndex());

    // maybe we're changing our predicate or changing page on an already loaded model
    SimpleDataModel<Item> model = _models.getModel(_memberId, _type, query, 0);
    if (model != null) {
      _contents.setModel(model.filter(pred), page);
      return;
    }

    // otherwise we have to load
    _models.loadModel(
        _memberId,
        _type,
        query,
        0,
        new InfoCallback<DataModel<Item>>() {
          public void onSuccess(DataModel<Item> result) {
            SimpleDataModel<Item> model = (SimpleDataModel<Item>) result;
            _contents.setModel(model.filter(pred), page);
          }
        });
  }
Exemplo n.º 27
0
  public void onModuleLoad() {

    TabLayoutPanel tabLayoutPanel = new TabLayoutPanel(2.5, Unit.EM);
    final SplitLayoutPanel splitLayoutPanel = new SplitLayoutPanel();
    final HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.setSpacing(10);
    hPanel.add(new HTML("HQMF Viewer."));
    Button processHQMFButton = new Button("Process HQMF.");
    processHQMFButton.addStyleName("sendButton");
    hPanel.add(processHQMFButton);
    hPanel.add(new HTML("\t(For some reason, works only in IE right now.)"));

    final VerticalPanel summaryVerticalPanel = new VerticalPanel();
    summaryVerticalPanel.setSpacing(3);
    processHQMFButton.setStyleName("summaryVPanel");
    summaryVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    summaryVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    splitLayoutPanel.addNorth(hPanel, 50);
    splitLayoutPanel.addWest(summaryVerticalPanel, 0);

    final RichTextArea textArea = new RichTextArea();
    textArea.setTitle("Paste your HQMF XML here.");
    textArea.setText("Paste your HQMF XML here.");
    textArea.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            if (textArea.getText().length() < 30
                && textArea.getText().equals("Paste your HQMF XML here.")) {
              textArea.setText("");
            }
          }
        });
    textArea.addStyleName("boxsizingBorder");
    textArea.setWidth("100%");
    textArea.setHeight("100%");

    processHQMFButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            processHQMF(textArea, splitLayoutPanel, summaryVerticalPanel);
            splitLayoutPanel.remove(hPanel);
            splitLayoutPanel.setWidgetSize(summaryVerticalPanel, 200);
            splitLayoutPanel.setWidgetToggleDisplayAllowed(summaryVerticalPanel, true);
          }
        });
    splitLayoutPanel.add(textArea);

    MySplitLayoutPanel mySplitPanel = new MySplitLayoutPanel();
    final VerticalPanel testVerticalPanel = new VerticalPanel();
    testVerticalPanel.setSpacing(3);

    testVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    testVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    // final RichTextArea testtextArea = getSmartTextArea();
    // final AceEditor testtextArea = getAceEditor();
    AceEditor aceTxtArea = new AceEditor();
    aceTxtArea.setWidth("100%");
    aceTxtArea.setHeight("100%");

    mySplitPanel.addEast(testVerticalPanel, 0);
    mySplitPanel.add(aceTxtArea);
    //		mySplitPanel.add(testtextArea);

    aceTxtArea.startEditor();

    setAceEditorProperties(aceTxtArea);

    mySplitPanel.setWidgetToggleDisplayAllowed(testVerticalPanel, true);

    tabLayoutPanel.add(mySplitPanel, "test CQL Editor.");
    tabLayoutPanel.add(splitLayoutPanel, "HQMF Viewer");

    RootLayoutPanel.get().add(tabLayoutPanel);
  }
Exemplo n.º 28
0
  public TabWidget(
      String text,
      String tooltip,
      final SolutionBrowserPerspective perspective,
      final TabPanel tabPanel,
      final Widget tabContent) {
    // BISERVER-2317 Request for more IDs for Mantle UI elements
    // the id for each tab shall be the text which it displays
    getElement().setId("tab-" + text); // $NON-NLS-1$

    this.tabPanel = tabPanel;
    this.tabContent = tabContent;
    this.perspective = perspective;
    this.fullText = text;
    setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    panel.setStyleName("tabWidget"); // $NON-NLS-1$
    leftCap.setStyleName("tabWidgetCap"); // $NON-NLS-1$
    Image leftCapImage = new Image();
    MantleImages.images.space1x20().applyTo(leftCapImage);
    leftCap.setSpacing(0);
    leftCapImage.setWidth("5px"); // $NON-NLS-1$
    leftCap.add(leftCapImage);

    setLabelText(text);
    setLabelTooltip(tooltip);
    textLabel.setWordWrap(false);
    textLabel.addMouseListener(this);

    tabPanel.addTabListener(
        new TabListener() {

          public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) {
            return true;
          }

          public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
            ElementUtils.blur(getElement().getParentElement());
            if (tabIndex == tabPanel.getWidgetIndex(tabContent)) {
              panel.setStyleName("tabWidget-selected"); // $NON-NLS-1$
              leftCap.setStyleName("tabWidgetCap-selected"); // $NON-NLS-1$
            } else {
              panel.setStyleName("tabWidget"); // $NON-NLS-1$
              leftCap.setStyleName("tabWidgetCap"); // $NON-NLS-1$
            }
          }
        });

    MantleImages.images.closeTab().applyTo(closeTabImage);
    closeTabImage.setTitle(Messages.getString("closeTab")); // $NON-NLS-1$
    closeTabImage.addMouseListener(this);
    closeTabImage.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            closeTab();
          }
        });
    closeTabImage.getElement().setId("killTab"); // $NON-NLS-1$

    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    panel.add(textLabel);
    if (perspective != null) {
      panel.add(closeTabImage);
      DOM.setStyleAttribute(
          closeTabImage.getElement(), "margin", "5px"); // $NON-NLS-1$ //$NON-NLS-2$
      DOM.setStyleAttribute(
          textLabel.getElement(), "margin", "5px 0px 5px 0px"); // $NON-NLS-1$ //$NON-NLS-2$
    } else {
      DOM.setStyleAttribute(
          textLabel.getElement(), "margin", "4px 5px 5px 5px"); // $NON-NLS-1$ //$NON-NLS-2$
      DOM.setStyleAttribute(
          textLabel.getElement(), "paddingRight", "5px"); // $NON-NLS-1$ //$NON-NLS-2$
    }

    add(leftCap);
    add(panel);
    sinkEvents(Event.ONDBLCLICK | Event.ONMOUSEUP);
  }
Exemplo n.º 29
0
  public ScheduleEditor(ScheduleDialogType type) {
    super();
    isBlockoutDialog = (type == ScheduleDialogType.BLOCKOUT);
    startTimePicker = new TimePicker();

    setStylePrimaryName("scheduleEditor"); // $NON-NLS-1$

    scheduleCombo = createScheduleCombo();
    Label l = new Label(MSGS.recurrenceColon());
    l.setStyleName(SCHEDULE_LABEL);
    add(l);
    add(scheduleCombo);

    SimplePanel hspacer = new SimplePanel();
    hspacer.setWidth("100px"); // $NON-NLS-1$

    if (!isBlockoutDialog) {
      startTimePanel = createStartTimePanel();
      add(startTimePanel);
    } else {

      // Blockout End TimePicker
      blockoutEndTimePicker = new TimePicker();
      blockoutEndTimePicker.setHour("01"); // $NON-NLS-1$
      blockoutEndTimePicker.setMinute("00"); // $NON-NLS-1$
      blockoutEndTimePicker.setTimeOfDay(TimeUtil.TimeOfDay.PM);

      // Blockout End Caption Panel
      blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE);

      final String[] daysList = new String[365];
      final String[] hoursList = new String[24];
      final String[] minutesList = new String[60];

      // Populate list
      for (Integer i = 0; i < 365; i++) {
        String iStr = i.toString();
        daysList[i] = iStr;

        if (i < 60) {
          minutesList[i] = iStr;
          if (i < 24) {
            hoursList[i] = iStr;
          }
        }
      }

      // Units of time Drop Down
      daysListBox = new ListBox();
      daysListBox.getElement().setId("daysListBox"); // $NON-NLS-1$
      populateListItems(daysListBox, daysList, 0, 365);

      final Label daysLabel = new Label(MSGS.dayOrDays());
      daysLabel.getElement().setAttribute("for", daysListBox.getElement().getId()); // $NON-NLS-1$

      hoursListBox = new ListBox();
      hoursListBox.getElement().setId("hoursListBox"); // $NON-NLS-1$
      populateListItems(hoursListBox, hoursList, 0, 24);

      final Label hoursLabel = new Label(MSGS.hourOrHours());
      hoursLabel.getElement().setAttribute("for", hoursListBox.getElement().getId()); // $NON-NLS-1$

      minutesListBox = new ListBox();
      minutesListBox.getElement().setId("minutesListBox"); // $NON-NLS-1$
      populateListItems(minutesListBox, minutesList, 0, 60);

      final Label minutesLabel = new Label(MSGS.minuteOrMinutes());
      minutesLabel
          .getElement()
          .setAttribute("for", minutesListBox.getElement().getId()); // $NON-NLS-1$

      final HorizontalPanel durationPanel = new HorizontalPanel();
      durationPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
      durationPanel.setSpacing(blockoutEndTimePicker.getSpacing());
      durationPanel.add(daysListBox);
      durationPanel.add(daysLabel);
      durationPanel.add(hoursListBox);
      durationPanel.add(hoursLabel);
      durationPanel.add(minutesListBox);
      durationPanel.add(minutesLabel);

      // Bind change handler
      this.scheduleCombo.addChangeHandler(
          new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
              String scheduleType = scheduleCombo.getItemText(scheduleCombo.getSelectedIndex());

              if (ScheduleType.RUN_ONCE.toString().equals(scheduleType)) {
                show(
                    true,
                    daysListBox,
                    daysLabel,
                    hoursListBox,
                    hoursLabel,
                    minutesListBox,
                    minutesLabel);

                populateListItems(daysListBox, daysList, 0, 365);
                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.HOURS.toString().equals(scheduleType)) {
                hide(true, daysListBox, daysLabel, hoursListBox, hoursLabel);
                show(true, minutesListBox, minutesLabel);

                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.DAILY.toString().equals(scheduleType)) {
                hide(true, daysListBox, daysLabel);
                show(true, hoursListBox, hoursLabel, minutesListBox, minutesLabel);

                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.WEEKLY.toString().equals(scheduleType)) {
                show(
                    true,
                    daysListBox,
                    daysLabel,
                    hoursListBox,
                    hoursLabel,
                    minutesListBox,
                    minutesLabel);

                populateListItems(daysListBox, daysList, 0, 7);
                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.MONTHLY.toString().equals(scheduleType)) {
                show(
                    true,
                    daysListBox,
                    daysLabel,
                    hoursListBox,
                    hoursLabel,
                    minutesListBox,
                    minutesLabel);

                populateListItems(daysListBox, daysList, 0, 28);
                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.YEARLY.toString().equals(scheduleType)) {
                show(
                    true,
                    daysListBox,
                    daysLabel,
                    hoursListBox,
                    hoursLabel,
                    minutesListBox,
                    minutesLabel);

                populateListItems(daysListBox, daysList, 0, 365);
                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);
              }
            }
          });

      /*
       * Radio Buttons for duration
       */
      this.durationRadioButton =
          new RadioButton("durationRadioGroup", "durationRadioButton"); // $NON-NLS-1$ //$NON-NLS-2$
      this.durationRadioButton.setText(MSGS.duration());
      this.durationRadioButton.setValue(Boolean.TRUE);
      this.durationRadioButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE);
              durationPanel.getElement().getStyle().clearDisplay();
            }
          });

      this.endTimeRadioButton =
          new RadioButton("durationRadioGroup", "endTimeRadioButton"); // $NON-NLS-1$ //$NON-NLS-2$
      this.endTimeRadioButton.setText(MSGS.endTime());
      this.endTimeRadioButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              blockoutEndTimePicker.getElement().getStyle().clearDisplay();
              durationPanel.getElement().getStyle().setDisplay(Display.NONE);
            }
          });

      // Radio Buttons Panel
      HorizontalPanel radioButtonsPanel = new HorizontalPanel();
      radioButtonsPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
      radioButtonsPanel.add(this.durationRadioButton);
      radioButtonsPanel.add(this.endTimeRadioButton);

      // Ends Panel
      VerticalPanel endsPanel = new VerticalPanel();
      endsPanel.add(radioButtonsPanel);
      endsPanel.add(blockoutEndTimePicker);
      endsPanel.add(durationPanel);

      // Blockout period
      CaptionPanel blockoutStartCaptionPanel = new CaptionPanel(MSGS.startTime());
      HorizontalPanel blockoutStartPanel = new HorizontalPanel();
      blockoutStartPanel.add(getStartTimePicker());
      timeZonePicker = new ListBox();
      timeZonePicker.setStyleName("timeZonePicker");
      timeZonePicker.setVisibleItemCount(1);
      blockoutStartPanel.add(timeZonePicker);
      timeZonePicker.getElement().getParentElement().getStyle().setPaddingTop(5, Unit.PX);

      blockoutStartCaptionPanel.add(blockoutStartPanel);
      populateTimeZonePicker();

      // Ends Caption Panel
      CaptionPanel endCaptionPanel = new CaptionPanel(MSGS.endsCaptionTitle());
      endCaptionPanel.add(endsPanel);

      VerticalPanel blockoutPanel = new VerticalPanel();
      blockoutPanel.setWidth("100%"); // $NON-NLS-1$
      blockoutPanel.add(blockoutStartCaptionPanel);
      blockoutPanel.add(endCaptionPanel);

      add(blockoutPanel);
    }

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%"); // $NON-NLS-1$
    add(vp);
    setCellHeight(vp, "100%"); // $NON-NLS-1$

    runOnceEditor = new RunOnceEditor(startTimePicker);
    vp.add(runOnceEditor);
    scheduleTypeMap.put(ScheduleType.RUN_ONCE, runOnceEditor);
    runOnceEditor.setVisible(true);

    recurrenceEditor = new RecurrenceEditor(startTimePicker);
    vp.add(recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.SECONDS, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.MINUTES, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.HOURS, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.DAILY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.WEEKLY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.MONTHLY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.YEARLY, recurrenceEditor);
    recurrenceEditor.setVisible(false);

    cronEditor = new CronEditor();
    scheduleTypeMap.put(ScheduleType.CRON, cronEditor);
    cronEditor.setVisible(false);

    if (!isBlockoutDialog) {
      vp.add(cronEditor);

      VerticalPanel blockoutButtonPanel = new VerticalPanel();
      blockoutButtonPanel.setWidth("100%"); // $NON-NLS-1$
      // blockoutButtonPanel.setHeight("30%");
      blockoutButtonPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
      blockoutButtonPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);

      // We want to add a button to check for blockout conflicts
      blockoutCheckButton.setStyleName("pentaho-button"); // $NON-NLS-1$
      blockoutCheckButton.getElement().setId("blockout-check-button"); // $NON-NLS-1$
      blockoutCheckButton.setVisible(false);

      hspacer.setHeight("50px"); // $NON-NLS-1$
      blockoutButtonPanel.add(hspacer);
      blockoutButtonPanel.add(blockoutCheckButton);

      vp.add(hspacer);
      add(blockoutButtonPanel);
    }

    configureOnChangeHandler();
  }
Exemplo n.º 30
0
  private Widget createButtonPanel(final FlexTable mainPanel, final boolean forceOpen) {
    final IconButton reloadImageButton =
        new IconButton(
            "Refresh",
            true,
            BaseImageBundle.images.refresh_16(),
            BaseImageBundle.images.refresh_16(),
            BaseImageBundle.images.refresh_16(),
            BaseImageBundle.images.refresh_disabled_16());
    reloadImageButton.setSTYLE("commentToolBarButton");
    reloadImageButton.setTitle("Refresh comments");
    reloadImageButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            BaseServiceCache.getService()
                .getPageInfo(
                    permissibleObject,
                    Comment.class.getName(),
                    pageSize,
                    new AsyncCallback<PageInfo>() {
                      public void onFailure(Throwable caught) {};

                      public void onSuccess(PageInfo pageInfo) {
                        numComments = pageInfo.getTotalRowCount();
                        lastPageNumber = pageInfo.getLastPageNumber();
                        pageCache.clear();
                        fetchPage();
                      };
                    });
          }
        });

    final IconButton sortImageButton =
        new IconButton(
            "Sort " + (sortDescending ? "Ascending" : "Descending"),
            true,
            BaseImageBundle.images.sort(),
            BaseImageBundle.images.sort(),
            BaseImageBundle.images.sort(),
            BaseImageBundle.images.sort());
    sortImageButton.setSTYLE("commentToolBarButton");
    sortImageButton.setTitle(
        sortDescending ? "Show oldest comments first" : "Show most recent comments first");
    sortImageButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            sortDescending = !sortDescending;
            // this could be optimized if we have all the pages, then we have all the data
            // we could do it all on the client
            pageCache.clear();
            fetchPage();
          }
        });

    IconButton flattenImageButton = null;
    if (flatten) {
      flattenImageButton =
          new IconButton(
              "Hierarchy",
              true,
              BaseImageBundle.images.hierarchy(),
              BaseImageBundle.images.hierarchy(),
              BaseImageBundle.images.hierarchy(),
              BaseImageBundle.images.hierarchy());
      flattenImageButton.setTitle("Build a comment hierarchy");
    } else {
      flattenImageButton =
          new IconButton(
              "Flatten",
              true,
              BaseImageBundle.images.flatten(),
              BaseImageBundle.images.flatten(),
              BaseImageBundle.images.flatten(),
              BaseImageBundle.images.flatten());
      flattenImageButton.setTitle("Flatten the comment hierarchy");
    }
    flattenImageButton.setSTYLE("commentToolBarButton");
    flattenImageButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            flatten = !flatten;
            loadCommentWidget(forceOpen);
          }
        });

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    buttonPanel.add(createPageControllerPanel(mainPanel));
    Label spacer1 = new Label();
    buttonPanel.add(spacer1);
    buttonPanel.setCellWidth(spacer1, "20px");
    buttonPanel.add(reloadImageButton);
    buttonPanel.add(sortImageButton);
    buttonPanel.add(flattenImageButton);
    Label maxCommentDepthLabel = new Label("Max Depth", false);
    maxCommentDepthLabel.setTitle("Set the maximum depth of comments to show");
    Label spacer2 = new Label();
    buttonPanel.add(spacer2);
    buttonPanel.setCellWidth(spacer2, "20px");
    buttonPanel.add(maxCommentDepthLabel);
    buttonPanel.add(maxCommentDepthListBox);
    return buttonPanel;
  }