Esempio n. 1
0
 private void addNavItems(LHSNavItem... items) {
   int i = 0;
   int height = 25;
   for (LHSNavItem navItem : items) {
     layout.add(navItem);
     layout.setWidgetTopHeight(navItem, i * height, Style.Unit.PX, height, Style.Unit.PX);
     i++;
   }
 }
Esempio n. 2
0
 @Override
 public void onMouseMove(MouseMoveEvent event) {
   parent.setWidgetTopHeight(widget, event.getClientY() - offsetY, Unit.PX, height, Unit.PX);
   parent.setWidgetLeftWidth(widget, event.getClientX() - offsetX, Unit.PX, width, Unit.PX);
   parent.forceLayout();
   if (mouseMoveHandler != null) {
     mouseMoveHandler.onMouseMove(event);
   }
 }
Esempio n. 3
0
    public UI() {
      DockLayoutPanel dockLayoutPanel = new DockLayoutPanel(Unit.PX);

      LayoutPanel northPanel = new LayoutPanel();

      this.topLabel = new Label();
      topLabel.setStyleName("cc-problemName", true);
      northPanel.add(topLabel);
      northPanel.setWidgetTopHeight(topLabel, 0.0, Unit.PX, 22.0, Unit.PX);
      northPanel.setWidgetLeftRight(topLabel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX);

      this.pageNavPanel = new PageNavPanel();
      northPanel.add(pageNavPanel);
      northPanel.setWidgetTopHeight(pageNavPanel, 0.0, Unit.PX, PageNavPanel.HEIGHT_PX, Unit.PX);
      northPanel.setWidgetRightWidth(pageNavPanel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX);

      dockLayoutPanel.addNorth(northPanel, PageNavPanel.HEIGHT_PX);

      LayoutPanel southPanel = new LayoutPanel();

      this.statusMessageView = new StatusMessageView();
      southPanel.add(statusMessageView);
      southPanel.setWidgetTopBottom(statusMessageView, 0.0, Unit.PX, 0.0, Unit.PX);
      southPanel.setWidgetLeftRight(statusMessageView, 0.0, Unit.PX, 0.0, Unit.PX);

      dockLayoutPanel.addSouth(southPanel, StatusMessageView.HEIGHT_PX);

      this.userProgressView = new UserProgressView();
      userProgressView.setViewSubmissionsCallback(
          new ICallback<Problem>() {
            @Override
            public void call(Problem value) {
              // Set the Problem. (The UserSelection should already be in the session.)
              getSession().add(value);

              // Switch to UserProblemSubmissionsPage
              getSession().get(PageStack.class).push(PageId.USER_PROBLEM_SUBMISSIONS);
            }
          });
      dockLayoutPanel.add(userProgressView);

      initWidget(dockLayoutPanel);
    }
Esempio n. 4
0
    PageSelectorItem(final WizardPageInfo pageInfo, ClickHandler clickHandler) {
      WizardResources res = WizardResources.INSTANCE;
      WizardResources.Styles styles = res.styles();

      LayoutPanel layoutPanel = new LayoutPanel();
      layoutPanel.addStyleName(styles.wizardPageSelectorItem());

      ImageResource pageImageResource = pageInfo.getImage();
      Image image = null;
      if (pageImageResource != null) {
        image = new Image(pageImageResource);
        layoutPanel.add(image);
        layoutPanel.setWidgetLeftWidth(image, 10, Unit.PX, image.getWidth(), Unit.PX);
        layoutPanel.setWidgetTopHeight(
            image, 40 - (image.getHeight() / 2), Unit.PX, image.getHeight(), Unit.PX);
      }

      FlowPanel captionPanel = new FlowPanel();
      Label titleLabel = new Label(pageInfo.getTitle());
      titleLabel.addStyleName(styles.headerLabel());
      captionPanel.add(titleLabel);
      Label subTitleLabel = new Label(pageInfo.getSubTitle());
      subTitleLabel.addStyleName(styles.subcaptionLabel());
      captionPanel.add(subTitleLabel);
      layoutPanel.add(captionPanel);
      layoutPanel.setWidgetLeftWidth(
          captionPanel, 10 + (image == null ? 0 : image.getWidth()) + 12, Unit.PX, 450, Unit.PX);
      layoutPanel.setWidgetTopHeight(captionPanel, 19, Unit.PX, 55, Unit.PX);

      Image arrowImage = new Image(res.wizardDisclosureArrow());
      layoutPanel.add(arrowImage);
      layoutPanel.setWidgetRightWidth(arrowImage, 20, Unit.PX, arrowImage.getWidth(), Unit.PX);
      layoutPanel.setWidgetTopHeight(
          arrowImage, 40 - (arrowImage.getHeight() / 2), Unit.PX, arrowImage.getHeight(), Unit.PX);

      layoutPanel.addDomHandler(clickHandler, ClickEvent.getType());

      initWidget(layoutPanel);
    }
Esempio n. 5
0
  public void attachWidgetToMouse(
      MouseDownEvent event,
      Widget w,
      MouseMoveHandler mouseMoveHandler,
      MouseUpHandler mouseUpHandler) {
    this.mouseMoveHandler = mouseMoveHandler;
    this.mouseUpHandler = mouseUpHandler;
    if (widget == w) return;

    clearWidgetFromMouse();
    widget = w;

    if (widget != null) {
      height = w.getOffsetHeight();
      width = w.getOffsetWidth();
      offsetX = event.getRelativeX(w.getElement());
      offsetY = event.getRelativeY(w.getElement());
      parent.add(widget);
      parent.setWidgetTopHeight(widget, event.getClientY() - offsetY, Unit.PX, height, Unit.PX);
      parent.setWidgetLeftWidth(widget, event.getClientX() - offsetX, Unit.PX, width, Unit.PX);
      attachHandlers();
    }
  }
Esempio n. 6
0
  public Widget asWidget() {

    LayoutPanel layout = new LayoutPanel();

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);

    layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

    // ---

    HorizontalPanel horzPanel = new HorizontalPanel();
    horzPanel.getElement().setAttribute("style", "width:100%;");
    Image image = new Image(Icons.INSTANCE.messaging());
    horzPanel.add(image);
    horzPanel.add(new ContentHeaderLabel("JMS Subsystem Configuration"));
    image.getElement().getParentElement().setAttribute("width", "25");

    panel.add(horzPanel);

    // ----

    panel.add(new ContentGroupLabel("Connection Factories"));

    factoryTable = new DefaultCellTable<ConnectionFactory>(10);

    Column<ConnectionFactory, String> nameColumn =
        new Column<ConnectionFactory, String>(new TextCell()) {
          @Override
          public String getValue(ConnectionFactory object) {
            return object.getName();
          }
        };

    Column<ConnectionFactory, String> jndiColumn =
        new Column<ConnectionFactory, String>(new TextCell()) {
          @Override
          public String getValue(ConnectionFactory object) {
            return object.getJndiName();
          }
        };

    factoryTable.addColumn(nameColumn, "Name");
    factoryTable.addColumn(jndiColumn, "JNDI");

    StaticHelpPanel helpPanel = new StaticHelpPanel(MessagingDescription.getFactoryDescription());

    panel.add(helpPanel.asWidget());

    panel.add(factoryTable);

    // ----

    panel.add(new ContentGroupLabel("Subresources"));
    TabPanel bottomLayout = new TabPanel();
    bottomLayout.addStyleName("default-tabpanel");
    bottomLayout.getElement().setAttribute("style", "padding-top:20px;");

    queueList = new QueueList(presenter);
    bottomLayout.add(queueList.asWidget(), "Queues");

    topicList = new TopicList(presenter);
    bottomLayout.add(topicList.asWidget(), "Topics");

    bottomLayout.selectTab(0);

    panel.add(bottomLayout);

    return layout;
  }
Esempio n. 7
0
  @Override
  public Widget createWidget() {
    LayoutPanel layout = new LayoutPanel();

    FakeTabPanel titleBar = new FakeTabPanel("Socket Binding Groups");
    layout.add(titleBar);

    ToolStrip toolstrip = new ToolStrip();
    toolstrip.addToolButtonRight(
        new ToolButton(
            "Add",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewSocketDialogue();
              }
            }));

    layout.add(toolstrip);

    // -----------
    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ContentHeaderLabel nameLabel = new ContentHeaderLabel("Socket Binding Declarations");

    HorizontalPanel horzPanel = new HorizontalPanel();
    horzPanel.getElement().setAttribute("style", "width:100%;");
    // Image image = new Image(Icons.INSTANCE.deployment());
    // horzPanel.add(image);
    // image.getElement().getParentElement().setAttribute("width", "25");

    horzPanel.add(nameLabel);

    panel.add(horzPanel);

    socketTable = new SocketTable();

    HorizontalPanel tableOptions = new HorizontalPanel();
    tableOptions.getElement().setAttribute("cellpadding", "2px");

    groupFilter = new ComboBox();
    groupFilter.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            presenter.onFilterGroup(event.getValue());
          }
        });
    Widget groupFilterWidget = groupFilter.asWidget();
    groupFilterWidget.getElement().setAttribute("style", "width:200px;");

    tableOptions.add(new Label("Socket Binding Group:"));
    tableOptions.add(groupFilterWidget);

    tableOptions.getElement().setAttribute("style", "float:right;");
    panel.add(tableOptions);
    DefaultCellTable socketTableWidget = socketTable.asWidget();
    panel.add(socketTableWidget);

    DefaultPager pager = new DefaultPager();
    pager.setPage(0);
    pager.setPageSize(6);
    pager.setDisplay(socketTableWidget);
    panel.add(pager);

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);

    layout.setWidgetTopHeight(titleBar, 0, Style.Unit.PX, 26, Style.Unit.PX);
    layout.setWidgetTopHeight(toolstrip, 26, Style.Unit.PX, 30, Style.Unit.PX);
    layout.setWidgetTopHeight(scroll, 56, Style.Unit.PX, 100, Style.Unit.PCT);

    // -----------

    ToolStrip detailToolStrip = new ToolStrip();
    editBtn = new ToolButton(Console.CONSTANTS.common_label_edit());
    ClickHandler editHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            SocketBinding editedEntity = form.getEditedEntity();
            if (editBtn.getText().equals(Console.CONSTANTS.common_label_edit())) {
              presenter.editSocketBinding(editedEntity);
            } else {
              presenter.saveSocketBinding(
                  editedEntity.getName(), editedEntity.getGroup(), form.getChangedValues());
            }
          }
        };
    editBtn.addClickHandler(editHandler);
    detailToolStrip.addToolButton(editBtn);

    ClickHandler clickHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            SocketBinding socket = form.getEditedEntity();

            Feedback.confirm(
                "Delete Socket Binding",
                "Really delete this socket binding '" + socket.getName() + "' ?",
                new Feedback.ConfirmationHandler() {
                  @Override
                  public void onConfirmation(boolean isConfirmed) {
                    if (isConfirmed) {
                      presenter.onDelete(form.getEditedEntity());
                    }
                  }
                });
          }
        };
    ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
    deleteBtn.addClickHandler(clickHandler);
    detailToolStrip.addToolButton(deleteBtn);

    panel.add(new ContentGroupLabel("Socket Binding"));

    panel.add(detailToolStrip);
    // ---

    form = new Form<SocketBinding>(SocketBinding.class);
    form.setNumColumns(2);

    TextItem nameItem = new TextItem("name", "Name");
    TextItem interfaceItem = new TextItem("interface", "Interface");
    NumberBoxItem portItem = new NumberBoxItem("port", "Port");
    TextBoxItem multicastItem = new TextBoxItem("multiCastAddress", "Multicast Address");
    NumberBoxItem multicastPortItem = new NumberBoxItem("multiCastPort", "Multicast Port");

    form.setFields(nameItem, interfaceItem, portItem, multicastItem, multicastPortItem);
    form.bind(socketTable.getCellTable());

    Widget formWidget = form.asWidget();
    form.setEnabled(false);

    final FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = new ModelNode();
                address.add("socket-binding-group", form.getEditedEntity().getGroup());
                address.add("socket-binding", "*");
                return address;
              }
            },
            form);
    panel.add(helpPanel.asWidget());

    panel.add(formWidget);

    // ------------------------------------------

    return layout;
  }
Esempio n. 8
0
  public SongView() {
    LayoutPanel panel = new LayoutPanel();
    initWidget(panel);

    InlineLabel songNameLabel = new InlineLabel("Song name:");
    panel.add(songNameLabel);
    panel.setWidgetLeftWidth(songNameLabel, 0.0, Unit.PX, 90.0, Unit.PX);
    panel.setWidgetTopHeight(songNameLabel, 55.0, Unit.PX, 18.0, Unit.PX);

    songNameDisplayLabel = new InlineLabel("");
    panel.add(songNameDisplayLabel);
    panel.setWidgetLeftWidth(songNameDisplayLabel, 109.0, Unit.PX, 311.0, Unit.PX);
    panel.setWidgetTopHeight(songNameDisplayLabel, 55.0, Unit.PX, 18.0, Unit.PX);

    final TextBox searchBox = new TextBox();
    panel.add(searchBox);
    panel.setWidgetLeftWidth(searchBox, 96.0, Unit.PX, 173.0, Unit.PX);
    panel.setWidgetTopHeight(searchBox, 0.0, Unit.PX, 34.0, Unit.PX);

    InlineLabel searchBoxLabel = new InlineLabel("Search Song:");
    panel.add(searchBoxLabel);
    panel.setWidgetLeftWidth(searchBoxLabel, 0.0, Unit.PX, 90.0, Unit.PX);
    panel.setWidgetTopHeight(searchBoxLabel, 0.0, Unit.PX, 18.0, Unit.PX);

    Button searchButton = new Button("Search");
    searchButton.setText("Search");
    panel.add(searchButton);
    panel.setWidgetLeftWidth(searchButton, 275.0, Unit.PX, 81.0, Unit.PX);
    panel.setWidgetTopHeight(searchButton, 4.0, Unit.PX, 30.0, Unit.PX);

    Button BackButton = new Button("Back");
    panel.add(BackButton);
    panel.setWidgetLeftWidth(BackButton, 369.0, Unit.PX, 81.0, Unit.PX);
    panel.setWidgetTopHeight(BackButton, 0.0, Unit.PX, 30.0, Unit.PX);

    BackButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            TabberWebApp.setView(new MainView());
          }
        });

    searchButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            String songName = searchBox.getText();
            RPC.songService.findSong(
                "username",
                songName,
                new AsyncCallback<Song>() {

                  @Override
                  public void onSuccess(Song result) {
                    // Display the song in the view
                    setModel(result);
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    Util.alertWidget("Error", "Could not load song: " + caught.getMessage())
                        .center();
                  }
                });
          }
        });

    //		searchBox.addKeyPressHandler(new KeyPressHandler() {
    //
    //		      public void onKeyPress(KeyPressEvent event) {
    //		        if (!Character.isDigit(event.getCharCode())) {
    //		          ((TextBox) event.getSource()).cancelKey();
    //		        }
    //		      }
    //		    });
    //
    //
  }
    public UI() {
      SplitLayoutPanel panel = new SplitLayoutPanel();

      // North panel has username/problem name, page nav panel,
      // and slider to select the user's submissions.
      LayoutPanel northPanel = new LayoutPanel();

      this.usernameAndProblemLabel = new Label("");
      usernameAndProblemLabel.setStyleName("cc-problemName", true);
      northPanel.add(usernameAndProblemLabel);
      northPanel.setWidgetLeftRight(
          usernameAndProblemLabel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX);
      northPanel.setWidgetTopHeight(usernameAndProblemLabel, 0.0, Unit.PX, 22.0, Unit.PX);

      this.pageNavPanel = new PageNavPanel();
      northPanel.add(pageNavPanel);
      northPanel.setWidgetRightWidth(pageNavPanel, 0.0, Unit.PX, PageNavPanel.WIDTH_PX, Unit.PX);
      northPanel.setWidgetTopHeight(pageNavPanel, 0.0, Unit.PX, PageNavPanel.HEIGHT_PX, Unit.PX);

      this.sliderView = new ProblemSubmissionHistorySliderView();
      northPanel.add(sliderView);
      northPanel.setWidgetTopHeight(
          sliderView,
          PageNavPanel.HEIGHT_PX,
          Unit.PX,
          ProblemSubmissionHistorySliderView.HEIGHT_PX,
          Unit.PX);
      northPanel.setWidgetLeftRight(sliderView, 0.0, Unit.PX, 0.0, Unit.PX);

      panel.addNorth(northPanel, PageNavPanel.HEIGHT_PX + 8.0 + SLIDER_HEIGHT_PX);

      // South panel has status message view, test outcome summary view,
      // and test result view.  TODO: indicate whether or not the sumission compiled.
      LayoutPanel southPanel = new LayoutPanel();

      this.statusMessageView = new StatusMessageView();
      southPanel.add(statusMessageView);
      southPanel.setWidgetLeftRight(
          statusMessageView, 0.0, Unit.PX, TestOutcomeSummaryView.WIDTH_PX, Unit.PX);
      southPanel.setWidgetTopHeight(
          statusMessageView, 0.0, Unit.PX, StatusMessageView.HEIGHT_PX, Unit.PX);

      this.testOutcomeSummaryView = new TestOutcomeSummaryView();
      southPanel.add(testOutcomeSummaryView);
      southPanel.setWidgetRightWidth(
          testOutcomeSummaryView, 0.0, Unit.PX, TestOutcomeSummaryView.WIDTH_PX, Unit.PX);
      southPanel.setWidgetTopHeight(
          testOutcomeSummaryView, 0.0, Unit.PX, TestOutcomeSummaryView.HEIGHT_PX, Unit.PX);

      this.testResultListView = new TestResultListView();
      southPanel.add(testResultListView);
      southPanel.setWidgetLeftRight(testResultListView, 0.0, Unit.PX, 0.0, Unit.PX);
      southPanel.setWidgetTopBottom(
          testResultListView, TestOutcomeSummaryView.HEIGHT_PX, Unit.PX, 0.0, Unit.PX);

      panel.addSouth(southPanel, 200.0);

      // Center panel has a ReadOnlyProblemTextView
      this.problemTextView = new ReadOnlyProblemTextView();
      panel.add(problemTextView);

      initWidget(panel);
    }
  public Widget asWidget() {

    LayoutPanel layout = new LayoutPanel();
    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("rhs-content-panel");

    ScrollPanel scroll = new ScrollPanel(panel);
    layout.add(scroll);

    layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

    serverName = new HTML("Replace me");
    serverName.setStyleName("content-header-label");

    panel.add(serverName);
    panel.add(new ContentDescription(Console.CONSTANTS.subsys_messaging_jms_provider_desc()));

    form = new Form(MessagingProvider.class);
    form.setNumColumns(2);

    CheckBoxItem persistenceItem = new CheckBoxItem("persistenceEnabled", "Persistence enabled?");
    CheckBoxItem securityItem = new CheckBoxItem("securityEnabled", "Security enabled?");
    CheckBoxItem messageCounterItem =
        new CheckBoxItem("messageCounterEnabled", "Message Counter enabled?");

    // TextItem connector = new TextItem("connectorBinding", "Connector Binding");
    // TextItem acceptor = new TextItem("acceptorBinding", "Acceptor Binding");

    form.setFields(persistenceItem, securityItem, messageCounterItem);
    // form.setFieldsInGroup("Connections", new DisclosureGroupRenderer(), acceptor, connector);

    FormToolStrip<MessagingProvider> toolStrip =
        new FormToolStrip<MessagingProvider>(
            form,
            new FormToolStrip.FormCallback<MessagingProvider>() {
              @Override
              public void onSave(Map<String, Object> changeset) {
                presenter.onSaveProviderConfig(changeset);
              }

              @Override
              public void onDelete(MessagingProvider entity) {}
            });
    toolStrip.providesDeleteOp(false);

    panel.add(toolStrip.asWidget());

    FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = Baseadress.get();
                address.add("subsystem", "messaging");
                address.add("hornetq-server", "*");
                return address;
              }
            },
            form);

    panel.add(helpPanel.asWidget());
    Widget formWidget = form.asWidget();
    panel.add(formWidget);

    formWidget.getElement().setAttribute("style", "padding-bottom:20px;");

    // ------

    TabPanel bottomLayout = new TabPanel();
    bottomLayout.addStyleName("default-tabpanel");

    secDetails = new SecurityDetails(presenter);
    bottomLayout.add(secDetails.asWidget(), "Security");

    addrDetails = new AddressingDetails(presenter);
    bottomLayout.add(addrDetails.asWidget(), "Addressing");

    bottomLayout.selectTab(0);

    panel.add(bottomLayout);
    bottomLayout.getElement().setAttribute("style", "padding-top:10px");

    return layout;
  }