/** Constructor */
  public ConfirmDialog() {
    dialogBox = new DialogBox(false, true);

    confirmPanel = new DockPanel();
    messageLabel = createMessageLabel();
    confirmPanel.add(messageLabel, DockPanel.CENTER);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(10);
    okButton = createOkButton();
    horizontalPanel.add(okButton);
    cancelButton = createCancelButton();
    horizontalPanel.add(cancelButton);

    if (defaultCloseHandlers != null) {
      for (CloseHandler<ConfirmDialog> closeHandler : defaultCloseHandlers) {
        this.addCloseHandler(closeHandler);
      }
    }

    if (defaultOpenHandlers != null) {
      for (OpenHandler<ConfirmDialog> openHandler : defaultOpenHandlers) {
        this.addOpenHandler(openHandler);
      }
    }

    confirmPanel.add(horizontalPanel, DockPanel.SOUTH);
    confirmPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);

    dialogBox.add(confirmPanel);
    confirmPanel.getElement().getParentElement().setAttribute("align", "center");

    setStyleName(DEFAULT_STYLE_NAME);
  }
  public TrustActionEditView(
      I18NAccount messages, Constants constants, HelpPanel helpPanel, Elements elements) {
    this.messages = messages;
    this.constants = constants;
    this.helpPanel = helpPanel;
    this.elements = elements;

    DockPanel dp = new DockPanel();

    table = new FlexTable();
    table.setStyleName("tableborder");
    table.setText(0, 0, elements.trust());
    table.setText(0, 1, elements.description());
    table.setText(0, 2, elements.trust_default_desc());
    table.setText(0, 3, elements.trust_actionclub());
    table.setText(0, 4, elements.trust_actiontrust());
    table.setText(0, 5, elements.trust_debetpost());
    table.setText(0, 6, elements.trust_creditpost());
    table.setText(0, 7, "");
    table.getRowFormatter().setStyleName(0, "header");

    newButton = new NamedButton("new_trust", elements.new_trust());
    newButton.addClickHandler(this);

    dp.add(newButton, DockPanel.NORTH);
    dp.add(table, DockPanel.NORTH);

    idHolder = new IdHolder<String, Image>();
    initWidget(dp);
  }
示例#3
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);
  }
示例#4
0
 public void testWest() {
   Widget west = root.getWidget(1);
   assertEquals(com.google.gwt.user.client.ui.DockPanel.WEST, root.getWidgetDirection(west));
   assertEquals(HTML.class, west.getClass());
   String html = ((HTML) west).getHTML();
   assertTrue(html.contains("side bar"));
 }
示例#5
0
 private void createUI() {
   DockPanel dock = new DockPanel();
   input = new TextBox();
   dock.add(input, DockPanel.SOUTH);
   output = new VerticalPanel();
   dock.add(output, DockPanel.SOUTH);
   RootPanel.get("app").add(dock);
 }
示例#6
0
  /**
   * Constructor for SimplePager.
   *
   * @param pageable a {@link org.opennms.dashboard.client.SimplePageable} object.
   */
  public SimplePager(SimplePageable pageable) {
    m_pageable = pageable;

    m_pager.addStyleName("pager");
    m_pager.add(createLeftPageControl(), DockPanel.WEST);
    // m_pager.add(m_label, DockPanel.CENTER);
    m_pager.add(createRightPageControl(), DockPanel.EAST);

    initWidget(m_pager);
  }
 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);
 }
 /** @gwt.typeArgs customers <com.mycompany.proto.console.hello.client.CustomerAdaptor> */
 private void rebuildCustomersTable(List customers) {
   tableWrapper.clear();
   FlexTable table = new FlexTable();
   int rows = -1;
   table.setHTML(++rows, 0, "ID");
   table.setHTML(rows, 1, "First Name");
   table.setHTML(rows, 2, "Last Name");
   table.setHTML(rows, 3, "Delete?");
   for (Iterator iter = customers.iterator(); iter.hasNext(); ) {
     CustomerAdaptor customer = (CustomerAdaptor) iter.next();
     table.setHTML(++rows, 0, customer.getId().toString());
     table.setHTML(rows, 1, customer.getFirstName());
     table.setHTML(rows, 2, customer.getLastName());
     table.setWidget(rows, 3, new CustomerDeleteButton(customer));
   }
   tableWrapper.add(table, DockPanel.CENTER);
 }
示例#9
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);
             }
           });
 }
示例#10
0
  public void onModuleLoad() {

    JobScheduleTable jobScheduleTable = new JobScheduleTable(greetingService);
    jobScheduleTable.setSize("800px", "500px");
    jobScheduleTable.loadJobSchedule();

    AbsolutePanel absolutePanel = new AbsolutePanel();
    absolutePanel.setSize("800px", "30px");
    absolutePanel.add(new About(greetingService), 0, 0);

    TabPanel tabPanel = new TabPanel();
    tabPanel.setSize("800px", "600px");
    tabPanel.add(jobScheduleTable, "我的工作日程表", false);

    DockPanel dp = new DockPanel();
    dp.setSize("800px", "600px");
    dp.add(absolutePanel, DockPanel.SOUTH);
    dp.add(tabPanel, DockPanel.CENTER);

    RootPanel.get("gwtwindow").add(dp);
  }
  public VerticalPanel buildUsersListPanel() {
    DockPanel headerDockPanel = new DockPanel();
    headerDockPanel.add(deleteUserBtn, DockPanel.EAST);
    VerticalPanel spacer = new VerticalPanel();
    spacer.setWidth("2"); // $NON-NLS-1$
    headerDockPanel.add(spacer, DockPanel.EAST);
    headerDockPanel.add(addUserBtn, DockPanel.EAST);
    Label label = new Label("Users"); // $NON-NLS-1$
    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); // $NON-NLS-1$
    VerticalPanel userListPanel = new VerticalPanel();
    userListPanel.add(headerDockPanel);
    userListPanel.add(usersList);
    userListPanel.add(new Label(Messages.getString("filter"))); // $NON-NLS-1$
    userListPanel.add(filterTextBox);

    userListPanel.setCellHeight(usersList, "100%"); // $NON-NLS-1$
    userListPanel.setCellWidth(usersList, "100%"); // $NON-NLS-1$
    userListPanel.setHeight("100%"); // $NON-NLS-1$
    userListPanel.setWidth("100%"); // $NON-NLS-1$
    usersList.setHeight("100%"); // $NON-NLS-1$
    usersList.setWidth("100%"); // $NON-NLS-1$
    filterTextBox.setWidth("100%"); // $NON-NLS-1$
    deleteUserBtn.setEnabled(false);

    filterTextBox.addKeyboardListener(this);
    usersList.addChangeListener(this);
    addUserBtn.addClickListener(this);
    deleteUserBtn.addClickListener(this);
    return userListPanel;
  }
示例#12
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);
 }
示例#13
0
  public void testCenter() {
    // TODO(rjrjr) More of a test of HTMLPanelParser

    Widget center = getCenter();
    assertEquals(com.google.gwt.user.client.ui.DockPanel.CENTER, root.getWidgetDirection(center));
    assertEquals(HTMLPanel.class, center.getClass());
    String html = center.getElement().getInnerHTML();
    assertTrue(html.contains("main area"));
    assertTrue(html.contains("Button with"));
    assertTrue(html.contains("Of course"));

    assertEquals(center, widgetUi.myButton.getParent());
  }
示例#14
0
  /**
   * Creates a new instance of the form runner widget.
   *
   * @param images the images to load icons.
   */
  public FormRunnerWidget(Images images) {

    view = new FormRunnerView(/*images*/ );

    dockPanel.add(view, DockPanel.CENTER);

    FormUtil.maximizeWidget(dockPanel);

    initWidget(dockPanel);

    controller = new FormRunnerController(this);
    view.setSubmitListener(controller);

    // process key board events and pick Ctrl + S for saving.
    previewEvents();
  }
 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);
   }
 }
示例#16
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");
    }
  }
示例#17
0
  /** Build a view */
  public void build() {
    // Construct a dock panel
    DockPanel dock = new DockPanel();
    dock.setStyleName("cw-DockPanel");
    dock.add(buildHeader(), DockPanel.NORTH);
    dock.add(buildDescription(), DockPanel.NORTH);
    dock.add(buildContent(), DockPanel.CENTER);
    dock.add(buildStepBar(), DockPanel.SOUTH);
    dock.add(buildToolbar(), DockPanel.SOUTH);

    // Configure Main panel
    setSpacing(5);
    setSize("100%", "500px");
    setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);

    DecoratorPanel decPanel = new DecoratorPanel();
    decPanel.setWidget(dock);

    // Add constructed view
    add(decPanel);
  }
示例#18
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);
  }
示例#19
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);
  }
示例#20
0
文件: GSS.java 项目: davideuler/gss
  @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());
          }
        });
  }
  /**
   * The entry point method, called automatically by loading a module that declares an implementing
   * class as an entry-point
   */
  public void onModuleLoad() {

    // Define widget elements
    final DockPanel dock = new DockPanel();
    dock.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
    dock.setBorderWidth(3);

    final Label titleLabel = new Label(titleString);
    final Label footerLabel = new Label(footerString);

    final TreasurePanel treasurePanel = new TreasurePanel();
    final LocationInfoPanel locationPanel = new LocationInfoPanel();
    final MapWidget map = new MapWidget(startLocation, 1);
    final LoginPanel loginPanel = new LoginPanel();
    final CommsPanel commsPanel = new CommsPanel();
    final AcceptPanel acceptPanel = new AcceptPanel();

    loginPanel.setWidth("200px");
    loginPanel.setHeight("600px");

    locationPanel.setWidth("150px");
    //		locationPanel.setHeight("800px");

    map.setSize("800px", "380px");
    map.setGoogleBarEnabled(false);
    map.setCurrentMapType(MapType.getSatelliteMap());
    map.setScrollWheelZoomEnabled(true);
    map.setPinchToZoom(true);

    final String refererURL = Document.get().getReferrer();

    ImageZoomControl izm = new ImageZoomControl();
    izm.initialize(map);
    map.addControl(izm);

    //		map.addMapMoveHandler(new MapMoveHandler() {
    //
    //			public void onMove(MapMoveEvent event) {
    //				LatLngBounds rect = map.getBounds();
    //				LatLng rectSize = rect.toSpan();
    //
    //				if (rect.getNorthEast().getLatitude() >= outside.getNorthEast().getLatitude()) {
    //					map.setCenter(LatLng.newInstance(
    //							outside.getNorthEast().getLatitude() - rectSize.getLatitude()/2,
    //							map.getCenter().getLongitude()
    //							));
    //				} else if (rect.getNorthEast().getLongitude() >= outside.getNorthEast().getLongitude()) {
    //					map.setCenter(LatLng.newInstance(
    //							map.getCenter().getLatitude(),
    //							outside.getNorthEast().getLongitude() - rectSize.getLongitude()/2
    //							));
    //				} else if (rect.getSouthWest().getLatitude() <= outside.getSouthWest().getLatitude()) {
    //					map.setCenter(LatLng.newInstance(
    //							outside.getSouthWest().getLatitude() + rectSize.getLatitude()/2,
    //							map.getCenter().getLongitude()
    //							));
    //				} else if (rect.getSouthWest().getLongitude() <= outside.getSouthWest().getLongitude()) {
    //					map.setCenter(LatLng.newInstance(
    //							map.getCenter().getLatitude(),
    //							outside.getSouthWest().getLongitude() + rectSize.getLongitude()/2
    //							));
    //				}
    //			}
    //		});

    //		map.addMapZoomEndHandler(new MapZoomEndHandler() {
    //
    //			public void onZoomEnd(MapZoomEndEvent event) {
    //				if (map.getZoomLevel() <= map.getBoundsZoomLevel(outside)) {
    //					map.setZoomLevel(map.getBoundsZoomLevel(outside) + 1);
    //				}
    //			}
    //		});
    //
    map.addMapZoomEndHandler(
        new MapZoomEndHandler() {
          public void onZoomEnd(MapZoomEndEvent event) {
            int minZoomLevel = 7;
            int maxZoomLevel = 10;

            if (map.getZoomLevel() > 1 && map.getZoomLevel() < minZoomLevel) {
              map.setZoomLevel(minZoomLevel);
            } else if (map.getZoomLevel() > 1 && map.getZoomLevel() > maxZoomLevel) {
              map.setZoomLevel(maxZoomLevel);
            }
            GameInfo.getInstance().refreshAll(false);
          }
        });

    map.addMapClickHandler(
        new MapClickHandler() {
          public void onClick(MapClickEvent event) {
            if (event.getOverlay() != null) {
              return;
              //					//Then the click was over an overlay
              //					if(event.getOverlay().getClass()==GGLocationOverlay.class) {
              //						//Then it is a location :D
              //						GGLocationOverlay locationOverlay = (GGLocationOverlay)event.getOverlay();
              //						LocationDTO location = locationOverlay.getLocation();
              //						if(WindowInformation.locationPanel.isCreateMode() &&
              // WindowInformation.locationPanel.isRoadMode()) {
              //							//Then we should handle it in development mode (to start/end a road)
              //							DevUtil.handleDevLocationClick(location);
              //						} else {
              //							//Then we should try to move to that location
              //							AsyncCallback<ActionResult> callback = new AsyncCallback<ActionResult>() {
              //								public void onFailure(Throwable caught) {
              //									Window.alert("Move failed - " + caught.getMessage());
              //								}
              //
              //								public void onSuccess(ActionResult result) {
              //									if(result.isSuccess()) {
              //										Window.alert(result.getMessage());
              //										GameInformation.getInstance().updateInformation(result.getPlayer(),
              // result.getMapInformation());
              //										MapUtil.refreshMap(false);
              //										WindowInformation.locationPanel.refresh();
              //										WindowInformation.treasurePanel.refresh();
              //									}
              //								}
              //							};
              //
              //	GameServices.gameService.moveToLocation(GameInformation.getInstance().getPlayer(),
              // location.getId(), callback);
              //						}
              //						return;
              //					}
            } else {
              // Then it is a click on any point on the map
              if (WindowInformation.locationPanel.isCreateMode()) {
                DevUtil.handleDevMapClick(event.getLatLng());
              }
            }
          }
        });

    dock.add(titleLabel, DockPanel.NORTH);
    dock.add(footerLabel, DockPanel.SOUTH);
    dock.add(loginPanel, DockPanel.EAST);
    dock.add(map, DockPanel.CENTER);

    RootPanel.get().add(dock);

    WindowInformation.dockPanel = dock;
    WindowInformation.loginPanel = loginPanel;
    WindowInformation.treasurePanel = treasurePanel;
    WindowInformation.locationPanel = locationPanel;
    WindowInformation.commsPanel = commsPanel;
    WindowInformation.acceptPanel = acceptPanel;
    WindowInformation.titleLabel = titleLabel;
    WindowInformation.footerLabel = footerLabel;
    WindowInformation.mapWidget = map;
    WindowInformation.refererURL = refererURL;

    String AMTVisitor = Window.Location.getParameter("AMTVisitor");

    if (AMTVisitor == "true") {
      WindowInformation.AMTVisitor = true;
    }

    //		WindowInformation.locationInformationWindow = new LocationInformationWindow();
    //		WindowInformation.tradeWindow = new TradeWindow();
    //		WindowInformation.locationInformationWindow.setVisible(true);
    //		WindowInformation.tradeWindow.setVisible(true);

    WindowInformation.loginPanel.select();
    WindowInformation.loginPanel.maybeLoginThroughCookies();
  }
  protected void layoutCalendar() {
    calendarGrid.clear();
    calendarGrid.setCellSpacing(0);
    for (int i = 0, row = -2, col = 0; i < simpleDatePickers.size(); i++) {
      if ((i % monthColumns) == 0) {
        col = 0;
        row += 2;
      } else if (i > 0) {
        calendarGrid.setHTML(row, col, "&nbsp;");
        calendarGrid.setHTML(row + 1, col, "&nbsp;");
        calendarGrid.getCellFormatter().addStyleName(row, col, StyleMonthSeparator);
        calendarGrid.getCellFormatter().addStyleName(row + 1, col, StyleMonthSeparator);
        col += 1;
      }

      if (monthSelectorHeader.getParent() == null || simpleDatePickers.size() > 1) {
        if (i == 0 || (i % monthColumns) == 0) {
          calendarGrid.getRowFormatter().addStyleName(row, StyleMonthLabels);
          calendarGrid.getRowFormatter().addStyleName(row + 1, StyleMonthCell);
        }
        Widget w = null;
        if (i == 0 && monthSelectorHeader.getElement().getParentElement() == null)
          w = monthSelectorHeader;
        // calendarGrid.setWidget(row, col, monthSelectorHeader);
        else w = monthHeaders.get(i);
        // calendarGrid.setWidget(row, col, monthHeaders.get(i));

        DockPanel p = null;
        if (leftButtons.iterator().hasNext() && leftButtons.getParent() == null && col == 0) {
          p = leftButtons;
          p.add(w, DockPanel.WEST);
          p.setCellWidth(w, "100%");
          w = p;
          if (simpleDatePickers.size() == 1) {
            Iterator<Widget> it = p.iterator();
            while (it.hasNext()) {
              p.add(it.next(), DockPanel.WEST);
            }
          }
        }
        if (rightButtons.iterator().hasNext()
            && rightButtons.getParent() == null
            && ((i + 1) % monthColumns) == 0) {
          p = rightButtons;
          p.add(w, DockPanel.WEST);
          p.setCellWidth(w, "100%");
          w = p;
        }
        calendarGrid.setWidget(row, col, w);
      }

      calendarGrid.setWidget(row + 1, col, simpleDatePickers.get(i));
      calendarGrid.getColumnFormatter().addStyleName(i, "Month-" + i);
      simpleDatePickers.get(i).addValueChangeHandler(onDaySelected);
      col++;
    }
  }
  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));
    }
  }
  /**
   * 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");
  }
示例#25
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);
              }
            });
  }
示例#26
0
  /*
   * (non-Javadoc)
   *
   * @see org.mobicents.slee.container.management.console.client.common.CommonControl#onHide()
   */
  public void onHide() {

    display.clear();
  }
  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;
  }
    TrustActionEditFields() {
      setText(elements.project());
      FlexTable edittable = new FlexTable();
      edittable.setStyleName("edittable");

      edittable.setText(0, 0, elements.trust());
      trustBox = new ListBoxWithErrorText("trust");
      trustActionCache.fillTrustList(trustBox.getListbox());
      edittable.setWidget(0, 1, trustBox);

      edittable.setText(1, 0, elements.description());
      descBox = new TextBoxWithErrorText("description");
      descBox.setMaxLength(40);
      descBox.setVisibleLength(40);
      edittable.setWidget(1, 1, descBox);

      edittable.setText(2, 0, elements.trust_default_desc());
      defaultDescBox = new TextBoxWithErrorText("trust_default_desc");
      defaultDescBox.setMaxLength(50);
      defaultDescBox.setVisibleLength(50);
      edittable.setWidget(2, 1, defaultDescBox);

      edittable.setText(3, 0, elements.trust_actionclub());
      actionClubBox = new ListBox();
      addDebetKredit(actionClubBox);
      edittable.setWidget(3, 1, actionClubBox);

      edittable.setText(4, 0, elements.trust_actiontrust());
      actionTrustBox = new ListBox();
      addDebetKredit(actionTrustBox);
      edittable.setWidget(4, 1, actionTrustBox);

      edittable.setText(5, 0, elements.trust_creditpost());
      HorizontalPanel hpcred = new HorizontalPanel();

      HTML errorAccountCredHtml = new HTML();
      accountCredIdBox = new TextBoxWithErrorText("account", errorAccountCredHtml);
      accountCredIdBox.setVisibleLength(6);
      accountCredNameBox = new ListBox();
      accountCredNameBox.setVisibleItemCount(1);

      hpcred.add(accountCredIdBox);
      hpcred.add(accountCredNameBox);
      hpcred.add(errorAccountCredHtml);

      PosttypeCache.getInstance(constants, messages).fillAllPosts(accountCredNameBox);
      Util.syncListbox(accountCredNameBox, accountCredIdBox.getTextBox());

      edittable.setWidget(5, 1, hpcred);

      edittable.setText(6, 0, elements.trust_debetpost());
      HorizontalPanel hpdeb = new HorizontalPanel();

      HTML errorAccountDebHtml = new HTML();
      accountDebIdBox = new TextBoxWithErrorText("account", errorAccountDebHtml);
      accountDebIdBox.setVisibleLength(6);
      accountDebNameBox = new ListBox();
      accountDebNameBox.setVisibleItemCount(1);

      hpdeb.add(accountDebIdBox);
      hpdeb.add(accountDebNameBox);
      hpdeb.add(errorAccountDebHtml);

      PosttypeCache.getInstance(constants, messages).fillAllPosts(accountDebNameBox);
      Util.syncListbox(accountDebNameBox, accountDebIdBox.getTextBox());

      edittable.setWidget(6, 1, hpdeb);

      DockPanel dp = new DockPanel();
      dp.add(edittable, DockPanel.NORTH);

      saveButton = new NamedButton("projectEditView_saveButton", elements.save());
      saveButton.addClickHandler(this);
      cancelButton = new NamedButton("projectEditView_cancelButton", elements.cancel());
      cancelButton.addClickHandler(this);

      mainErrorLabel = new HTML();
      mainErrorLabel.setStyleName("error");

      HorizontalPanel buttonPanel = new HorizontalPanel();
      buttonPanel.add(saveButton);
      buttonPanel.add(cancelButton);
      buttonPanel.add(mainErrorLabel);
      dp.add(buttonPanel, DockPanel.NORTH);
      setWidget(dp);
    }
示例#29
0
  @Override
  public void onModuleLoad() {
    chatService = GWT.create(ChatService.class);
    chatService.getUsername(
        new AsyncCallback<String>() {
          @Override
          public void onSuccess(String username) {
            if (username == null) {
              showLogonDialog();
            } else {
              loggedOn(username);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            output(caught.toString(), "red");
            // assume they are not logged in
            showLogonDialog();
          }
        });

    FlowPanel controls = new FlowPanel();
    final ListBox status = new ListBox();
    for (Status s : Status.values()) {
      status.addItem(s.name());
    }
    status.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            setStatus(Status.values()[status.getSelectedIndex()]);
          }
        });

    final TextBox input = new TextBox();
    Button send =
        new Button(
            "Send",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                sendMessage(input.getValue());
              }
            });
    Button logout =
        new Button(
            "Logout",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                logout();
              }
            });

    controls.add(status);
    controls.add(input);
    controls.add(send);
    controls.add(logout);

    DockPanel dockPanel = new DockPanel();
    messages = new HTML();
    scrollPanel = new ScrollPanel();
    scrollPanel.setHeight("250px");
    scrollPanel.add(messages);
    dockPanel.add(scrollPanel, DockPanel.CENTER);
    dockPanel.add(controls, DockPanel.SOUTH);

    RootPanel.get().add(dockPanel);
  }
  /** @wbp.parser.constructor */
  public VisualBookPanel(AnnotationClient annotationin, Image imagein) {
    super(false);

    Yo = this;

    annotation = annotationin;
    image = imagein;
    DockPanel SP = new DockPanel();

    setHTML(
        ActualState.getReadingActivityBook().getTitle()
            + "    -    "
            + ActualState.getLanguage().getPage()
            + ": "
            + annotation.getPageNumber());

    setWidget(SP);

    setWidget(SP);

    MenuBar menuBar = new MenuBar(false);
    SP.add(menuBar, DockPanel.NORTH);

    MenuItem mntmNewItem =
        new MenuItem(
            "New item",
            false,
            new Command() {
              public void execute() {
                Yo.hide();
              }
            });
    mntmNewItem.setHTML(ActualState.getLanguage().getClose());
    menuBar.addItem(mntmNewItem);

    MenuItem mntmNewItem_1 =
        new MenuItem(
            "New item",
            false,
            new Command() {
              public void execute() {
                Yo.hide();
                MainEntryPoint.setCurrentPageNumber(annotation.getPageNumber());
                MainEntryPoint.setFiltro(
                    Browser.getFiltroResidual(),
                    new ArrayList<UserClient>(),
                    new ArrayList<String>(),
                    new ArrayList<Long>());
                Controlador.change2Reader();
              }
            });
    mntmNewItem_1.setHTML(ActualState.getLanguage().getGO_To_Page());
    menuBar.addItem(mntmNewItem_1);

    //		MenuItem mntmShowSelection = new MenuItem(ActualUser.getLanguage().getComment_Area(), false,
    // new Command() {
    //			public void execute() {
    //				SE=new ArrayList<SelectorPanel>();
    //				for (TextSelectorClient TS : annotation.getTextSelectors()) {
    //
    //					SelectorPanel SEE = new SelectorPanel(TS.getX().intValue(),
    //							TS.getY().intValue(),
    //			                image.getAbsoluteLeft(), image.getAbsoluteTop(),
    //			                TS.getWidth().intValue(),
    //			                TS.getHeight().intValue());
    //			        SEE.show();
    //			        SE.add(SEE);
    //				}
    //			}
    //		});
    //	menuBar.addItem(mntmShowSelection);

    SP.add(image, DockPanel.SOUTH);

    image.addLoadHandler(
        new LoadHandler() {
          public void onLoad(LoadEvent event) {
            Image I = (Image) event.getSource();
            float He = I.getHeight();
            float Wi = I.getWidth();
            float prop = He / 830;
            float Winew = (Wi / prop);
            image.setSize(Winew + "px", "830px");
            // Window.alert("Altura: " + He + "Ancho: " + Wi );
          }
        });
  }