Ejemplo n.º 1
0
 private void initClickModeSelectionUI(IGame game) {
   DockPanel clickModePanel = new DockPanel();
   add(clickModePanel);
   clickModePanel.setWidth(
       Integer.toString(FieldCanvas.SIZE * game.getBoard().getDimension().x) + "px");
   clickModePanel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
   clickOpenButton = new RadioButton("ClickOpens", "click opens");
   clickOpenButton.setValue(true);
   clickFlagButton = new RadioButton("ClickFlags", "click flags");
   clickFlagButton.setValue(false);
   ValueChangeHandler<Boolean> checkBoxToggler =
       new ValueChangeHandler<Boolean>() {
         @Override
         public void onValueChange(ValueChangeEvent<Boolean> event) {
           CheckBox checkBox = (CheckBox) event.getSource();
           if (checkBox == clickOpenButton) clickFlagButton.setValue(!event.getValue());
           else clickOpenButton.setValue(!event.getValue());
         }
       };
   clickOpenButton.addValueChangeHandler(checkBoxToggler);
   clickFlagButton.addValueChangeHandler(checkBoxToggler);
   clickModePanel.add(clickFlagButton, DockPanel.WEST);
   clickModePanel.add(clickOpenButton, DockPanel.EAST);
   clickModePanel.setCellHorizontalAlignment(clickOpenButton, DockPanel.ALIGN_LEFT);
   clickModePanel.setCellHorizontalAlignment(clickFlagButton, DockPanel.ALIGN_RIGHT);
 }
Ejemplo n.º 2
0
  /**
   * Creates the metadata panel
   *
   * @param ontologyPanel
   * @param editing true for the editing interface; false for the viewing interface.
   */
  public MetadataPanel(IOntologyPanel ontologyPanel, boolean editing) {
    super();
    this.ontologyPanel = ontologyPanel;
    setWidth("100%");
    //		this.editing = editing;

    int row = 0;

    container.setWidth("1000px");

    row++;

    if (editing) {
      this.setWidget(row, 0, new HTML(INFO));
      row++;
    }

    this.getFlexCellFormatter().setColSpan(row, 0, 2);
    this.setWidget(row, 0, container);
    this.getFlexCellFormatter()
        .setAlignment(row, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP);

    DockPanel dockPanel = new DockPanel();

    dockPanel.add(tabPanel, DockPanel.NORTH);
    container.add(dockPanel, DockPanel.CENTER);

    for (AttrGroup attrGroup : Orr.getMetadataBaseInfo().getAttrGroups()) {
      CellPanel groupPanel = new MetadataGroupPanel(this, attrGroup, editing);
      tabPanel.add(groupPanel, attrGroup.getName());
    }

    tabPanel.selectTab(0);
    enable(false);
  }
Ejemplo n.º 3
0
 public LoggerDetailsPanel(
     BrowseContainer myDisplay, String name, String fullName, LogTreeNode node) {
   super();
   this.browseContainer = myDisplay;
   this.name = name;
   this.fullName = fullName;
   this.node = node;
   this.initWidget(display);
   display.setWidth("100%");
   display.setHeight("100%");
   display.setVerticalAlignment(DockPanel.ALIGN_TOP);
   display.setHorizontalAlignment(DockPanel.ALIGN_LEFT);
 }
Ejemplo n.º 4
0
  protected void layoutButtons(String distribution) {
    navButtonsBottom.clear();
    navButtonsTop.clear();
    DockPanel[] panels = {
      topButtonsRow0,
      topButtonsRow1,
      topButtonsRow2,
      bottomButtonsRow0,
      bottomButtonsRow1,
      bottomButtonsRow2,
      leftButtons,
      rightButtons
    };
    String s[] = distribution.split("[;:,]");

    Widget w = null, m = null;
    for (int i = 0; i < panels.length && i < s.length; i++) {
      DockPanel p = panels[i];
      p.clear();

      if (s[i].length() == 0) continue;

      for (int j = 0; j < s[i].length(); j++) {
        if ((w = getButton(s[i], j)) != null) {
          p.add(w, p != rightButtons ? DockPanel.WEST : DockPanel.EAST);
        }
        if (j == s[i].length() / 2) m = w;
      }

      if (!p.iterator().hasNext()) continue;

      p.setWidth("100%");
      if (p != leftButtons && p != rightButtons) {
        if (m != null) {
          p.setCellWidth(m, "100%");
          m.setWidth("100%");
        }
      }
      if (i < 3) navButtonsTop.add(p, DockPanel.NORTH);
      else if (i < 6) navButtonsBottom.add(p, DockPanel.NORTH);

      if (i < 6) p.addStyleName(StyleCButtonsRow + (i % 3));
    }
  }
Ejemplo n.º 5
0
 private void initCountersUI() {
   DockPanel counterPanel = new DockPanel();
   add(counterPanel);
   minesCounter = new Counter(3);
   minesCounter.setValue(game.getBombCount());
   counterPanel.add(minesCounter, DockPanel.WEST);
   final Counter timeCounter = new Counter(3);
   counterPanel.setHorizontalAlignment(DockPanel.ALIGN_RIGHT);
   counterPanel.add(timeCounter, DockPanel.EAST);
   counterPanel.setWidth(
       Integer.toString(FieldCanvas.SIZE * game.getBoard().getDimension().x) + "px");
   game.getWatch()
       .addListener(
           new IStopWatchListener() {
             @Override
             public void onTimeChange(int currentTime) {
               timeCounter.setValue(currentTime);
             }
           });
 }
Ejemplo n.º 6
0
  public LikeListe(ArrayList<Like> likeListe) {

    /** Label f�r eine kurze Information �ber das DialogFenster */
    LabelInformation = new Label("Nutzer, denen das gefaellt:");
    LabelInformation.setStyleName("LabelInformation");

    /** FlexTable f�r darstellung der Nutzer */
    FlexTableLikeListe = new FlexTable();
    FlexTableLikeListe.setStyleName("FlexTableLikeListe");

    // Durchlauf durch die LikeListe welche als Paramenter im Konstruktor �bergeben wurde. Jeder
    // Nutzer wird in einer row hinzugef�gt.
    for (int i = 0; i < likeListe.size(); i++) {
      FlexTableLikeListe.setHTML(
          i,
          0,
          likeListe.get(i).getNutzer().getVorname() + " " + likeListe.get(i).getNutzer().getName());
    }

    /** Button mit Hilfe man die DialogBox wieder schlie�en kann */
    ButtonSchliessen = new Button("Schlie&szligen");
    ButtonSchliessen.setStyleName("ButtonSchliessen");
    ButtonSchliessen.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            hide();
          }
        });

    /** DockPanel welches die zuvor initialisierten Elemente B�ndelt */
    DockPanel dock = new DockPanel();
    dock.setSpacing(4);
    dock.add(LabelInformation, DockPanel.NORTH);
    dock.add(FlexTableLikeListe, DockPanel.NORTH);
    dock.add(ButtonSchliessen, DockPanel.NORTH);
    dock.setWidth("100%");
    setWidget(dock);
  }
Ejemplo n.º 7
0
  public TitlePanel() {
    text = new HTML(hardCodedText);
    text.setStyleName("title-text");

    // initialize the DockPanel
    dockPanel = new DockPanel();
    // horizontalPanel = new HorizontalPanel();
    if (dockPanel != null) {
      // indentation/border between text and frame
      dockPanel.setSpacing(3);

      dockPanel.add(text, DockPanel.CENTER);
      dockPanel.setCellHorizontalAlignment(text, DockPanel.ALIGN_CENTER);
      dockPanel.setCellVerticalAlignment(text, DockPanel.ALIGN_MIDDLE);
      dockPanel.setWidth("100%");
      dockPanel.setCellWidth(text, "100%");

      dockPanel.setStyleName("title-panel");
    } else {
      System.out.println("Unable to create dockPanel panels");
      throw new NullPointerException("Unable to initialize the dockPanel panel");
    }
  }
  public VerticalPanel buildAssignedRolesPanel() {
    DockPanel headerDockPanel = new DockPanel();

    VerticalPanel fieldsetPanel = new VerticalPanel();

    Label label = new Label(Messages.getString("assignedRoles")); // $NON-NLS-1$
    Label spacer = new Label(""); // $NON-NLS-1$

    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); // $NON-NLS-1$
    headerDockPanel.add(deleteRoleAssignmentBtn, DockPanel.EAST);
    VerticalPanel spacer2 = new VerticalPanel();
    spacer2.setWidth("2"); // $NON-NLS-1$
    headerDockPanel.add(spacer2, DockPanel.EAST);
    headerDockPanel.add(addRoleAssignmentBtn, DockPanel.EAST);

    headerDockPanel.add(spacer, DockPanel.WEST);
    headerDockPanel.setCellWidth(spacer, "100%"); // $NON-NLS-1$

    DockPanel assignedRolesPanel = new DockPanel();
    assignedRolesPanel.add(headerDockPanel, DockPanel.NORTH);
    assignedRolesPanel.add(assignedRolesList, DockPanel.CENTER);
    assignedRolesPanel.setCellHeight(assignedRolesList, "100%"); // $NON-NLS-1$
    assignedRolesPanel.setCellWidth(assignedRolesList, "100%"); // $NON-NLS-1$
    assignedRolesList.setHeight("100%"); // $NON-NLS-1$
    assignedRolesList.setWidth("100%"); // $NON-NLS-1$

    assignedRolesList.addChangeListener(this);
    deleteRoleAssignmentBtn.addClickListener(this);
    addRoleAssignmentBtn.addClickListener(this);

    fieldsetPanel.add(assignedRolesPanel);
    assignedRolesPanel.setWidth("100%"); // $NON-NLS-1$
    assignedRolesPanel.setHeight("100%"); // $NON-NLS-1$
    return fieldsetPanel;
  }
Ejemplo n.º 9
0
 public EmailAdminPanel() {
   dockPanel = new DockPanel();
   actionBar = new ActionBar();
   FlexTable mainPanel = new FlexTable();
   HorizontalPanel hPanel = new HorizontalPanel();
   SimplePanel hSpacer = new SimplePanel();
   hSpacer.setWidth("10px");
   hPanel.add(hSpacer);
   hPanel.add(new Label(Messages.getString("emailSmtpServer")));
   mainPanel.setWidget(0, 0, hPanel);
   hPanel = new HorizontalPanel();
   hSpacer = new SimplePanel();
   hSpacer.setWidth("10px");
   hPanel.add(hSpacer);
   hPanel.add(createEmailPanel());
   mainPanel.setWidget(1, 0, hPanel);
   dockPanel.add(mainPanel, DockPanel.CENTER);
   dockPanel.setCellWidth(mainPanel, "100%");
   saveButton = new Button(Messages.getString("save"));
   progressIndicator = new ProgressIndicatorWidget(saveButton);
   actionBar.addWidget(progressIndicator, HorizontalPanel.ALIGN_RIGHT);
   dockPanel.add(actionBar, DockPanel.SOUTH);
   dockPanel.setCellVerticalAlignment(actionBar, HorizontalPanel.ALIGN_BOTTOM);
   dockPanel.setCellWidth(actionBar, "100%");
   dockPanel.setCellHeight(actionBar, "100%");
   setWidget(dockPanel);
   dockPanel.setHeight("100%");
   dockPanel.setWidth("100%");
   this.setWidth("100%");
   this.setHeight("100%");
   if (isIE()) {
     saveButton.setEnabled(false);
   } else {
     actionBar.collapse(1);
   }
 }
Ejemplo n.º 10
0
  @Override
  public void onModuleLoad() {
    // Initialize the singleton before calling the constructors of the
    // various widgets that might call GSS.get().
    singleton = this;
    parseUserCredentials();

    topPanel = new TopPanel(GSS.images);
    topPanel.setWidth("100%");

    messagePanel.setWidth("100%");
    messagePanel.setVisible(false);

    search = new Search(images);
    searchStatus.add(search, DockPanel.WEST);
    searchStatus.add(userDetailsPanel, DockPanel.EAST);
    searchStatus.setCellHorizontalAlignment(userDetailsPanel, HasHorizontalAlignment.ALIGN_RIGHT);
    searchStatus.setCellVerticalAlignment(search, HasVerticalAlignment.ALIGN_MIDDLE);
    searchStatus.setCellVerticalAlignment(userDetailsPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    searchStatus.setWidth("100%");

    fileList = new FileList(images);

    searchResults = new SearchResults(images);

    // Inner contains the various lists.
    inner.sinkEvents(Event.ONCONTEXTMENU);
    inner.setAnimationEnabled(true);
    inner.getTabBar().addStyleName("gss-MainTabBar");
    inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom");
    inner.add(
        fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true);

    inner.add(
        groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true);
    inner.add(
        searchResults,
        createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"),
        true);
    // inner.add(new CellTreeView(images),
    // createHeaderHTML(AbstractImagePrototype.create(images.search()), "Cell tree sample"), true);
    inner.setWidth("100%");
    inner.selectTab(0);

    inner.addSelectionHandler(
        new SelectionHandler<Integer>() {

          @Override
          public void onSelection(SelectionEvent<Integer> event) {
            int tabIndex = event.getSelectedItem();
            //				TreeItem treeItem = GSS.get().getFolders().getCurrent();
            switch (tabIndex) {
              case 0:
                //						Files tab selected
                // fileList.clearSelectedRows();
                fileList.updateCurrentlyShowingStats();
                break;
              case 1:
                //						Groups tab selected
                groups.updateCurrentlyShowingStats();
                updateHistory("Groups");
                break;
              case 2:
                //						Search tab selected
                searchResults.clearSelectedRows();
                searchResults.updateCurrentlyShowingStats();
                updateHistory("Search");
                break;
            }
          }
        });
    //		If the application starts with no history token, redirect to a new "Files" state
    String initToken = History.getToken();
    if (initToken.length() == 0) History.newItem("Files");
    //		   Add history listener to handle any history events
    History.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            String tokenInput = event.getValue();
            String historyToken = handleSpecialFolderNames(tokenInput);
            try {
              if (historyToken.equals("Search")) inner.selectTab(2);
              else if (historyToken.equals("Groups")) inner.selectTab(1);
              else if (historyToken.equals("Files") || historyToken.length() == 0)
                inner.selectTab(0);
              else {
                /*TODO: CELLTREE
                PopupTree popupTree = GSS.get().getFolders().getPopupTree();
                TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken);
                SelectionEvent.fire(popupTree, treeObj);
                */
              }
            } catch (IndexOutOfBoundsException e) {
              inner.selectTab(0);
            }
          }
        });

    // Add the left and right panels to the split panel.
    splitPanel.setLeftWidget(treeView);
    splitPanel.setRightWidget(inner);
    splitPanel.setSplitPosition("25%");
    splitPanel.setSize("100%", "100%");
    splitPanel.addStyleName("gss-splitPanel");

    // Create a dock panel that will contain the menu bar at the top,
    // the shortcuts to the left, the status bar at the bottom and the
    // right panel taking the rest.
    VerticalPanel outer = new VerticalPanel();
    outer.add(topPanel);
    outer.add(searchStatus);
    outer.add(messagePanel);
    outer.add(splitPanel);
    outer.add(statusPanel);
    outer.setWidth("100%");
    outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER);

    outer.setSpacing(4);

    // Hook the window resize event, so that we can adjust the UI.
    Window.addResizeHandler(this);
    // Clear out the window's built-in margin, because we want to take
    // advantage of the entire client area.
    Window.setMargin("0px");
    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    RootPanel.get().add(outer);
    // Call the window resized handler to get the initial sizes setup. Doing
    // this in a deferred command causes it to occur after all widgets'
    // sizes have been computed by the browser.
    DeferredCommand.addCommand(
        new Command() {

          @Override
          public void execute() {
            onWindowResized(Window.getClientHeight());
          }
        });
  }
Ejemplo n.º 11
0
  /**
   * Creates the calendar instance based in the configuration provided.
   *
   * <p>Options can be passed joining these using the or bit wise operator
   *
   * <ul>
   *   <li>CONFIG_DIALOG show as modal dialog
   *   <li>CONFIG_ROUNDED_BOX wrap with a rounded-corner box
   *   <li>CONFIG_NO_AUTOHIDE don't autohide dialog when the user click out of the picker
   *   <li>CONFIG_NO_ANIMATION don't animate the dialog box when it is showed/hidden
   *   <li>CONFIG_NO_ANIMATION don't animate the dialog box when it is showed/hidden
   *   <li>CONFIG_BACKGROUND show a semitransparent background covering all the document
   *   <li>CONFIG_FLAT_BUTTONS use native Buttons instead of GWTCButton also add the dependent class
   *       'flat'
   *   <li>CONFIG_STANDARD_BUTTONS use native browser Buttons instead of GWTCButton
   * </ul>
   */
  public void initialize(int config) {

    int buttonsType = config & CONFIG_FLAT_BUTTONS | config & CONFIG_STANDARD_BUTTONS;
    helpBtn = createButton(buttonsType, "?", this);
    closeBtn = createButton(buttonsType, "x", this);
    todayBtn = createButton(buttonsType, "-", this);
    prevMBtn = createButton(buttonsType, "\u003c", this);
    prevYBtn = createButton(buttonsType, "\u00AB", this);
    nextMBtn = createButton(buttonsType, "\u003e", this);
    nextYBtn = createButton(buttonsType, "\u00BB", this);

    if ((config & CONFIG_DIALOG) == CONFIG_DIALOG) {
      int opt = 0;
      if ((config & CONFIG_ROUNDED_BOX) == CONFIG_ROUNDED_BOX) {
        opt |= GWTCModalBox.OPTION_ROUNDED_FLAT;
      }
      if ((config & CONFIG_BACKGROUND) != CONFIG_BACKGROUND) {
        opt |= GWTCModalBox.OPTION_DISABLE_BACKGROUND;
        if ((config & CONFIG_NO_AUTOHIDE) == CONFIG_NO_AUTOHIDE) {
          opt |= GWTCModalBox.OPTION_DISABLE_AUTOHIDE;
        }
      }
      calendarDlg = new GWTCModalBox(opt);
      calendarDlg.setAnimationEnabled((config & CONFIG_NO_ANIMATION) != CONFIG_NO_ANIMATION);

      outer = calendarDlg;
      initWidget(new DockPanel());

      setStyleName(styleName);
      addStyleDependentName(StyleDialog);
      setZIndex(999);
    } else {
      if ((config & CONFIG_ROUNDED_BOX) == CONFIG_ROUNDED_BOX) {
        outer = new GWTCBox(GWTCBox.STYLE_FLAT);
      } else {
        outer = new VerticalPanel();
      }
      String s = outer.getStyleName();
      initWidget(outer);
      setStyleName(styleName);
      addStyleDependentName(StyleEmbeded);
      if (s != null && s.length() > 0) addStyleName(s);
    }

    helpDlg.addStyleName(StyleHelp);
    navButtonsTop.setStyleName(StyleCButtonsTop);
    navButtonsBottom.setStyleName(StyleCButtonsBottom);
    calendarGrid.setStyleName(StyleMonthGrid);
    navButtonsTop.setWidth("100%");
    calendarGrid.setWidth("100%");
    navButtonsBottom.setWidth("100%");

    if ((config & CONFIG_ROUNDED_BOX) == CONFIG_ROUNDED_BOX) addStyleDependentName(StyleBox);
    else addStyleDependentName(StyleNoBox);

    if ((config & CONFIG_DIALOG) != CONFIG_DIALOG) closeBtn.setVisible(false);

    monthSelectorHeader.setAnimationEnabled(true);

    outer.add(navButtonsTop);
    outer.add(calendarGrid);
    outer.add(navButtonsBottom);

    drawDatePickerWidget();
    refresh();

    DOM.sinkEvents(outer.getElement(), Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONCLICK);
    DOM.setStyleAttribute(outer.getElement(), "cursor", "default");
    DOM.setElementAttribute(monthMenu.getElement(), "align", "center");
  }
Ejemplo n.º 12
0
  public iCalCalendarPanel() {

    // style this element as absolute position
    DOM.setStyleAttribute(this.getElement(), "position", "absolute");
    DOM.setStyleAttribute(this.getElement(), "top", "0px");
    DOM.setStyleAttribute(this.getElement(), "left", "0px");
    DOM.setStyleAttribute(this.getElement(), "padding", "0px");

    DOM.setStyleAttribute(DOM.getElementById("messageBox"), "display", "none");

    mainLayoutPanel.setWidth("100%");
    add(mainLayoutPanel);

    // add header
    headerPanel.setStyleName("gwt-cal-HeaderPanel");
    DOM.setInnerHTML(headerPanel.getElement(), "&nbsp;");
    footerPanel.setStyleName("gwt-cal-FooterPanel");
    DOM.setInnerHTML(headerPanel.getElement(), "&nbsp;");
    mainLayoutPanel.add(headerPanel, DockPanel.NORTH);
    mainLayoutPanel.add(footerPanel, DockPanel.SOUTH);

    // add left panel
    datePicker.setValue(new Date());
    dateLayoutPanel.add(datePicker, DockPanel.SOUTH);
    dateLayoutPanel.add(splitterPanel, DockPanel.SOUTH);
    splitterPanel.setStyleName("splitter");
    mainLayoutPanel.add(dateLayoutPanel, DockPanel.WEST);

    // CalendarFormat.INSTANCE.setFirstDayOfWeek(1);

    // change hour offset to false to facilitate iCal style
    settings.setOffsetHourLabels(true);
    settings.setTimeBlockClickNumber(Click.Double);
    // create day view
    calendar = new Calendar();
    calendar.setSettings(settings);
    // set style as google-cal
    calendar.setWidth("100%");
    // set today as default date
    mainLayoutPanel.add(calendar, DockPanel.CENTER);
    mainLayoutPanel.setCellVerticalAlignment(dateLayoutPanel, HasAlignment.ALIGN_BOTTOM);
    dateLayoutPanel.setCellVerticalAlignment(datePicker, HasAlignment.ALIGN_BOTTOM);
    dateLayoutPanel.setWidth("168px");

    // add today button
    todayButton.setStyleName("todayButton");
    todayButton.setText("Today");
    todayButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            datePicker.setValue(new Date(), true);
            // dayView.setDate(new Date());
          }
        });
    previousDayButton.setStyleName("previousButton");
    previousDayButton.setHTML("&laquo;");
    previousDayButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Date d = datePicker.getValue();
            d.setDate(d.getDate() - 1);
            datePicker.setValue(d, true);
          }
        });
    nextDayButton.setStyleName("nextButton");
    nextDayButton.setHTML("&raquo;");
    nextDayButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Date d = datePicker.getValue();
            d.setDate(d.getDate() + 1);
            datePicker.setValue(d, true);
          }
        });
    headerPanelLayout.setWidget(0, 0, todayButton);
    headerPanelLayout.setWidget(0, 1, previousDayButton);

    oneDayButton.setText("1 Day");
    oneDayButton.setStyleName("dayButton");
    threeDayButton.setText("3 Day");
    threeDayButton.setStyleName("dayButton");
    threeDayButton.addStyleName("active");
    activeDayButton = threeDayButton;
    weekDayButton.setText("Work Week");
    weekDayButton.setStyleName("dayButton");
    monthButton.setText("Month");
    monthButton.setStyleName("dayButton");
    headerPanelLayout.setWidget(0, 2, oneDayButton);
    headerPanelLayout.setWidget(0, 3, threeDayButton);
    headerPanelLayout.setWidget(0, 4, weekDayButton);
    headerPanelLayout.setWidget(0, 5, monthButton);
    headerPanelLayout.setWidget(0, 6, nextDayButton);
    headerPanelLayout.setHTML(0, 7, "&nbsp;");

    headerPanelLayout.getCellFormatter().setWidth(0, 0, "50%");
    headerPanelLayout.getCellFormatter().setWidth(0, 7, "50%");

    headerPanelLayout.setWidth("100%");
    headerPanelLayout.setCellPadding(0);
    headerPanelLayout.setCellSpacing(0);
    headerPanel.add(headerPanelLayout);

    footerPanel.add(
        new HTML(
            "<a href='http://code.google.com/p/gwt-cal'>gwt-cal</a> widget for Google Web Toolkit, GPLv3, by <a href='http://www.google.com/profiles/Brad.Rydzewski'>Brad Rydzewski</a>"));

    oneDayButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            activeDayButton.removeStyleName("active");
            activeDayButton = oneDayButton;
            activeDayButton.addStyleName("active");
            calendar.setView(CalendarViews.DAY, 1);
            // calendar.scrollToHour(6);
          }
        });
    threeDayButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            activeDayButton.removeStyleName("active");
            activeDayButton = threeDayButton;
            activeDayButton.addStyleName("active");
            calendar.setView(CalendarViews.DAY, 3);
            // calendar.scrollToHour(6);
          }
        });
    weekDayButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            activeDayButton.removeStyleName("active");
            activeDayButton = weekDayButton;
            activeDayButton.addStyleName("active");
            calendar.setView(CalendarViews.DAY, 5);
            // calendar.scrollToHour(6);
          }
        });
    monthButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            activeDayButton.removeStyleName("active");
            activeDayButton = monthButton;
            activeDayButton.addStyleName("active");
            calendar.setView(CalendarViews.MONTH);
          }
        });

    datePicker.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          public void onValueChange(ValueChangeEvent<Date> event) {
            calendar.setDate(event.getValue());
          }
        });
    calendar.addDeleteHandler(
        new DeleteHandler<Appointment>() {
          public void onDelete(DeleteEvent<Appointment> event) {
            boolean commit =
                Window.confirm(
                    "Are you sure you want to delete appointment \""
                        + event.getTarget().getTitle()
                        + "\"");
            if (commit == false) {
              event.setCancelled(true);
              System.out.println("cancelled appointment deletion");
            }
          }
        });
    calendar.addOpenHandler(
        new OpenHandler<Appointment>() {
          public void onOpen(OpenEvent<Appointment> event) {
            Window.alert("You double-clicked appointment \"" + event.getTarget().getTitle() + "\"");
          }
        });

    calendar.addSelectionHandler(
        new SelectionHandler<Appointment>() {
          public void onSelection(SelectionEvent<Appointment> event) {
            System.out.println("selected " + event.getSelectedItem().getTitle());
          }
        });

    calendar.addTimeBlockClickHandler(
        new TimeBlockClickHandler<Date>() {
          public void onTimeBlockClick(TimeBlockClickEvent<Date> event) {
            Window.alert("you clicked time block " + event.getTarget());
          }
        });

    /* Generate random appointments */
    AppointmentBuilder.appointmentsPerDay = 5;
    AppointmentBuilder.HOURS = new Integer[] {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
    AppointmentBuilder.MINUTES = new Integer[] {0, 30};
    AppointmentBuilder.DURATIONS = new Integer[] {60, 90, 120, 180, 240, 600};
    AppointmentBuilder.DESCRIPTIONS[1] = "Best show on TV!";

    ArrayList<Appointment> appointments = AppointmentBuilder.build(AppointmentBuilder.ICAL_STYLES);
    /* Add appointments to day view */
    calendar.suspendLayout();
    calendar.addAppointments(appointments);

    calendar.resumeLayout();

    // window events to handle resizing
    Window.enableScrolling(false);
    Window.addResizeHandler(
        new ResizeHandler() {
          public void onResize(ResizeEvent event) {
            int h = event.getHeight();
            calendar.setHeight(
                h - headerPanel.getOffsetHeight() - footerPanel.getOffsetHeight() + "px");
          }
        });
    Scheduler.get()
        .scheduleDeferred(
            new ScheduledCommand() {
              public void execute() {
                calendar.setHeight(
                    Window.getClientHeight()
                        - headerPanel.getOffsetHeight()
                        - footerPanel.getOffsetHeight()
                        + "px");
                calendar.scrollToHour(6);
              }
            });
  }
Ejemplo n.º 13
0
  /**
   * Constructor. Displays the upload pane, with an upload widget and a next button.
   *
   * @param wys Entrypoint
   */
  public UploadTab(WYSIWYMinterface wys) {
    super();
    parent = wys;
    setStyleName("ks-Sink");
    setSpacing(15);

    message1 = new Label("Welcome to the PolicyGrid Data Archive.");
    message1.setStyleName("wysiwym-label-xlarge");
    message2 = new Label("Please upload your resource.");
    message2.setStyleName("wysiwym-label-large");

    VerticalPanel vp = new VerticalPanel();
    vp.add(message1);
    vp.add(message2);

    Image image = new Image();
    image.setUrl("http://www.csd.abdn.ac.uk/~fhielkem/logo.jpg");

    DockPanel top = new DockPanel();
    top.setWidth("100%");
    top.add(vp, DockPanel.WEST);
    top.add(image, DockPanel.EAST);
    add(top);

    form = new FormPanel();
    form.setAction(GWT.getModuleBaseURL() + "/postings?action=upload");
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);
    form.setWidget(this);

    upload = new FileUpload();
    upload.setName("upload");
    add(upload);

    Hidden hid = new Hidden("user", parent.getUser());
    add(hid);

    add(
        new Button(
            "Next >>",
            new ClickListener() { // if user clicks next, submit the uploaded file
              public void onClick(Widget sender) {
                form.submit();
              }
            }));

    form.addFormHandler(
        new FormHandler() { // check whether resource was uploaded and stored in Fedora. If not,
                            // display error message.
          public void onSubmitComplete(
              FormSubmitCompleteEvent event) { // tell the parent to create the initial description
            if (event.getResults().indexOf("ERROR!!") >= 0)
              Window.alert(
                  "There was an error uploading your file. "
                      + "It may be because your filename is too long, or contains special characters. "
                      + "Please rename your file with a shorter name, using only letters and numbers, and try to upload it again.");
            else {
              RootPanel.get().remove(form);
              parent.startDescription(event.getResults());
            }
          }

          public void onSubmit(
              FormSubmitEvent
                  event) { // check whether user has uploaded a resource; if not, display warning
            if (upload.getFilename().length() == 0) {
              Window.alert("Please upload a document first.");
              event.setCancelled(true);
            }
          }
        });
    RootPanel.get().add(form);
  }
Ejemplo n.º 14
0
  public ExplorerViewImpl() {
    checkBoxList = new ArrayList<CheckBox>();
    selectedFileSet = new TreeSet<String>();
    clickHandlerStopPropagation =
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            event.stopPropagation();
          }
        };

    DockPanel dockPanel = new DockPanel();
    dockPanel.setWidth("100%");

    viewPanel = new SimplePanel(dockPanel);
    initWidget(viewPanel);

    MenuBar menuBar = new MenuBar(false);
    dockPanel.add(menuBar, DockPanel.NORTH);
    menuBar.setHeight("30px");

    MenuBar mnbrFile = new MenuBar(true);

    MenuItem mntmFile = new MenuItem("File", false, mnbrFile);
    menuBar.addItem(mntmFile);

    mntmMakeDirectory =
        new MenuItem(
            "Make Directory",
            false,
            new Command() {
              public void execute() {
                new FileDialogBox(presenter, Operation.MAKE_DIRECTORY).center();
              }
            });
    mnbrFile.addItem(mntmMakeDirectory);

    mntmUploadFile =
        new MenuItem(
            "Upload",
            false,
            new Command() {
              public void execute() {
                new FileDialogBox(presenter, Operation.UPLOAD).center();
              }
            });
    mnbrFile.addItem(mntmUploadFile);

    mntmDownloadFile =
        new MenuItem(
            "Download",
            false,
            new Command() {
              public void execute() {
                presenter.downloadFiles(selectedFileSet);
              }
            });
    mnbrFile.addItem(mntmDownloadFile);
    mntmDownloadFile.setEnabled(false);

    mntmDeleteFile =
        new MenuItem(
            "Delete",
            false,
            new Command() {
              public void execute() {}
            });
    mnbrFile.addItem(mntmDeleteFile);
    mntmDeleteFile.setEnabled(false);

    mntmRenameFile =
        new MenuItem(
            "Rename",
            false,
            new Command() {
              public void execute() {}
            });
    mnbrFile.addItem(mntmRenameFile);
    mntmRenameFile.setEnabled(false);

    MenuItemSeparator misFile = new MenuItemSeparator();
    mnbrFile.addSeparator(misFile);

    MenuItem mntmCloseVolume =
        new MenuItem(
            "Close volume",
            false,
            new Command() {
              public void execute() {
                presenter.closeVolume();
              }
            });
    mnbrFile.addItem(mntmCloseVolume);

    MenuBar mnbrHelp = new MenuBar(true);

    MenuItem mntmHelp = new MenuItem("Help", false, mnbrHelp);
    menuBar.addItem(mntmHelp);

    MenuItem mntmAbout =
        new MenuItem(
            "About",
            false,
            new Command() {
              public void execute() {
                Window.alert("");
              }
            });
    mnbrHelp.addItem(mntmAbout);

    flowPanel = new FlowPanel();

    explorerScrollPanel = new ScrollPanel(flowPanel);
    dockPanel.add(explorerScrollPanel, DockPanel.CENTER);
    explorerScrollPanel.sinkEvents(Event.ONCLICK);
    explorerScrollPanel.addHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            setAllCheckBoxFalse();
          }
        },
        ClickEvent.getType());
    explorerScrollPanel.sinkEvents(Event.ONCONTEXTMENU);
    explorerScrollPanel.addHandler(
        new ContextMenuHandler() {
          public void onContextMenu(ContextMenuEvent event) {
            event.preventDefault();
            event.stopPropagation();
            FileContextMenu fileContextMenu =
                new FileContextMenu(presenter, ContextMenuType.BACKGROUND);
            fileContextMenu.setPopupPosition(
                event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
            fileContextMenu.show();
            setAllCheckBoxFalse();
          }
        },
        ContextMenuEvent.getType());

    Tree tree = new Tree();

    treeScrollPanel = new ScrollPanel(tree);
    dockPanel.add(treeScrollPanel, DockPanel.WEST);
    treeScrollPanel.setWidth("120px");

    resizeScrollPanel();
    Window.addResizeHandler(
        new ResizeHandler() {
          public void onResize(ResizeEvent event) {
            resizeScrollPanel();
          }
        });

    tree.setAnimationEnabled(true);
    // tree.addOpenHandler(new OpenHandler<TreeItem>() {
    // public void onOpen(OpenEvent<TreeItem> event) {
    // TreeItem trtmTarget = event.getTarget();
    // String path = getPath(trtmTarget);
    // for (int i = 0; i < trtmTarget.getChildCount(); i++) {
    // TreeItem trtmChild = trtmTarget.getChild(i);
    // String childPath = path + trtmChild.getText();
    // presenter.getFiles(trtmChild, childPath);
    // }
    // }
    // });
    tree.addSelectionHandler(
        new SelectionHandler<TreeItem>() {
          public void onSelection(SelectionEvent<TreeItem> event) {
            TreeItem selectedItem = event.getSelectedItem();
            String path = getPath(selectedItem);
            selectedItem.setState(true, true);
            presenter.changeDirectory(path);
          }
        });

    trtmRoot = new TreeItem();
    trtmSelectedItem = trtmRoot;
    tree.addItem(trtmRoot);
    trtmRoot.setText("/");
  }