private void insertTableRows(final Table type, final Integer r) {
    final int rows = r.intValue();

    if (Table.GRID.equals(type)) {
      final Grid grid = (Grid) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        grid.resizeRows(i + 1);
        for (int j = i; j > 0; j--) {
          grid.setWidget(j, 0, grid.getWidget(j - 1, 0));
        }
        grid.setWidget(0, 0, makeLabel(num));
      }

    } else if (Table.FLEX_TABLE.equals(type)) {
      final FlexTable flexTable = (FlexTable) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        flexTable.insertRow(0);
        flexTable.setWidget(0, 0, makeLabel(num));
      }

    } else if (Table.OBJECT_LIST_TABLE.equals(type)) {
      final ObjectListTable olt = (ObjectListTable) table;

      for (int i = 0; i < rows; i++) {
        final Number num = new Integer(i);
        olt.getObjects().add(0, num);
      }
    }
  }
  private void toggleSplit() {
    isSplit = !isSplit;
    if (isSplit) {
      splitPurchaseGrid = new SplitPurchaseGrid(billTypeManager);

      splitPurchaseGrid.setTotalCost(getCost());

      costField.setFieldLabel("Total Cost");

      fieldPanel.removeRow(3);
      fieldPanel.removeRow(3);

      matchingField.addDisplayableReportWidget(splitPurchaseGrid);
    } else {
      costField.setFieldLabel("Cost");

      fieldPanel.insertRow(3);

      fieldPanel.setText(2, 0, "Bill Type:");
      fieldPanel.setWidget(2, 1, billTypeComboBox);

      fieldPanel.insertRow(4);
      fieldPanel.setText(3, 0, "Note:");
      fieldPanel.setWidget(3, 1, noteField);

      matchingField.addDisplayableReportWidget(null);
    }
  }
예제 #3
0
 @Override
 protected void setup() {
   // Set up backwards.
   backwards = new PushButton();
   backwards.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           addMonths(-1);
         }
       });
   backwards.getUpFace().setHTML("&lsaquo;");
   backwards.setStyleName(BASE_NAME + "PreviousButton");
   forwards = new PushButton();
   forwards.getUpFace().setHTML("&rsaquo;");
   forwards.setStyleName(BASE_NAME + "NextButton");
   forwards.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           addMonths(+1);
         }
       });
   // Set up backwards year
   backwardsYear = new PushButton();
   backwardsYear.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           addMonths(-12);
         }
       });
   backwardsYear.getUpFace().setHTML("&laquo;");
   backwardsYear.setStyleName(BASE_NAME + "PreviousButton");
   forwardsYear = new PushButton();
   forwardsYear.getUpFace().setHTML("&raquo;");
   forwardsYear.setStyleName(BASE_NAME + "NextButton");
   forwardsYear.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           addMonths(+12);
         }
       });
   // Set up grid.
   grid = new Grid(1, 5);
   grid.setWidget(0, previousYearColumn, backwardsYear);
   grid.setWidget(0, previousMonthColumn, backwards);
   grid.setWidget(0, nextMonthColumn, forwards);
   grid.setWidget(0, nextYearColumn, forwardsYear);
   CellFormatter formatter = grid.getCellFormatter();
   formatter.setStyleName(0, monthColumn, BASE_NAME + "Month");
   formatter.setWidth(0, previousYearColumn, "1");
   formatter.setWidth(0, previousMonthColumn, "1");
   formatter.setWidth(0, monthColumn, "100%");
   formatter.setWidth(0, nextMonthColumn, "1");
   formatter.setWidth(0, nextYearColumn, "1");
   grid.setStyleName(BASE_NAME + "MonthSelector");
   initWidget(grid);
 }
예제 #4
0
파일: Term.java 프로젝트: scbd/vocbench
 public void initLayout() {
   Grid table = new Grid(1, 2);
   table.setWidget(0, 0, getWarningImage());
   table.setWidget(
       0, 1, getMessage(messages.conceptDeleteTermWarning(tObj.getLabel(), tObj.getLang())));
   addWidget(table);
 }
예제 #5
0
파일: Term.java 프로젝트: scbd/vocbench
    public void initLayout() {
      lang = new ListBox();
      lang =
          Convert.makeSelectedLanguageListBox(
              (ArrayList<String[]>) MainApp.getLanguage(), tObj.getLang());
      lang.setWidth("100%");
      lang.setEnabled(false);

      term = new TextBox();
      term.setText(tObj.getLabel());
      term.setWidth("100%");

      main = new CheckBox(constants.conceptPreferredTerm());
      if (tObj.isMainLabel()) {
        main.setValue(tObj.isMainLabel());
        // main.setEnabled(false);
      }

      Grid table = new Grid(2, 2);
      table.setWidget(0, 0, new HTML(constants.conceptTerm()));
      table.setWidget(1, 0, new HTML(constants.conceptLanguage()));
      table.setWidget(0, 1, term);
      table.setWidget(1, 1, lang);
      table.setWidth("100%");
      table.getColumnFormatter().setWidth(1, "80%");

      VerticalPanel vp = new VerticalPanel();
      vp.add(GridStyle.setTableConceptDetailStyleleft(table, "gslRow1", "gslCol1", "gslPanel1"));
      vp.add(main);
      vp.setSpacing(0);
      vp.setWidth("100%");
      vp.setCellHorizontalAlignment(main, HasHorizontalAlignment.ALIGN_RIGHT);

      addWidget(vp);
    }
예제 #6
0
  /** Initialize this example. */
  @ShowcaseSource
  @Override
  public Widget onInitialize() {
    // Use a Grid to layout the content
    Grid layout = new Grid(4, 2);
    layout.setCellSpacing(5);

    // Add a field to select the pattern
    patternList = new ListBox();
    patternList.setWidth("17em");
    String[] patterns = constants.cwNumberFormatPatterns();
    for (String pattern : patterns) {
      patternList.addItem(pattern);
    }
    patternList.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            updatePattern();
          }
        });
    layout.setHTML(0, 0, constants.cwNumberFormatPatternLabel());
    layout.setWidget(0, 1, patternList);

    // Add a field to display the pattern
    patternBox = new TextBox();
    patternBox.setWidth("17em");
    patternBox.addKeyUpHandler(
        new KeyUpHandler() {
          public void onKeyUp(KeyUpEvent event) {
            updatePattern();
          }
        });
    layout.setWidget(1, 1, patternBox);

    // Add a field to set the value
    valueBox = new TextBox();
    valueBox.setWidth("17em");
    valueBox.setText("31415926535.897932");
    valueBox.addKeyUpHandler(
        new KeyUpHandler() {
          public void onKeyUp(KeyUpEvent event) {
            updateFormattedValue();
          }
        });
    layout.setHTML(2, 0, constants.cwNumberFormatValueLabel());
    layout.setWidget(2, 1, valueBox);

    // Add a field to display the formatted value
    formattedBox = new Label();
    formattedBox.setWidth("17em");
    layout.setHTML(3, 0, constants.cwNumberFormatFormattedLabel());
    layout.setWidget(3, 1, formattedBox);

    // Return the layout Widget
    updatePattern();
    return layout;
  }
예제 #7
0
  public ProgressBar() {

    Grid grid = new Grid(1, 10);
    initWidget(grid);
    grid.setSize("200px", "18px");

    Image image = new Image("images/greenbox.jpg");
    image.setVisible(false);
    grid.setWidget(0, 0, image);
    image.setSize("15px", "15px");

    Image image_1 = new Image("images/greenbox.jpg");
    image_1.setVisible(false);
    grid.setWidget(0, 1, image_1);
    image_1.setSize("15px", "15px");

    Image image_2 = new Image("images/greenbox.jpg");
    image_2.setVisible(false);
    grid.setWidget(0, 2, image_2);
    image_2.setSize("15px", "15px");

    Image image_3 = new Image("images/greenbox.jpg");
    image_3.setVisible(false);
    grid.setWidget(0, 3, image_3);
    image_3.setSize("15px", "15px");

    Image image_4 = new Image("images/greenbox.jpg");
    image_4.setVisible(false);
    grid.setWidget(0, 4, image_4);
    image_4.setSize("15px", "15px");

    Image image_5 = new Image("images/greenbox.jpg");
    image_5.setVisible(false);
    grid.setWidget(0, 5, image_5);
    image_5.setSize("15px", "15px");

    Image image_6 = new Image("images/greenbox.jpg");
    image_6.setVisible(false);
    grid.setWidget(0, 6, image_6);
    image_6.setSize("15px", "15px");

    Image image_7 = new Image("images/greenbox.jpg");
    image_7.setVisible(false);
    grid.setWidget(0, 7, image_7);
    image_7.setSize("15px", "15px");

    Image image_8 = new Image("images/greenbox.jpg");
    image_8.setVisible(false);
    grid.setWidget(0, 8, image_8);
    image_8.setSize("15px", "15px");

    Image image_9 = new Image("images/greenbox.jpg");
    image_9.setVisible(false);
    grid.setWidget(0, 9, image_9);
    image_9.setSize("15px", "15px");
  }
예제 #8
0
  private void refreshTable(boolean needToSort) {
    if (needToSort) {
      // Sort the projects.
      Comparator<Project> comparator;
      switch (sortField) {
        default:
        case NAME:
          comparator =
              (sortOrder == SortOrder.ASCENDING)
                  ? ProjectComparators.COMPARE_BY_NAME_ASCENDING
                  : ProjectComparators.COMPARE_BY_NAME_DESCENDING;
          break;
        case DATE_CREATED:
          comparator =
              (sortOrder == SortOrder.ASCENDING)
                  ? ProjectComparators.COMPARE_BY_DATE_CREATED_ASCENDING
                  : ProjectComparators.COMPARE_BY_DATE_CREATED_DESCENDING;
          break;
        case DATE_MODIFIED:
          comparator =
              (sortOrder == SortOrder.ASCENDING)
                  ? ProjectComparators.COMPARE_BY_DATE_MODIFIED_ASCENDING
                  : ProjectComparators.COMPARE_BY_DATE_MODIFIED_DESCENDING;
          break;
      }
      Collections.sort(projects, comparator);
    }

    refreshSortIndicators();

    // Refill the table.
    table.resize(1 + projects.size(), 5);
    int row = 1;
    for (Project project : projects) {
      ProjectWidgets pw = projectWidgets.get(project);
      if (selectedProjects.contains(project)) {
        table.getRowFormatter().setStyleName(row, "ode-ProjectRowHighlighted");
        pw.checkBox.setValue(true);
      } else {
        table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted");
        pw.checkBox.setValue(false);
      }
      table.setWidget(row, 0, pw.checkBox);
      table.setWidget(row, 1, pw.nameLabel);
      table.setWidget(row, 2, pw.dateCreatedLabel);
      table.setWidget(row, 3, pw.dateModifiedLabel);
      table.setWidget(row, 4, pw.editButton);
      preparePublishApp(project, pw);
      row++;
    }

    Ode.getInstance().getProjectToolbar().updateButtons();
  }
예제 #9
0
 private void row(Grid grid, int row, String name, Widget field) {
   final CellFormatter fmt = grid.getCellFormatter();
   if (LocaleInfo.getCurrentLocale().isRTL()) {
     grid.setText(row, 1, name);
     grid.setWidget(row, 0, field);
     fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().header());
   } else {
     grid.setText(row, 0, name);
     grid.setWidget(row, 1, field);
     fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().header());
   }
 }
예제 #10
0
 private void addDatePanel() {
   Grid datePanel = new Grid(2, 2);
   datePanel.setText(0, 0, "Departure Date:");
   DateBox departureBox = new DateBox();
   Date departureDate = new Date();
   departureBox.setValue(departureDate);
   datePanel.setWidget(0, 1, departureBox);
   datePanel.setText(1, 0, "Return Date:");
   DateBox returnBox = new DateBox();
   Date returnDate = DateUtils.datePlusWeek(departureDate);
   returnBox.setValue(returnDate);
   datePanel.setWidget(1, 1, returnBox);
   RootPanel.get("date-panel").add(datePanel);
 }
예제 #11
0
  /** Adds the header row to the table. */
  private void setHeaderRow() {
    table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow");

    HorizontalPanel nameHeader = new HorizontalPanel();
    final Label nameHeaderLabel = new Label(MESSAGES.projectNameHeader());
    nameHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
    nameHeader.add(nameHeaderLabel);
    nameSortIndicator.addStyleName("ode-ProjectHeaderLabel");
    nameHeader.add(nameSortIndicator);
    table.setWidget(0, 1, nameHeader);

    HorizontalPanel dateCreatedHeader = new HorizontalPanel();
    final Label dateCreatedHeaderLabel = new Label(MESSAGES.projectDateCreatedHeader());
    dateCreatedHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
    dateCreatedHeader.add(dateCreatedHeaderLabel);
    dateCreatedSortIndicator.addStyleName("ode-ProjectHeaderLabel");
    dateCreatedHeader.add(dateCreatedSortIndicator);
    table.setWidget(0, 2, dateCreatedHeader);

    HorizontalPanel dateModifiedHeader = new HorizontalPanel();
    final Label dateModifiedHeaderLabel = new Label(MESSAGES.projectDateModifiedHeader());
    dateModifiedHeaderLabel.addStyleName("ode-ProjectHeaderLabel");
    dateModifiedHeader.add(dateModifiedHeaderLabel);
    dateModifiedSortIndicator.addStyleName("ode-ProjectHeaderLabel");
    dateModifiedHeader.add(dateModifiedSortIndicator);
    table.setWidget(0, 3, dateModifiedHeader);

    MouseDownHandler mouseDownHandler =
        new MouseDownHandler() {
          @Override
          public void onMouseDown(MouseDownEvent e) {
            SortField clickedSortField;
            if (e.getSource() == nameHeaderLabel || e.getSource() == nameSortIndicator) {
              clickedSortField = SortField.NAME;
            } else if (e.getSource() == dateCreatedHeaderLabel
                || e.getSource() == dateCreatedSortIndicator) {
              clickedSortField = SortField.DATE_CREATED;
            } else {
              clickedSortField = SortField.DATE_MODIFIED;
            }
            changeSortOrder(clickedSortField);
          }
        };
    nameHeaderLabel.addMouseDownHandler(mouseDownHandler);
    nameSortIndicator.addMouseDownHandler(mouseDownHandler);
    dateCreatedHeaderLabel.addMouseDownHandler(mouseDownHandler);
    dateCreatedSortIndicator.addMouseDownHandler(mouseDownHandler);
    dateModifiedHeaderLabel.addMouseDownHandler(mouseDownHandler);
    dateModifiedSortIndicator.addMouseDownHandler(mouseDownHandler);
  }
예제 #12
0
  /**
   * Base constructor for this widget
   *
   * @param elements The number of elements (bars) to show on the progress bar
   * @param options The display options for the progress bar
   */
  public ProgressBar(int elements, int options) {
    // Read the options and set convenience variables
    if ((options & SHOW_TIME_REMAINING) == SHOW_TIME_REMAINING) showRemaining = true;
    if ((options & SHOW_TEXT) == SHOW_TEXT) showText = true;

    // Set element count
    this.elements = elements;

    // Styling
    remainLabel.setStyleName("progressbar-remaining");
    textLabel.setStyleName("progressbar-text");

    // Initialize the progress elements
    elementGrid = new Grid(1, elements);
    elementGrid.setStyleName("progressbar-inner");
    elementGrid.setCellPadding(0);
    elementGrid.setCellSpacing(0);

    for (int loop = 0; loop < elements; loop++) {
      Grid elm = new Grid(1, 1);
      // elm.setHTML(0, 0, "&nbsp;");
      elm.setHTML(0, 0, "");
      elm.setStyleName("progressbar-blankbar");
      elm.addStyleName("progressbar-bar");
      elementGrid.setWidget(0, loop, elm);
    }

    // Create the container around the elements
    Grid containerGrid = new Grid(1, 1);
    containerGrid.setCellPadding(0);
    containerGrid.setCellSpacing(0);
    containerGrid.setWidget(0, 0, elementGrid);
    containerGrid.setStyleName("progressbar-outer");
    // containerGrid.setBorderWidth(1);

    // Set up the surrounding flex table based on the options
    int row = 0;
    if (showText) barFrame.setWidget(row++, 0, textLabel);
    barFrame.setWidget(row++, 0, containerGrid);
    if (showRemaining) barFrame.setWidget(row++, 0, remainLabel);

    barFrame.setWidth("100%");

    // Add the frame to the panel
    this.add(barFrame);

    // Initialize progress bar
    setProgress(0);
  }
  public IndicatorWidget(ProjectMediator med) {
    this.med = med;

    name_lbl = new Label();
    author_lbl = new Label();
    description_lbl = new Label();
    version_lbl = new Label();
    activated_btn = new Button();
    setActivated(false);
    activated_btn.addClickHandler(this);

    labelPanel.setStyleName("indicatorInfoPanel");
    labelPanel.add(name_lbl);
    labelPanel.add(author_lbl);
    labelPanel.add(version_lbl);
    labelPanel.add(description_lbl);
    labelPanel.add(activated_btn);

    name_lbl.addStyleName("indicatorInfoTitle");
    author_lbl.addStyleName("indicatorInfoStage");
    version_lbl.addStyleName("indicatorInfoStage");
    description_lbl.addStyleName("indicatorInfoDescription");

    mainPanel.setWidget(0, 0, labelPanel);
    initWidget(mainPanel);
  }
예제 #14
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;
  }
    public InnerItem(Serializable s) {
      close.addStyleDependentName("SMALLER");
      close.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              inner.hide();
            }
          });
      innerLayout.add(close);
      grid.getCellFormatter().setWidth(0, 0, "85%");
      grid.getCellFormatter().setWidth(0, 1, "5%");
      label.setText(s.getName());
      grid.setWidget(0, 0, label);
      if (s instanceof CategorySerializable) {
        CategorySerializable c = (CategorySerializable) s;
        if (c.getDoc() != null || c.getAttributes().get("children_dsid") != null) {
          image.addClickHandler(
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  inner.setPopupPosition(image.getAbsoluteLeft(), image.getAbsoluteTop());
                  inner.show();
                }
              });
          grid.setWidget(0, 1, image);
          if (c.getDoc() != null) {
            String url = c.getDoc();
            if (!c.getDoc().equals("")) {
              Anchor link = new Anchor("Documentation", url, "_blank");
              innerLayout.add(link);
            }
          }
          if (c.getAttributes().get("children_dsid") != null) {
            Anchor meta =
                new Anchor(
                    "Variable and Grid Description",
                    "getMetadata.do?dsid=" + c.getAttributes().get("children_dsid"),
                    "_blank");
            innerLayout.add(meta);
          }
          inner.add(innerLayout);
        }
      }
      initWidget(grid);
    }
예제 #16
0
  private void createTransTable(DealLog[] logs) {
    transGrid = new Grid(logs.length + 1, TRANS_HISTORY_HEADERS.length);

    Util.createGridHeader(transGrid, TRANS_HISTORY_HEADERS, "tableList2");

    NumberFormat fmt = NumberFormat.getFormat("#,##0.00");
    for (int row = 1; row <= logs.length; row++) {
      final DealLog deal = logs[row - 1];
      transGrid.setWidget(row, 0, new Label(deal.getCode()));
      transGrid.getCellFormatter().addStyleName(row, 0, "textCell");
      transGrid.setWidget(row, 1, new Label(deal.getName()));
      transGrid.getCellFormatter().addStyleName(row, 1, "textCell");
      transGrid.setWidget(row, 2, new Label(deal.getBs()));
      transGrid.getCellFormatter().addStyleName(row, 2, "textCell");
      if ("买入".equals(deal.getBs())) {
        transGrid.getCellFormatter().removeStyleName(row, 2, "negativeChange");
        transGrid.getCellFormatter().addStyleName(row, 2, "positiveChange");
      } else {
        transGrid.getCellFormatter().removeStyleName(row, 2, "positiveChange");
        transGrid.getCellFormatter().addStyleName(row, 2, "negativeChange");
      }
      transGrid.setWidget(row, 3, new Label(fmt.format(deal.getPrice())));
      transGrid.getCellFormatter().addStyleName(row, 3, "numericCell");
      transGrid.setWidget(row, 4, new Label(fmt.format(deal.getAmount())));
      transGrid.getCellFormatter().addStyleName(row, 4, "numericCell");
      transGrid.setWidget(row, 5, new Label(fmt.format(deal.getCommission())));
      transGrid.getCellFormatter().addStyleName(row, 5, "numericCell");
      transGrid.setWidget(row, 6, new Label(deal.getCreated()));
      transGrid.getCellFormatter().addStyleName(row, 6, "textCell");
    }
  }
예제 #17
0
  @Override
  public void setPropertyList(Map<String, Object> propertyList) {
    noRec.clear();
    map(propertyList);

    Grid grid = new Grid(noRec.keySet().size(), 2);
    grid.setWidth("100%");
    grid.setStyleName("propertyGrid");

    int i = 0;
    for (String k : noRec.keySet()) {
      if (k.equals("_id")) {
        if (noRec.get(k).substring(0, 1).equals("n")) {
          grid.setWidget(i, 0, new Label("source"));
          grid.setWidget(
              i,
              1,
              new HTML(
                  "<a target=\"_blank\" href=\"http://www.openstreetmap.org/browse/node/"
                      + noRec.get(k).substring(1, noRec.get(k).length())
                      + "\">OSM CC-By-SA</a>"));
        } else if (noRec.get(k).substring(0, 1).equals("w")) {
          grid.setWidget(i, 0, new Label("source"));
          grid.setWidget(
              i,
              1,
              new HTML(
                  "<a target=\"_blank\" href=\"http://www.openstreetmap.org/browse/way/"
                      + noRec.get(k).substring(1, noRec.get(k).length())
                      + "\">OSM CC-By-SA</a>"));
        } else if (noRec.get(k).substring(0, 1).equals("r")) {
          grid.setWidget(i, 0, new Label("source"));
          grid.setWidget(
              i,
              1,
              new HTML(
                  "<a target=\"_blank\" href=\"http://www.openstreetmap.org/browse/relation/"
                      + noRec.get(k).substring(1, noRec.get(k).length())
                      + "\">OSM CC-By-SA</a>"));
        }
      } else {
        grid.setWidget(i, 0, new Label(k));
        grid.setWidget(i, 1, new Label(noRec.get(k)));
      }

      grid.getCellFormatter().setStyleName(i, 0, "namecell");
      grid.getCellFormatter().setStyleName(i, 1, "valuecell");

      i++;
    }

    _siPa.setWidget(grid);
  }
예제 #18
0
  public Geocoder2Demo() {
    Panel panel = new FlowPanel();
    final FormPanel form = new FormPanel();
    form.setAction("#");
    Panel formElements = new FlowPanel();
    Label label = new Label("Search for an address:");
    formElements.add(label);
    final TextBox addressBox = new TextBox();
    addressBox.setVisibleLength(40);
    formElements.add(addressBox);
    Button submit = new Button("Search");
    submit.addClickListener(
        new ClickListener() {
          public void onClick(Widget sender) {
            form.submit();
          }
        });
    formElements.add(submit);
    form.add(formElements);
    form.addFormHandler(
        new FormHandler() {
          public void onSubmit(FormSubmitEvent event) {
            showAddress(addressBox.getText());
            event.setCancelled(true);
          }

          public void onSubmitComplete(FormSubmitCompleteEvent event) {}
        });
    panel.add(form);

    map = new MapWidget(LatLng.newInstance(34, 0), 1);
    map.setSize("100%", "480px");
    panel.add(map);

    Grid grid = new Grid((sampleAddresses.length / NUM_ADDRESS_COLUMNS) + 1, NUM_ADDRESS_COLUMNS);

    for (int i = 0; i < sampleAddresses.length; i++) {
      final String address = sampleAddresses[i];
      Button link = new Button(address);
      // Hyperlink link = new Hyperlink(address, true,
      // "Extracting Structured Address Information");
      link.addClickListener(
          new ClickListener() {
            public void onClick(Widget sender) {
              addressBox.setText(address);
              form.submit();
            }
          });
      grid.setWidget(i / NUM_ADDRESS_COLUMNS, i % NUM_ADDRESS_COLUMNS, link);
    }
    panel.add(grid);

    initWidget(panel);
    geocoder = new Geocoder();
  }
    @Override
    protected Widget initialize(final MapWidget map) {
      ControlImageBundle imgBundle = GWT.create(ControlImageBundle.class);
      Image centerImage = imgBundle.center().createImage();
      Image zoomInImage = imgBundle.plus().createImage();
      Image zoomOutImage = imgBundle.minus().createImage();

      centerImage.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              if (GameInfo.getInstance().getPlayer() != null) {
                //
                //	map.setCenter(MapUtil.toLatLng(GameInformation.getInstance().getPlayer().getCurrentLocation().getMapPosition()));
                map.setCenter(
                    LatLng.newInstance(
                        GameInfo.getInstance().getPlayer().getCurrentLocation().getLatitude(),
                        GameInfo.getInstance().getPlayer().getCurrentLocation().getLongitude()));
                //		        		map.setZoomLevel(9);
              }
            }
          });
      zoomInImage.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              map.zoomIn();
            }
          });
      zoomOutImage.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              map.zoomOut();
            }
          });

      Grid container = new Grid(4, 1);
      container.setWidget(0, 0, centerImage);
      container.setWidget(2, 0, zoomInImage);
      container.setWidget(3, 0, zoomOutImage);

      return container;
    }
예제 #20
0
  @Override
  public Grid getWidget() {
    if (table != null) {
      return table;
    }
    table = new Grid(1, 2);

    table.setText(0, 0, "Phone number");
    table.setWidget(0, 1, number);

    return table;
  }
예제 #21
0
  public UserDisplayView() {

    id = new Label();
    lastName = new Label();
    firstName = new Label();

    Grid grid = new Grid(3, 2);
    grid.setText(0, 0, "Last Name: ");
    grid.setText(1, 0, "First Name: ");
    grid.setText(2, 0, "Generated Id: ");
    grid.setWidget(0, 1, lastName);
    grid.setWidget(1, 1, firstName);
    grid.setWidget(2, 1, id);

    create = new Button("New");

    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.add(grid);
    mainPanel.add(create);

    initWidget(mainPanel);
  }
예제 #22
0
파일: Term.java 프로젝트: scbd/vocbench
    private Widget getRelationshipTermTable(TermRelationshipObject trObj) {

      HashMap<ClassObject, HashMap<TermObject, Boolean>> resultList = trObj.getResult();
      Iterator<ClassObject> it = resultList.keySet().iterator();
      Grid table = new Grid(resultList.size() + 1, 2);
      table.setWidget(0, 0, new HTML(constants.termRelationship()));
      table.setWidget(0, 1, new HTML(constants.termTerm()));
      int i = 1;
      while (it.hasNext()) {
        ClassObject rObj = (ClassObject) it.next();
        HashMap<TermObject, Boolean> termList = (HashMap<TermObject, Boolean>) resultList.get(rObj);
        // table.setWidget(i, 0, new HTML(Convert.getRelationshipLabel(rObj)));
        // table.setWidget(i, 1, getDestinationTerm(rObj, new
        // ArrayList<TermObject>(termList.keySet())));
        table.setWidget(i, 0, new HTML(rObj.getLabel()));
        table.setWidget(i, 1, getDestinationTerm(new ArrayList<TermObject>(termList.keySet())));
        i++;
      }

      table.setWidth("100%");
      return GridStyle.setTableConceptDetailStyleTop(
          table, "gstFR1", "gstFC1", "gstR1", "gstPanel1", true);
    }
예제 #23
0
  public void addTag(final String tagInstanceID) {

    ClientTagInstance tagInstance = vTagger.getTagInstance(tagInstanceID);

    Grid grid = new Grid(1, 3);
    Label l = new HTML("#" + tagInstanceID);
    grid.setWidget(0, 0, l);

    PushButton tagRemoveButton = new PushButton("remove");
    // tagRemoveButton.addStyleName("tagger-pushButton");
    grid.setWidget(0, 1, tagRemoveButton);
    HandlerRegistration tagRemoveBtReg =
        tagRemoveButton.addClickHandler(
            new ClickHandler() {

              public void onClick(ClickEvent event) {
                vTagger.removeTagInstance(tagInstanceID);
                hide();
              }
            });
    handlerRegistrations.add(tagRemoveBtReg);

    PushButton tagEditButton = new PushButton("edit");
    // tagEditButton.addStyleName("tagger-pushButton");
    tagEditButton.setEnabled(false);
    grid.setWidget(0, 2, tagEditButton);
    HandlerRegistration tagEditBtReg =
        tagEditButton.addClickHandler(
            new ClickHandler() {

              public void onClick(ClickEvent event) {}
            });
    handlerRegistrations.add(tagEditBtReg);
    root.addItem(grid);
    root.setState(true);
  }
예제 #24
0
파일: Term.java 프로젝트: scbd/vocbench
 private Grid getDestinationTerm(ArrayList<TermObject> result) {
   Grid table = new Grid(result.size(), 1);
   for (int i = 0; i < result.size(); i++) {
     TermObject tObj = (TermObject) result.get(i);
     table.setWidget(
         i,
         0,
         new HTML(
             getTermColorByStatus(
                 tObj.getLabel() + "&nbsp;(" + tObj.getLang().toLowerCase() + ")",
                 tObj.getStatus(),
                 tObj.isMainLabel())));
   }
   table.setWidth("100%");
   return table;
 }
예제 #25
0
  private Grid buildDoubleList(WorkingSetConfigData wsData) {
    Grid grid = new Grid(2, 3);

    availableFacts.setVisibleItemCount(10);
    selectedFacts.setVisibleItemCount(10);

    Grid btnsPanel = new Grid(2, 1);

    btnsPanel.setWidget(
        0,
        0,
        new Button(
            ">",
            new ClickHandler() {
              public void onClick(ClickEvent sender) {
                moveSelected(availableFacts, selectedFacts);
              }
            }));

    btnsPanel.setWidget(
        1,
        0,
        new Button(
            "&lt;",
            new ClickHandler() {
              public void onClick(ClickEvent sender) {
                moveSelected(selectedFacts, availableFacts);
              }
            }));

    grid.setWidget(0, 0, new SmallLabel("Available")); // TODO i18n
    grid.setWidget(0, 1, new SmallLabel(""));
    grid.setWidget(0, 2, new SmallLabel("Selected")); // TODO i18n
    grid.setWidget(1, 0, availableFacts);
    grid.setWidget(1, 1, btnsPanel);
    grid.setWidget(1, 2, selectedFacts);

    grid.getColumnFormatter().setWidth(0, "45%");
    grid.getColumnFormatter().setWidth(0, "10%");
    grid.getColumnFormatter().setWidth(0, "45%");
    return grid;
  }
예제 #26
0
  @Override
  public void setValueAndCreateNewEditors(TransUnit transUnit) {
    cachedValue = transUnit;

    editors.clear();
    List<String> cachedTargets = cachedValue.getTargets();
    if (cachedTargets == null) {
      cachedTargets = Lists.newArrayList("");
    }
    editorGrid.resize(cachedTargets.size(), COLUMNS);
    int rowIndex = 0;
    for (String target : cachedTargets) {
      Editor editor = new Editor(target, rowIndex, listener, transUnit.getId());
      editor.setEnableSpellCheck(listener.getConfigState().isSpellCheckEnabled());
      editorGrid.setWidget(rowIndex, 0, editor);
      editors.add(editor);
      rowIndex++;
    }
    editorGrid.setStyleName(resolveStyleName(cachedValue.getStatus()));
    editingState = EditingState.SAVED;
  }
예제 #27
0
  @Override
  protected Widget createContents(int start, int count, List<T> list) {
    int limit = list.size();
    int cells = padToFullPage() ? Math.max(count, limit) : limit;
    Grid grid = new Grid((int) Math.ceil(cells / (float) _cols), Math.min(_cols, cells));
    grid.setStyleName("Grid");
    grid.setCellPadding(0);
    grid.setCellSpacing(0);
    grid.setWidth("100%");

    for (int ii = 0; ii < limit; ii++) {
      int row = (ii / _cols), col = (ii % _cols);
      T item = ii >= list.size() ? null : list.get(ii);
      Widget widget = createWidget(item);
      if (widget != null) {
        grid.setWidget(row, col, widget);
      }
      formatCell(grid.getCellFormatter(), row, col, limit);
      formatCell(grid.getCellFormatter(), row, col, item);
    }

    return grid;
  }
  @Override
  public void buildTable(
      List<? extends NeedsRefresh> sourceDisplays, List<? extends NeedsRefresh> targetDisplays) {
    showEmptyContentIfNoData(sourceDisplays.size());

    transUnitTable.resizeRows(sourceDisplays.size());
    HTMLTable.CellFormatter cellFormatter = transUnitTable.getCellFormatter();

    for (int i = 0; i < sourceDisplays.size(); i++) {
      NeedsRefresh sourceDisplay = sourceDisplays.get(i);
      NeedsRefresh targetDisplay = targetDisplays.get(i);

      transUnitTable.setWidget(i, 0, sourceDisplay);
      transUnitTable.setWidget(i, 1, targetDisplay);

      cellFormatter.setVerticalAlignment(i, 0, HasVerticalAlignment.ALIGN_TOP);
      cellFormatter.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_TOP);
      cellFormatter.addStyleName(i, 0, "transUnitCol");
      cellFormatter.addStyleName(i, 1, "transUnitCol");

      sourceDisplay.refresh();
      targetDisplay.refresh();
    }
  }
  public WorkitemDefinitionEditor(RuleAsset a, int visibleLines) {
    asset = a;
    data = (RuleContentText) asset.getContent();
    if (data.content == null) {
      data.content = "Empty!";
    }

    Grid layout = new Grid(1, 2);

    WorkitemDefinitionElementsBrowser browser =
        new WorkitemDefinitionElementsBrowser(
            new WorkitemDefinitionElementSelectedListener() {

              public void onElementSelected(String elementName, String pasteValue) {
                insertText(pasteValue, true);
              }
            });

    layout.setWidget(0, 0, browser);
    text = new TextArea();
    text.setWidth("100%");
    text.setVisibleLines((visibleLines == -1) ? 25 : visibleLines);
    text.setText(data.content);
    text.getElement().setAttribute("spellcheck", "false"); // NON-NLS

    text.setStyleName("default-text-Area"); // NON-NLS

    text.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            data.content = text.getText();
            makeDirty();
          }
        });

    text.addKeyDownHandler(
        new KeyDownHandler() {

          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_TAB) {
              event.preventDefault();
              event.stopPropagation();
              int pos = text.getCursorPos();
              insertText("\t", false);
              text.setCursorPos(pos + 1);
              text.cancelKey();
              text.setFocus(true);
            }
          }
        });

    layout.setWidget(0, 1, text);

    layout.getColumnFormatter().setWidth(0, "10%");
    layout.getColumnFormatter().setWidth(1, "90%");
    layout
        .getCellFormatter()
        .setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
    layout
        .getCellFormatter()
        .setAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);
    layout.setWidth("95%");

    initWidget(layout);
  }
예제 #30
0
  /**
   * This constructor uses the SearchHandler of the new SearchPageUnified. This will be the default
   * constructor after development of the new feature is finished.
   *
   * @param isUnified
   */
  public ResultsView(boolean isUnified) {
    super();
    this.setStylePrimaryName(STYLE.resultsView());
    contentPanel = getContentPanel();
    bookViewMap = new HashMap<Book, ResultsBookView>();
    unPickables = new HashSet<Book>();

    com.bookspicker.client.view.SearchPageUnified.SearchHandler searchHandler =
        new com.bookspicker.client.view.SearchPageUnified.SearchHandler();

    searchTextBox = new SuggestionTextBox(classSuggestionString);
    searchTextBox.setVisibleLength(40);

    autoCompleteBox = new BpSuggestBox(BpOracle.getInstance(), searchTextBox);
    autoCompleteBox.addSelectionHandler(
        new SelectionHandler<Suggestion>() {

          @Override
          public void onSelection(SelectionEvent<Suggestion> event) {
            if (event.getSelectedItem() instanceof BpOracleSuggestion) {
              BpOracleSuggestion bpSuggestion = (BpOracleSuggestion) event.getSelectedItem();
              autoCompleteBox.setSavedQuery(bpSuggestion.getQueryString());
            }
          }
        });

    autoCompleteBox.addValueChangeHandler(
        new ValueChangeHandler<String>() {

          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            autoCompleteBox.cleanSavedQuery();
          }
        });

    searchTextBox.reset();
    autoCompleteBox.setLimit(8);
    autoCompleteBox.setWidth("25em");
    autoCompleteBox.setAutoSelectEnabled(true);

    if (SearchPage.AUTO_COMPLETE) {
      searchTextBox.addKeyPressHandler(searchHandler);
      searchTextBox.addKeyDownHandler(searchHandler);
      autoCompleteBox.addSelectionHandler(searchHandler);
      searchBox.setWidget(0, 0, autoCompleteBox);
    } else {
      searchTextBox.addKeyPressHandler(searchHandler);
      searchBox.setWidget(0, 0, searchTextBox);
    }
    searchBox.setStylePrimaryName(STYLE.searchBox());

    InlineLabel searchButton = new InlineLabel("Search");
    searchButton.setStylePrimaryName(STYLE.bpYellowButton());
    searchButton.addStyleName(STYLE.searchButton());
    searchButton.addStyleDependentName(STYLE.bpYellowButton());
    searchButton.addClickHandler(searchHandler);
    searchBox.setWidget(0, 1, searchButton);

    loadingIcon = new Image(Resources.INSTANCE.loadingIconSmall());
    loadingIcon.setStylePrimaryName(STYLE.loadingIcon());
    loadingIcon.addStyleName(STYLE.loadingIconHidden());
    searchBox.setWidget(0, 2, loadingIcon);

    SimplePanel searchWrapper = new SimplePanel();
    searchWrapper.setStylePrimaryName(STYLE.searchBoxWrapper());
    searchWrapper.setWidget(searchBox);
    contentPanel.add(searchWrapper);

    results.setStylePrimaryName(STYLE.resultsList());

    contentPanel.add(results);
  }