Exemplo n.º 1
0
  // 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);
  }
 public void setResourcePlayLink() {
   Anchor resourceAnchor = new Anchor();
   resourceAnchor.setHref(getResourceLink());
   resourceAnchor.setStyleName("");
   resourceAnchor.getElement().appendChild(resourceImageContainer.getElement());
   resourceThumbContainer.insert(resourceAnchor, 0);
 }
 /**
  * Select an item.
  *
  * @param item the item.
  */
 private void selectItem(final Label item) {
   if (activeItemIndex != null) {
     hashTags.getWidget(activeItemIndex).removeStyleName(style.activeHashTag());
   }
   item.addStyleName(style.activeHashTag());
   activeItemIndex = hashTags.getWidgetIndex(item);
 }
Exemplo n.º 4
0
 /**
  * Add an item to the list.
  *
  * @param pNewWidget the new display widget
  */
 @SuppressWarnings("unchecked")
 protected void addDisplayWidget(final W pNewWidget) {
   final String itemId = getIdFromWidget(pNewWidget);
   int beforeIdx = -1;
   for (Widget w : iGuiList) {
     CbGenericListItem<W> gli = (CbGenericListItem<W>) w;
     if (itemId.compareToIgnoreCase(getIdFromWidget(gli.getDisplayWidget())) < 0) {
       beforeIdx = gli.getRowIdx();
       break;
     }
   }
   CbGenericListItem<W> newRow =
       new CbGenericListItem<W>(getSelectorCallback(), getMoreArrowCallback());
   newRow.setDisplayWidget(pNewWidget);
   if (beforeIdx < 0) {
     newRow.setRowIdx(iGuiList.getWidgetCount());
     iGuiList.add(newRow);
   } else {
     newRow.setRowIdx(beforeIdx);
     iGuiList.insert(newRow, beforeIdx);
     int i = 0;
     for (Widget w : iGuiList) {
       ((CbGenericListItem<W>) w).setRowIdx(i++);
     }
   }
   checkEmptyListHint();
 }
  public TransferElementPanel() {

    mainPnl = new FlowPanel();
    nodeList = new ArrayList<String>();
    container = new FlowPanel();
    container.setStyleName("trnsfrElmt-containerPnl");

    closeBtn = new Button();
    closeBtn.setStyleName("endpt-list-pnl-close-btn");

    HTMLPanel hdr = new HTMLPanel("Transfer Element");
    hdr.setStyleName("trnsfrElmnt-list-hdr");
    hdr.add(closeBtn);

    trnsfrElmntOkBtn = new SwitchButton("OK");
    trnsfrElmntOkBtn.setStyleName("priLvl-btn");
    FlowPanel btnPnl = new FlowPanel();
    btnPnl.setStyleName("trnsfrElem-btnPnl");
    btnPnl.add(trnsfrElmntOkBtn);

    nodeContainer = new FlowPanel();
    nodeContainer.setStyleName("node-wdgt-cntr");
    container.add(hdr);
    container.add(nodeContainer);
    container.add(btnPnl);

    mainPnl.setStyleName("endpt-list-pnl");
    mainPnl.add(container);
    // mainPnl.add(btnPnl);

    hide();

    initWidget(mainPnl);
  }
Exemplo n.º 6
0
  protected void showEditor() {
    if (myTextEditor == null) {
      myTextEditor = new TextBox();
      myTextEditor.setStylePrimaryName("field_edit");
      myTextEditor.addValueChangeHandler(
          new ValueChangeHandler<String>() {
            public void onValueChange(ValueChangeEvent<String> aEvent) {
              hideEditor(true);
            }
          });
      myTextEditor.addBlurHandler(
          new BlurHandler() {

            public void onBlur(BlurEvent aEvent) {
              hideEditor(false);
            }
          });
    }
    if (allowHtml) {
      myTextEditor.setText(myHtmlView.getHTML());
      myOuterPanel.remove(myHtmlView);
    } else {
      myTextEditor.setText(myTextView.getText());
      myOuterPanel.remove(myTextView);
    }
    myOuterPanel.add(myTextEditor);
    myTextEditor.setFocus(true);
  }
Exemplo n.º 7
0
 @Override
 public void setLoading() {
   hLb.setText(constants.loading());
   for (int i = 0; i < actBar.getWidgetCount(); i++) {
     actBar.getWidget(i).setVisible(false);
   }
 }
Exemplo n.º 8
0
  public CollapsiblePanel(String heading) {
    disclosurePanel = new DisclosurePanel();

    FlowPanel h = new FlowPanel();
    h.add(icon = new Icon(IconType.PLUS));
    h.add(header = new InlineLabel(heading));
    header.addStyleName("small-indent");
    setHeader(h);

    disclosurePanel.addCloseHandler(
        new CloseHandler<DisclosurePanel>() {
          @Override
          public void onClose(CloseEvent<DisclosurePanel> event) {
            icon.setIcon(IconType.PLUS);
          }
        });

    disclosurePanel.addOpenHandler(
        new OpenHandler<DisclosurePanel>() {
          @Override
          public void onOpen(OpenEvent<DisclosurePanel> event) {
            icon.setIcon(IconType.MINUS);
          }
        });

    disclosurePanel.add(content = new FlowPanel());
    disclosurePanel.removeStyleName("gwt-DisclosurePanel");
    disclosurePanel.setAnimationEnabled(true);
    addStyleName("collapsible");
    setWidget(disclosurePanel);
  }
 @Override
 public void clearErrorMessage() {
   if (holder.getWidgetCount() == 1) {
     return;
   }
   holder.remove(1);
 }
Exemplo n.º 10
0
  private void newGame() {
    // das Panel ist unser Spielbrett

    panel.clear();

    // Karten-Array erstellen
    int[] feld = new int[karten * 2];
    for (int i = 0; i < karten; i++) {
      feld[i] = i;
      // 6 Felder weiter das Gleiche
      feld[i + karten] = i;
      // dadurch haben wir ein Array mit dem Muster
      // {1,2,3,4,5,6,1,2,3,4,5,6}
      //
    }
    // jetzt die "Karten" mischen
    for (int i = 0; i < 100; i++) {
      // 2 Zufallszahlen
      int a = (int) Math.round(Math.random() * ((karten * 2) - 1));
      int b = (int) Math.round(Math.random() * ((karten * 2) - 1));
      GWT.log("Tausche " + a + " mit " + b);
      // Mischalgorithmus
      int c = feld[a];
      feld[a] = feld[b];
      feld[b] = c;
    }

    // Karten initialisieren und aufs Spielbrett packen
    for (int i = 0; i < karten * 2; i++) {
      Karte karte = new Karte("card" + (feld[i] + 1) + ".png");
      panel.add(karte);
      // jetzt den Handler verwenden - wir rufen eine Methosde darau auf
      karte.addMouseDownHandler(onCardClick(karte));
    }
  }
Exemplo n.º 11
0
  private Panel buildPanelBrowse() {

    this._panelBrowse.setSpacing(Constantes.SPACING_MIN);
    this._panelBrowse.setHeight(Constantes.Dim50PX);
    this._panelBrowse.setWidth(Constantes.MAX_SIZE);
    this._panelBrowse.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    this._panelBrowse.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    // radio button
    final VerticalPanel vPanelLabel = new VerticalPanel();
    vPanelLabel.add(this._rbChoisirArchive);
    vPanelLabel.add(this._rbChoisirRepSource);
    this._panelBrowse.add(vPanelLabel);
    this._panelBrowse.setCellWidth(vPanelLabel, "300px");

    // action panel
    final FlowPanel actionPanel = new FlowPanel();
    actionPanel.add(this._fileUploader);
    actionPanel.add(this.buildAppletButton());
    this._panelBrowse.add(actionPanel);
    this._panelBrowse.setCellWidth(actionPanel, "350px");

    // buttons
    this._panelBrowse.add(this._btGoInfo);
    this._panelBrowse.setCellWidth(this._btGoInfo, "50px");

    this._panelBrowse.add(this._btDemo);

    return this._panelBrowse;
  }
Exemplo n.º 12
0
  /** Constructor. */
  private ExportBox() {
    super(false);

    panel = new VerticalPanel();
    panel.getElement().getStyle().setMarginTop(1, Unit.EM);

    setHeadline(R.lang.Export());
    setDraggable(true);
    setWidth(WIDTH_PX + "px");

    btnExportXML = new Button(R.lang.exportInFile());
    btnExportXML.getElement().getStyle().setFloat(Float.RIGHT);
    btnExportXML.addClickHandler(this);

    btnClose = new Button(R.lang.Close());
    btnClose.getElement().getStyle().setMarginLeft(1, Unit.EM);
    btnClose.getElement().getStyle().setFloat(Float.RIGHT);
    btnClose.addClickHandler(this);

    textarea = new TextArea();
    textarea.setWidth((WIDTH_PX - 10) + "px");
    textarea.setHeight("200px");

    btnPanel = new FlowPanel();
    btnPanel.add(btnClose);
    btnPanel.add(btnExportXML);

    panel.add(textarea);
    panel.add(btnPanel);

    setContentWidget(panel);
  }
Exemplo n.º 13
0
  /** Creates a control panel for adjusting the number of histogram classes */
  private void createNumClassesPanel() {

    int numClasses = getModel().getSettings().getNumClasses();
    fldNumClasses = (new InputPanelW(null, app, -1, false)).getTextComponent();
    fldNumClasses.setEditable(false);
    fldNumClasses.setOpaque(true);
    fldNumClasses.setColumns(2);
    fldNumClasses.setVisible(false);

    sliderNumClasses = new Slider(3, 20);
    sliderNumClasses.setValue(numClasses);

    sliderNumClasses.setMajorTickSpacing(1);

    sliderNumClasses.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            getModel().getSettings().setNumClasses(sliderNumClasses.getValue());
            fldNumClasses.setText(("" + getModel().getSettings().getNumClasses()));
            getModel().updatePlot(true);
          }
        });

    numClassesPanel = new FlowPanel();
    numClassesPanel.add(sliderNumClasses);
    numClassesPanel.add(fldNumClasses);
  }
Exemplo n.º 14
0
  void repaint() {
    files.clear();
    for (final String key : idOrdering) {
      files.add(
          new LinkButton(
              "icon-remove",
              id2name.get(key),
              "",
              new ClickHandler() {
                HandlerRegistration handler;

                @Override
                public void onClick(ClickEvent event) {
                  deleteName.setText(key);
                  handler =
                      deleteForm.addSubmitCompleteHandler(
                          new SubmitCompleteHandler() {
                            @Override
                            public void onSubmitComplete(SubmitCompleteEvent event) {
                              handler.removeHandler();
                              idOrdering.remove(key);
                              id2name.remove(key);
                              repaint();
                            }
                          });
                  deleteForm.submit();
                }
              }));
      files.add(new InlineLabel(" "));
    }
    if (id2name.size() > 0) files.add(new HTML("<br/>"));
  }
Exemplo n.º 15
0
  @Override
  protected IsWidget body(final ApplyContext context) {
    FlowPanel body = new FlowPanel();
    body.add(new HTML(TEMPLATES.errorPanel(Console.CONSTANTS.patch_manager_apply_error_body())));

    errorDetails =
        new ErrorDetails(
            Console.CONSTANTS.patch_manager_show_details(),
            Console.CONSTANTS.patch_manager_hide_details());
    body.add(errorDetails);

    body.add(
        new HTML(
            "<h3 class=\"patch-followup-header\">"
                + Console.CONSTANTS.patch_manager_possible_actions()
                + "</h3>"));
    HTMLPanel actions =
        new HTMLPanel(
            TEMPLATES.appliedFailed(
                Console.CONSTANTS.patch_manager_apply_error_cancel_title(),
                Console.CONSTANTS.patch_manager_apply_error_cancel_body(),
                Console.CONSTANTS.patch_manager_apply_error_select_title(),
                Console.CONSTANTS.patch_manager_apply_error_select_body()));
    selectPatch = new DefaultButton(Console.CONSTANTS.patch_manager_select_patch_title());
    selectPatch.getElement().setAttribute("style", "min-width:60px;");
    selectPatch.addStyleName("primary");
    actions.add(selectPatch, "select-different-patch");
    body.add(actions);

    return body;
  }
Exemplo n.º 16
0
 private void setupLoadIndicator() {
   ImageResource imageResource = getResources().getLoadIndicator();
   Image image = new Image(imageResource);
   loadIndicator = new FlowPanel();
   loadIndicator.addStyleName(getResources().css().centered());
   loadIndicator.add(image);
 }
Exemplo n.º 17
0
 private final void addChild(IsWidget child, String width) {
   if (horizontal) {
     panel.add(horizontalWrapper(child, width));
   } else {
     panel.add(child);
   }
 }
  private void plot() {
    if (dygraphs != null) {
      if (panel.remove(dygraphs)) ;
    }

    String eq = textArea.getValue();

    double x1 = Double.parseDouble(fromTb.getValue());
    double x2 = Double.parseDouble(toTb.getValue());
    double xs = 1.0 * (x2 - x1) / width;

    JsArray<JsArrayMixed> data = JsArray.createArray().cast();
    for (int i = 0; i < width; i++) {
      double x = x1 + i * xs;
      JsArrayNumber y = evalFn(eq, x);
      JsArrayMixed row = JsArrayMixed.createArray().cast();
      row.push(x);
      for (int j = 0; j < y.length(); j++) {
        row.push(y.get(j));
      }
      data.push(row);
    }
    dygraphs = new Dygraphs(data, null);
    dygraphs.setPixelSize(width, height);
    panel.add(dygraphs);
  }
Exemplo n.º 19
0
 @Override
 public void reset() {
   hLb.setText("Thai SME Accounting");
   for (int i = 0; i < actBar.getWidgetCount(); i++) {
     actBar.getWidget(i).setVisible(false);
   }
 }
Exemplo n.º 20
0
  private void createAndShowWizardFinishedContentPanel(
      final String jobName, final Button closeButton) {
    final FlowPanel contentPanel = new FlowPanel();
    contentPanel.addStyleName("WizardFinishedPanel");

    if (jobName != null && clientConfig.isScheduleEditor()) {

      contentPanel.add(_loadingIndicator);
      setContent(contentPanel);

      getSchedule(
          new Runnable() {

            @Override
            public void run() {

              final Anchor triggerAnchor = createTriggerAnchor(jobName);
              final Anchor schedulingAnchor = createSchedulingAnchor(jobName);

              // TODO: Previously there was a "Monitor this job's
              // metrics on the dashboard" anchor as well. Add it?

              contentPanel.remove(_loadingIndicator);

              populateContentPanel(jobName, closeButton, contentPanel);
              contentPanel.add(triggerAnchor);
              contentPanel.add(schedulingAnchor);
            }
          },
          jobName);
    } else {
      populateContentPanel(jobName, closeButton, contentPanel);
    }
  }
Exemplo n.º 21
0
  /**
   * Mark the list item with the given ID.
   *
   * @param pItemId item ID
   */
  @SuppressWarnings("unchecked")
  public void setMarked(final String pItemId) {
    if (LOG.isTraceEnabled()) {
      LOG.enter(
          "setMarked", //$NON-NLS-1$
          new String[] {"pItemId"},
          new Object[] {pItemId}); // $NON-NLS-1$
    }

    boolean clear =
        pItemId == null
            || pItemId.equals(
                getIdFromWidget(
                    ((CbGenericListItem<W>) iGuiList.getWidget(iMarkedIdx)).getDisplayWidget()));
    clearMarker();
    if (pItemId != null && !clear) {
      int idx = 0;
      for (Iterator<Widget> iter = iGuiList.iterator(); iter.hasNext(); idx++) {
        CbGenericListItem<W> gli = (CbGenericListItem<W>) iter.next();
        W w = gli.getDisplayWidget();
        if (pItemId.equals(getIdFromWidget(w))) {
          setMarked(idx);
          break;
        }
      }
    }

    LOG.exit("setMarked"); // $NON-NLS-1$
  }
Exemplo n.º 22
0
  private void showNonDatastoreConsumingWizardSelection(
      final FlowPanel panel, final List<WizardIdentifier> wizards, final List<RadioButton> radios) {
    if (wizards == null || wizards.isEmpty()) {
      // do nothing
      return;
    }

    panel.add(new Label("Or select a different job type ..."));
    for (final WizardIdentifier wizard : wizards) {
      final RadioButton radio = new RadioButton("initialSelection", wizard.getDisplayName());
      radio.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              GWT.log(
                  "Clicked: " + wizard + " - expected " + wizard.getExpectedPageCount() + " pages");
              _stepsBeforeWizardPages = 1;
              setSteps(wizard.getExpectedPageCount() + getStepsBeforeWizardPages(), false);
              setProgress(0);
            }
          });
      panel.add(radio);
      radios.add(radio);
    }

    getWizardPanel().refreshUI();
  }
Exemplo n.º 23
0
  public Slider(
      int width,
      int height,
      double min,
      double max,
      double initialPercentage,
      boolean includeTextBox) {
    this.percentage = initialPercentage;
    this.min = min;
    this.max = max;
    // TODO Consistency check in the min-max-initialPercentage
    this.canvas = Canvas.createIfSupported();
    if (this.canvas != null) {
      this.canvas.setWidth(width + "px");
      this.canvas.setHeight(height + "px");
      this.canvas.setCoordinateSpaceWidth(width);
      this.canvas.setCoordinateSpaceHeight(height);
      this.canvas.setStyleName(RESOURCES.getCSS().slider());
      FlowPanel fp = new FlowPanel();
      fp.add(this.canvas);

      if (includeTextBox) {
        this.valueTb = new ValueBox(initialPercentage);
        fp.add(this.valueTb);
      }

      this.initWidget(fp);
      this.initialise(width, height, initialPercentage);
    }
  }
Exemplo n.º 24
0
  public TilePopup() {
    super(true, false);
    // init widgets
    FlowPanel Content = new FlowPanel();
    Label levelLabel = new Label("Level:");
    levelBox = new IntegerBox();

    // setup widgets
    levelBox.setWidth("50px");
    levelBox.setMaxLength(2);
    levelBox.addKeyUpHandler(
        new KeyUpHandler() {

          @Override
          public void onKeyUp(KeyUpEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
              hide();
            }
          }
        });

    // build
    Content.add(levelLabel);
    Content.add(levelBox);
    this.add(Content);
  }
Exemplo n.º 25
0
  private void init() {
    // TODO Auto-generated method stub
    main = new FlowPanel();
    initWidget(main);

    header = new UIHomeHeader();
    main.add(header);

    container = new DeckPanel();
    container.setAnimationEnabled(true);
    main.add(container);

    uiPrestamo = new UIPrestamoImpl(this);
    container.add(uiPrestamo);

    uiMantPrestamo = new UIMantPrestamoImpl(this);
    container.add(uiMantPrestamo);

    uiCliente = new UIClienteImpl(this);
    container.add(uiCliente);

    uiAmortizacion = new UIAmortizacionImpl(this);
    container.add(uiAmortizacion);

    uiMantAmortizacion = new UIMantAmortizacionImpl(this);
    container.add(uiMantAmortizacion);

    container.showWidget(0);
    uiPrestamo.scrollPanel.refresh();
  }
Exemplo n.º 26
0
 public void add(Widget w) {
   if (w instanceof Hidden) {
     formElements.insert(w, 0);
   } else {
     formElements.add(w);
   }
 }
Exemplo n.º 27
0
  @UiConstructor
  public PreviewResourceView(CollectionItemDo collectionItemDo, int itemIndex) {
    initWidget(uiBinder.createAndBindUi(this));
    resourceThumbContainer.getElement().setId("fpnlResourceThumbContainer");
    resourceImageContainer.getElement().setId("fpnlResourceImageContainer");
    resourceThumbnail.getElement().setId("imgResourceThumbnail");
    resourceTypeImage.getElement().setId("lblResourceTypeImage");
    resourceNumber.getElement().setId("lblResourceNumber");
    resourceTitle.getElement().setId("htmlResourceTitle");
    resourceIndex.getElement().setId("lblResourceIndex");
    resourceHoverTitle.getElement().setId("htmlResourceHoverTitle");
    resourceCategory.getElement().setId("lblResourceCategory");
    resourceSourceName.getElement().setId("lblResourceSourceName");
    ratingWidgetPanel.getElement().setId("fpnlRatingWidgetPanel");
    this.collectionItemDo = collectionItemDo;
    setNavigationResourceTitle(collectionItemDo.getResource().getTitle());
    if (collectionItemDo.getResource().getResourceFormat() != null) {
      setResourceTypeIcon(collectionItemDo.getResource().getResourceFormat().getDisplayName());
    }
    setResourceCategory();
    setReourceSourceName();
    setResourceSequence(itemIndex + 1);
    setResourcePlayLink();

    if (AppClientFactory.getCurrentPlaceToken().equalsIgnoreCase(PlaceTokens.COLLECTION_PLAY)) {
      setAvgRatingWidget();
      AppClientFactory.getEventBus()
          .addHandler(UpdateRatingsInRealTimeEvent.TYPE, setRatingWidgetMetaData);
    }
  }
Exemplo n.º 28
0
 public void selectButton(Object obj) {
   for (int i = 0; i < panel.getWidgetCount(); i++) {
     Button b = (Button) panel.getWidget(i);
     if (b.getElement().getPropertyObject("object") == obj) b.addStyleName("Ribbon-selected");
     else b.removeStyleName("Ribbon-selected");
   }
 }
Exemplo n.º 29
0
 public SampleViewImpl() {
   initWidget(binder.createAndBindUi(this));
   panel.add(new SingleColorPickerTest());
   SingleInputPickerTest sp = new SingleInputPickerTest();
   panel.add(sp);
   panel.add(new SingleSelectPickerTest());
 }
Exemplo n.º 30
0
  protected Widget newTaxonomyLink(
      final TaxonomiesUiHandlers handlers, final TaxonomyDto taxonomy) {
    FlowPanel titlePanel = new FlowPanel();
    Label taxonomyTitle = new Label(taxonomy.getName());
    taxonomyTitle.addStyleName("inline-block");
    taxonomyTitle.setTitle(taxonomy.getName());
    taxonomyTitle.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            handlers.onTaxonomySelection(taxonomy);
          }
        });

    titlePanel.add(taxonomyTitle);
    IconAnchor edit = new IconAnchor();
    edit.setIcon(IconType.EDIT);
    edit.addStyleName("small-dual-indent");
    edit.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            handlers.onTaxonomyEdit(taxonomy);
          }
        });

    titlePanel.add(edit);

    Heading head = new Heading(4);
    head.addStyleName("inline-block small-right-indent");
    head.add(titlePanel);
    return head;
  }