Ejemplo n.º 1
0
 @Override
 protected void onUpdate() {
   cardSlotsWrapper.setWidget(createCardSlots());
   handCardsWrapper.setWidget(createHandCards());
   actionsWrapper.setWidget(createActions());
   super.onUpdate();
 }
  @Override
  protected Widget newPositioner(DragContext context) {
    // Use two widgets so that setPixelSize() consistently affects dimensions
    // excluding positioner border in quirks and strict modes
    SimplePanel outer = new SimplePanel();
    outer.addStyleName(DragClientBundle.INSTANCE.css().positioner());

    // place off screen for border calculation
    RootPanel.get().add(outer, -500, -500);

    // Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
    // DOMUtil.getVerticalBorders(outer)
    outer.setWidget(DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT);

    int width = 0;
    int height = 0;
    for (Widget widget : context.selectedWidgets) {
      width = Math.max(width, widget.getOffsetWidth());
      height += widget.getOffsetHeight();
    }

    SimplePanel inner = new SimplePanel();
    inner.setPixelSize(
        width - DOMUtil.getHorizontalBorders(outer), height - DOMUtil.getVerticalBorders(outer));

    outer.setWidget(inner);

    return outer;
  }
 /**
  * Set the widget state to loading or not loading.
  *
  * @param loading is the chart loading?
  */
 public void setLoading(boolean loading) {
   if (loading) {
     mainPanel.setWidget(loadingImage);
   } else {
     mainPanel.setWidget(doneImage);
   }
 }
 public void setPresenter(Presenter presenter) {
   if (presenter.isEditing()) {
     editView.setPresenter(presenter);
     contentContainer.setWidget(editView);
   } else {
     displayView.setPresenter(presenter);
     contentContainer.setWidget(displayView);
   }
 }
Ejemplo n.º 5
0
 @Override
 public void addToSlot(Object slot, Widget content) {
   if (content != null) {
     if (slot == EditFolderUiHandlers.TYPE_FOLDER_CONTENT_TAB) {
       collectionMetaDataSimPanel.setWidget(content);
     } else if (slot == EditFolderUiHandlers.TYPE_FOLDER_INFO_TAB) {
       collectionMetaDataSimPanel.setWidget(content);
     }
   }
 }
Ejemplo n.º 6
0
 @Override
 protected void onUpdate() {
   if (editor == null && editorWrapper.getWidget() != activateCommentLink) {
     editorWrapper.setWidget(activateCommentLink);
   } else if (editor != null && editorWrapper.getWidget() != editor) {
     editorWrapper.setWidget(editor);
   }
   updateCommentList();
   super.onUpdate();
 }
Ejemplo n.º 7
0
 void onPersonSaved(@Observes PersonOperation po) {
   System.out.println("Person Saved  	" + po.toString());
   if (PersonOperationType.CREATE_SUCCESS.equals(po.getPersonOperationType())) {
     List<Person> persons = new ArrayList<Person>();
     persons.add(po.getSavedPerson());
     // personList.initPersonTable(persons);
     body.setWidget(personList);
   } else {
     body.setWidget(savePerson);
   }
 }
Ejemplo n.º 8
0
 @Override
 protected void onUpdate() {
   TableBuilder tb = new TableBuilder();
   tb.setWidth(null);
   tb.setCellSpacing(5);
   for (Map.Entry<String, Integer> entry : dao.getEntityCounts().entrySet()) {
     tb.addRow(Gwt.createFieldLabel(entry.getKey()), new Label(String.valueOf(entry.getValue())));
   }
   entityCountWrapper.setWidget(tb.createTable());
   stateInformationWrapper.setWidget(createStateInformation());
   super.onUpdate();
 }
Ejemplo n.º 9
0
  public PlayerWidget(String url) {
    SimplePanel panel = new SimplePanel(); // create panel to hold the player

    player = null;
    try {
      // create the player, specifing URL of media
      player = new WinMediaPlayer(url, true, "450px", "550px");
      player.showLogger(true);
      panel.setWidget(player); // add player to panel.
    } catch (LoadException e) {
      try {
        player = new QuickTimePlayer(url, true, "450px", "550px");
        panel.setWidget(player); // add player to panel.
        // catch loading exception and alert user
        Window.alert("An error occured while loading");
      } catch (LoadException ep) {
        try {
          player = new FlashMP3Player(url, true, "450px", "550px");
          panel.setWidget(player); // add player to panel.
          // catch loading exception and alert user
          Window.alert("An error occured while loading");
        } catch (LoadException exp) {
          // catch loading exception and alert user
          Window.alert("An error occured while loading");
        } catch (PluginVersionException exp) {
          // required plugin version is not available, alert user possibly providing a link
          // to the plugin download page.
          panel.setWidget(
              new HTML(".. some nice message telling the user to download plugin first .."));
        } catch (PluginNotFoundException exp) {
          // catch PluginNotFoundException and tell user to download plugin, possibly providing
          // a link to the plugin download page.
          panel.setWidget(
              new HTML(".. another nice message telling the user to download plugin.."));
        }
      } catch (PluginVersionException ep) {
        // required plugin version is not available, alert user possibly providing a link
        // to the plugin download page.
        panel.setWidget(
            new HTML(".. some nice message telling the user to download plugin first .."));
      } catch (PluginNotFoundException ep) {
        // catch PluginNotFoundException and tell user to download plugin, possibly providing
        // a link to the plugin download page.
        panel.setWidget(new HTML(".. another nice message telling the user to download plugin.."));
      }

    } catch (PluginVersionException e) {
      // required plugin version is not available, alert user possibly providing a link
      // to the plugin download page.
      panel.setWidget(
          new HTML(".. some nice message telling the user to download plugin first .."));
    } catch (PluginNotFoundException e) {
      // catch PluginNotFoundException and tell user to download plugin, possibly providing
      // a link to the plugin download page.
      panel.setWidget(new HTML(".. another nice message telling the user to download plugin.."));
    }
    initWidget(panel);
  }
Ejemplo n.º 10
0
  public EditorController(String divID, int width, int height) {

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

    SimplePanel topToolBoxWrapper = new SimplePanel();

    ToggleButtonListener toggleButtonListener = new ToggleButtonListener();

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

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

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

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

    VerticalPanel vp2 = new VerticalPanel();

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

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

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

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

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

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

    DOM.addEventPreview(preview);

    EditorMouseListener listener = new EditorMouseListener(this);
    canvas.addMouseListener(listener);
    canvas.addMouseWheelListener(listener);
  }
Ejemplo n.º 11
0
  @Override
  public void add(
      final WorkbenchPanelView newPanel,
      final WorkbenchPanelView targetPanel,
      final Integer preferredSize,
      final Integer preferredMinSize) {

    final Widget parent = targetPanel.asWidget().getParent();

    if (parent instanceof SimplePanel) {

      final SimplePanel sp = (SimplePanel) parent;
      final HorizontalSplitterPanel hsp =
          factory.newHorizontalSplitterPanel(
              newPanel, targetPanel, Position.EAST, preferredSize, preferredMinSize);

      sp.clear();
      sp.setWidget(hsp);

      // Adding an additional embedded ScrollPanel can cause scroll-bars to disappear
      // so ensure we set the sizes of the new Panel and it's children after the
      // browser has added the new DIVs to the HTML tree. This does occasionally
      // add slight flicker when adding a new Panel.
      scheduleResize(hsp);
    }
  }
Ejemplo n.º 12
0
  /**
   * Sets the icon for this item using the given CSS classes.
   *
   * <p>
   *
   * @param iconClasses the CSS classes
   */
  public void setIcon(String iconClasses) {

    m_iconPanel.setVisible(true);
    Panel iconWidget = new SimplePanel();
    m_iconPanel.setWidget(iconWidget);
    iconWidget.addStyleName(iconClasses + " " + m_fixedIconClasses);
  }
Ejemplo n.º 13
0
  /**
   * Sets the icon of this item.
   *
   * <p>
   *
   * @param image the image to use as icon
   */
  public void setIcon(Image image) {

    m_iconPanel.setVisible(true);
    if (image == null) {
      return;
    }
    m_iconPanel.setWidget(image);
  }
Ejemplo n.º 14
0
 @Override
 public void setInSlot(Object slot, Widget content) {
   if (content != null) {
     if (slot == EditFolderUiHandlers.TYPE_FOLDERS_SHELF_VIEW) {
       shelfTabSimPanel.setWidget(content);
     }
   }
 }
Ejemplo n.º 15
0
 public void setIconRight(Widget w) {
   iconHolderRight.setWidget(w);
   iconHolderRight.setVisible(w != null);
   if (w != null) {
     w.setSize("20px", "20px");
     GwtUtil.setStyles(w, "verticalAlign", "middle", "margin", "0");
   }
 }
Ejemplo n.º 16
0
 @Override
 public void setInSlot(Object slot, Widget content) {
   if (content != null) {
     if (slot == RusdLibraryUiHandlers.TYPE_FOLDERS_SLOT) {
       partnerPanel.setWidget(content);
     }
   }
 }
Ejemplo n.º 17
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."));
  }
Ejemplo n.º 18
0
  @Override
  public void onPageClosed(PageClosedEvent event) {
    final Page page = event.getPage();

    if (page.willClose()) {
      pages.remove(page);
      current.setWidget(pages.peek());
    }
  }
Ejemplo n.º 19
0
  @Override
  public void onPageAdded(PageAddedEvent event) {
    final Page page = event.getPage();

    GWT.log("adding page " + page.getPageTitle());

    pages.add(page);
    current.setWidget(page);
  }
Ejemplo n.º 20
0
 protected void doShowPortfolio(int portfolioId) {
   if (!isWidgetOfType(PortfolioDetailsWidget.class)) {
     LOGGER.info("view not portfolio details - creating new default portoflio details view");
     mainWidget.setWidget(new PortfolioDetailsWidget(portfolioId));
   } else {
     LOGGER.info("changing the portfoio id to " + portfolioId);
     ((PortfolioDetailsWidget) mainWidget.getWidget()).show(portfolioId);
   }
 }
Ejemplo n.º 21
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);
  }
Ejemplo n.º 22
0
  public JobStatusView(DispatchAsync dispatchAsync) {
    this.dispatchAsync = dispatchAsync;
    mainPanel = new FlowPanel();
    mainPanel.addStyleName("jobStatusPanel");

    selectionsPanel = new HorizontalPanel();
    selectionsPanel.setSpacing(20);
    mainPanel.add(selectionsPanel);
    selectedAdapterPanel = new SimplePanel();
    selectedAdapterPanel.setWidget(new Label("*"));
    selectionsPanel.add(selectedAdapterPanel);
    selectionsPanel.add(new HTML("&#8594;"));
    selectedExtractorPanel = new SimplePanel();
    selectedExtractorPanel.setWidget(new Label("*"));
    selectionsPanel.add(selectedExtractorPanel);
    selectionsPanel.add(new HTML("&#8594;"));
    selectedMeasurePanel = new SimplePanel();
    selectedMeasurePanel.setWidget(new Label("*"));
    selectionsPanel.add(selectedMeasurePanel);
    mainPanel.add(selectionsPanel);

    startPanel = new SimplePanel();
    startPanel.addStyleName("jobStatusSubPanel");
    mainPanel.add(startPanel);
    statusPanel = new SimplePanel();
    statusPanel.addStyleName("jobStatusSubPanel");
    mainPanel.add(statusPanel);
    comparisonsPanel = new FlowPanel();
    mainPanel.add(comparisonsPanel);

    disclosurePanel = new DisclosurePanel("Result");
    disclosurePanel.addStyleName("resultDisclosurePanel");
    disclosurePanel.setWidth("100%");
    disclosurePanel.setAnimationEnabled(true);
    disclosurePanel.setContent(mainPanel);

    initWidget(disclosurePanel);
  }
Ejemplo n.º 23
0
  /** Rebuild already added widget based on already added admins */
  private void rebuildAlreadyAddedWidget() {

    alreadyAdded.setStyleName("alreadyAdded");
    alreadyAdded.setVisible(!alreadyAddedList.isEmpty());
    alreadyAdded.setWidget(new HTML("<strong>Already added: </strong>"));
    for (int i = 0; i < alreadyAddedList.size(); i++) {
      alreadyAdded
          .getWidget()
          .getElement()
          .setInnerHTML(
              alreadyAdded.getWidget().getElement().getInnerHTML()
                  + ((i != 0) ? ", " : "")
                  + alreadyAddedList.get(i).getFullName());
    }
  }
Ejemplo n.º 24
0
  public void showDate(Date dateToShow) {
    this.date = dateToShow;
    updateBeginAndEnd();

    lists.clear();
    selectionManager.clear();

    FlexTable table = new FlexTable();
    table.setWidth("100%");
    table.setCellPadding(2);
    table.getColumnFormatter().setWidth(0, "25px");
    table.getColumnFormatter().setWidth(1, "40px");
    table.getColumnFormatter().setWidth(2, "30px");
    table.getColumnFormatter().setWidth(3, "40px");

    // table.setBorderWidth(1);
    int row = 0;
    Date d = begin;
    int month = 0;
    int week = 0;
    while (d.compareTo(end) <= 0) {
      int w = d.getWeek();
      if (w != week) {
        week = w;
        Widget weekWidget = Gwt.createDiv("DayListWidget-week", String.valueOf(week));
        table.setWidget(row, 0, weekWidget);
      }
      int m = d.getMonth();
      if (m != month) {
        month = m;
        Widget monthWidget = Gwt.createDiv("DayListWidget-month", Gwt.getMonthShort(month));
        table.setWidget(row, 1, monthWidget);
      }
      table.setWidget(row, 2, Gwt.createDiv("DayListWidget-date", Gwt.formatDay(d.toJavaDate())));
      table.setWidget(
          row, 3, Gwt.createDiv("DayListWidget-date", Gwt.formatWeekdayShort(d.toJavaDate())));
      table.setWidget(row, 4, createDayContent(d));

      formatRow(table, row);
      d = d.nextDay();
      row++;
    }

    Widget downloadLink =
        ScrumGwt.createPdfLink(
            "Download as PDF", "calendar", "from", begin.toString(), "to", end.toString());
    wrapper.setWidget(Gwt.createFlowPanel(table, Gwt.createSpacer(1, 10), downloadLink));
  }
Ejemplo n.º 25
0
 private void makeLimitedValueWidget() {
   if (!(editingCol instanceof LimitedEntryActionInsertFactCol52)) {
     setAttributeVisibility(limitedEntryValueAttributeIndex, false);
     return;
   }
   if (nil(editingCol.getFactField())) {
     setAttributeVisibility(limitedEntryValueAttributeIndex, false);
     return;
   }
   LimitedEntryActionInsertFactCol52 lea = (LimitedEntryActionInsertFactCol52) editingCol;
   setAttributeVisibility(limitedEntryValueAttributeIndex, true);
   if (lea.getValue() == null) {
     lea.setValue(factory.makeNewValue(editingCol));
   }
   limitedEntryValueWidgetContainer.setWidget(factory.getWidget(editingCol, lea.getValue()));
 }
Ejemplo n.º 26
0
  @Override
  public void addUndo(final UndoLink undoLink) {
    undoLink.setLinkStyle("icon-undo " + style.button());
    undoLink.setUndoCallback(
        new UndoLink.UndoCallback() {
          @Override
          public void preUndo() {
            undoLink.setLinkStyle("icon-progress " + style.button());
          }

          @Override
          public void postUndoSuccess() {
            undoContainer.remove(undoLink);
          }
        });
    undoContainer.setWidget(undoLink);
  }
Ejemplo n.º 27
0
 @Override
 protected void onUpdateHeader(BlockHeaderWidget header) {
   Requirement requirement = getObject();
   header.setDragHandle(requirement.getReference());
   Image statusImage = null;
   if (requirement.isRejected()) {
     statusImage = Img.bundle.reqRejected().createImage();
     statusImage.setTitle("Rejected.");
   } else if (requirement.isClosed()) {
     statusImage = Img.bundle.reqClosed().createImage();
     statusImage.setTitle("Accepted.");
   } else if (requirement.isTasksClosed()) {
     statusImage = Img.bundle.reqTasksClosed().createImage();
     statusImage.setTitle("All tasks done.");
   }
   statusIcon.setWidget(statusImage);
 }
Ejemplo n.º 28
0
  @Override
  public void remove(final WorkbenchPanelView panel) {
    final HorizontalSplitterPanel vsp =
        (HorizontalSplitterPanel) panel.asWidget().getParent().getParent().getParent();
    final Widget parent = vsp.getParent();
    final Widget westWidget = vsp.getWidget(Position.WEST);

    vsp.clear();

    // Set parent's content to the WEST widget
    if (parent instanceof SimplePanel) {
      ((SimplePanel) parent).setWidget(westWidget);
    }

    if (westWidget instanceof RequiresResize) {
      scheduleResize((RequiresResize) westWidget);
    }
  }
Ejemplo n.º 29
0
  public DefinitionsMappingPanel(
      DefinitionWidgetProvider<T> widgetProvider,
      String definitionsLabel,
      String targetsLabel,
      boolean includeTargetColumn) {
    this.widgetProvider = widgetProvider;
    this.definitionsLabel = definitionsLabel;
    this.targetsLabel = targetsLabel;
    this.includeTargetColumn = includeTargetColumn;
    container = new SimplePanel();
    table = new FlexTable();
    table.setCellPadding(5);
    table.setCellSpacing(5);
    table.setStyleName(style.table());
    setupLoadingContainer();

    container.setWidget(table);
    initWidget(container);
  }
Ejemplo n.º 30
0
  @Override
  protected Widget onInitialization() {
    new RequestCommentsServiceCall(parent.getId()).execute(); // TODO commentsManagerComponent

    activateCommentLink = new HyperlinkWidget(new ActivateCommentEditorAction());

    widgets = new HashMap<Comment, CommentWidget>();

    editorWrapper = new SimplePanel();
    editorWrapper.setWidget(activateCommentLink);

    commentListPanel = new FlowPanel();

    FlowPanel panel = new FlowPanel();
    panel = new FlowPanel();
    panel.setStyleName("CommentsWidget");
    panel.add(editorWrapper);
    panel.add(commentListPanel);
    return panel;
  }