示例#1
0
  @Override
  protected Widget createMainWidget() {
    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName(ThemeStyles.INSTANCE.fileUploadPanel());

    // directory panel
    HorizontalPanel directoryPanel = new HorizontalPanel();
    directoryPanel.setWidth("100%");
    directoryPanel.setStyleName(ThemeStyles.INSTANCE.fileUploadField());

    // directory name (informational field)
    panel.add(new Label("Target directory:"));
    directoryNameWidget_ = new DirectoryNameWidget();
    directoryNameWidget_.setDirectory(targetDirectory_);
    directoryPanel.add(directoryNameWidget_);

    // browse directory button
    // JJA: removed browse button (was causing confusion for users who
    // thought it was what they should press to browse local files)
    /*
    Button browseButton = new Button("Browse...",
                                     new BrowseDirectoryClickHandler());
    browseButton.getElement().getStyle().setMarginRight(5, Unit.PX);
    directoryPanel.add(browseButton);
    directoryPanel.setCellHorizontalAlignment(
                                        browseButton,
                                        HasHorizontalAlignment.ALIGN_RIGHT);
    */
    panel.add(directoryPanel);

    // filename field
    panel.add(new Label("File to upload:"));
    fileUpload_ = new FileUpload();
    fileUpload_.setStyleName(ThemeStyles.INSTANCE.fileUploadField());
    fileUpload_.setName("file");
    panel.add(fileUpload_);

    // zip file tip field
    HTML tip =
        new HTML(
            "<b>TIP</b>: To upload multiple files or a "
                + "directory, create a zip file. The zip file will "
                + "be automatically expanded after upload.");
    tip.addStyleName(ThemeStyles.INSTANCE.fileUploadField());
    tip.addStyleName(ThemeStyles.INSTANCE.fileUploadTipLabel());
    panel.add(tip);

    // target directory hidden field
    targetDirectoryHidden_ = new Hidden("targetDirectory", targetDirectory_.getPath());
    panel.add(targetDirectoryHidden_);

    return panel;
  }
示例#2
0
 public MeasureNameLabel() {
   FlowPanel measureNamePanel = new FlowPanel();
   HTML measureLabel = new HTML("Measure:&nbsp");
   measureLabel.addStyleName("bold");
   measureLabel.addStyleName("measureLabel");
   measureName.addStyleName("measureName");
   measureNamePanel.add(measureLabel);
   measureNamePanel.add(measureName);
   SimplePanel clearBoth = new SimplePanel();
   clearBoth.addStyleName("clearBoth");
   measureNamePanel.add(clearBoth);
   measureNamePanel.add(new SpacerWidget());
   measureNamePanel.add(new SpacerWidget());
   initWidget(measureNamePanel);
 }
示例#3
0
 public void setDisplayValue(boolean display) {
   if (display) {
     _label.removeStyleName("Hide");
   } else {
     _label.addStyleName("Hide");
   }
 }
示例#4
0
  /** Initializes all necessary objects. */
  private void init() {
    if (!initialized) {
      initialized = true;

      R.css.cssLoginBox().ensureInjected();
      addStyleName("loginPanel");

      htmlFEVersionInfo = new HTML(SoPeCoUI.getBuildInfo());
      htmlFEVersionInfo.addStyleName("htmlFEVersionInfo");

      logoPanel = new FlowPanel();

      createLanguagePanel();

      verticalCell = new SimplePanel();

      createAccount = new CreateAccount(this);
      loginView = new LoginView(this);

      verticalCell.add(loginView);
      add(verticalCell);
      add(htmlFEVersionInfo);
      add(logoPanel);

      BrandingChecker.checkBranding(this);
    }
  }
示例#5
0
  @Override
  protected Widget getContent() {

    VerticalPanel panel = new VerticalPanel();
    Paragraph introduction =
        new Paragraph(
            "Vous trouverez ci-dessous une"
                + " liste de questions que vous pourriez vous poser à propos de"
                + " cette application.");
    introduction.addStyleName("indent");
    panel.add(introduction);

    DecoratedStackPanel stackPanel = new DecoratedStackPanel();
    panel.add(stackPanel);

    String question;
    HTML answer;
    String header;
    String image = new String();
    FAQResourcesBundle resources = GWT.create(FAQResourcesBundle.class);
    XMLReader xml = new XMLReader(resources.FAQ());

    for (int i = 0; i < xml.getLength(); ++i) {
      question = new String(xml.getQuestion(i));
      answer = new HTML(xml.getAnswer(i));
      answer.addStyleName("justify");
      image = xml.getImage(i);
      header = new String(getHeaderString(question, this.getImage(image)));
      stackPanel.add(answer, header, true);
    }

    return panel;
  }
示例#6
0
 public void setEnabled(boolean b) {
   this.isEnabled = b;
   if (isEnabled) {
     currentValue.removeStyleName("combobox-value-disabled");
   } else {
     currentValue.addStyleName("combobox-value-disabled");
   }
 }
示例#7
0
 private void addDropZone(Album a_Parent, Item a_CompareTo, boolean a_Before) {
   HTML drop = new HTML();
   drop.addStyleName("DropZone");
   DropZoneController dzp = new DropZoneController(a_Parent, drop, a_CompareTo, a_Before);
   m_Container.getDragController().registerDropController(dzp);
   m_DropZones.add(dzp);
   addToView(drop);
 }
示例#8
0
  public static void tip(String message, UIObject target) {
    HTML messageLabel = new HTML(message);
    messageLabel.addStyleName("content");

    PopupPanel tip = new DecoratedPopupPanel(true);
    tip.addStyleName("tip-box");
    tip.setWidget(messageLabel);
    tip.showRelativeTo(target);
  }
示例#9
0
  public void addLink(String text, ClickHandler handler) {

    HTML html = new HTML();
    html.setHTML("<a href='javascript:void(0)'>" + text + "</a>");

    html.addClickHandler(handler);
    html.addStyleName("link-bar");

    if (numLinks == 0) {
      html.addStyleName("link-bar-first");
    }

    links.add(html);

    bar.add(html);

    numLinks++;
  }
示例#10
0
          @Override
          public void run() {
            isCaretShown = !isCaretShown;
            if (isCaretShown) {
              html.removeStyleName("caretHidden");
            } else {
              html.addStyleName("caretHidden");
            }

            schedule(600);
          }
示例#11
0
  private void displayNotification(final Message message) {

    String actualMessage =
        message.getConciseMessage().length() > 40
            ? message.getConciseMessage().substring(0, 40) + " ..."
            : message.getConciseMessage();

    displayPopup = new DefaultPopup(DefaultPopup.Arrow.RIGHTTOP);

    final HTML label = new HTML(message.getSeverity().getTag() + "&nbsp;" + actualMessage);

    label.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent clickEvent) {
            if (message.isSticky()) {
              MessageCenterView.this.lastSticky = null;
            }
            messageDisplay.clear();
            displayPopup.hide();
            showDetail(message);
          }
        });

    label.addStyleName("notification-display");
    final String css = getSeverityStyle(message.severity);
    label.addStyleName(css);

    displayPopup.setWidget(label);

    int width = 250;
    int height = 16;

    displayPopup.setPopupPosition(
        messageButton.getAbsoluteLeft() - (width + 2 - messageButton.getOffsetWidth() + 85),
        messageButton.getAbsoluteTop() - 2);

    displayPopup.show();

    displayPopup.setWidth(width + "px");
    displayPopup.setHeight(height + "px");
  }
  /**
   * The constructor sets up the UI and passes the data fetching parameters to the sub widgets
   *
   * @param service
   * @param documentID
   * @param instructor
   * @param unsavedDocumentStrategy
   */
  public InstructorPreferencesView(
      CachedOpenWorkingCopyDocument openDocument, InstructorGWT instructor) {
    this.openDocument = openDocument;

    instructor.verify();

    this.instructor = instructor;

    HTML instructorName = new HTML("Instructor Time Preferences");
    instructorName.setStyleName("bigBold");
    DOM.setElementAttribute(instructorName.getElement(), "id", "instructorName");
    InstructorPreferencesView.this.add(instructorName);

    InstructorPreferencesView.this.timePrefs =
        new TimePrefsWidget(
            InstructorPreferencesView.this.openDocument, InstructorPreferencesView.this.instructor);

    InstructorPreferencesView.this.setSpacing(20);

    InstructorPreferencesView.this.add(timePrefs);
    InstructorPreferencesView.this.setStyleName("preferencesPanel");

    InstructorPreferencesView.this.coursePrefs =
        new CoursePrefsWidget(
            InstructorPreferencesView.this.openDocument, InstructorPreferencesView.this.instructor);
    InstructorPreferencesView.this.coursePrefs.setStyleName("otherCenterness");
    InstructorPreferencesView.this.coursePrefs.afterPush();

    HTML cprefs = new HTML("Instructor Course Preferences");
    cprefs.addStyleName("bigBold");
    InstructorPreferencesView.this.add(cprefs);

    InstructorPreferencesView.this.add(coursePrefs);

    closebutton =
        new Button(
            "Close",
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                parent.hide();
              }
            });

    if (additionalCloseHandler != null) {
      closebutton.addClickHandler(additionalCloseHandler);
      additionalCloseHandler = null;
    }
    DOM.setElementAttribute(closebutton.getElement(), "id", "s_prefCloseBtn");
    InstructorPreferencesView.this.add(closebutton);
    InstructorPreferencesView.this.setCellHorizontalAlignment(closebutton, ALIGN_RIGHT);
  }
示例#13
0
  @Override
  public Widget getContent() {
    VerticalPanel panel = new VerticalPanel();

    HTML label = new HTML(message);
    label.addStyleName(CSS_FEEDBACK_MESSAGE);
    panel.add(label);

    commentArea = new TextArea();
    commentArea.setStyleName(CSS_FEEDBACK_COMMENTS);

    panel.add(commentArea);

    return panel;
  }
示例#14
0
  public static void alert(String title, String message) {
    final WebDialog dialog = new WebDialog();
    dialog.addStyleName("alert-box");
    dialog.setAnimationEnabled(true);
    dialog.setClosable(true);
    dialog.setModal(true);
    dialog.setText(title);

    HTML messageLabel = new HTML(message);
    messageLabel.addStyleName("content");

    dialog.setWidget(messageLabel);
    dialog.center();
    dialog.show();
  }
示例#15
0
 /*
  * (non-Javadoc)
  *
  * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object)
  */
 public void setValue(String aValue) {
   if (allowHtml) {
     if (aValue != null && aValue.trim().length() > 0) {
       myHtmlView.setHTML(aValue);
       myHtmlView.removeStyleName("empty_field");
     } else {
       myHtmlView.setText(constants.editValue());
       myHtmlView.addStyleName("empty_field");
     }
   } else {
     if (aValue != null && aValue.trim().length() > 0) {
       myTextView.setText(aValue);
       myTextView.removeStyleName("empty_field");
     } else {
       myTextView.setText(constants.editValue());
       myTextView.addStyleName("empty_field");
     }
   }
 }
  public StartGameScreen(SoundPlayer soundPlayer) {

    HTML joinGameLabel = new HTML("<h3>Games you can play in:</h3>");
    joinGameLabel.addStyleName("heavy");
    content.add(joinGameLabel);

    VerticalPanel indented = new VerticalPanel();
    indented.addStyleName("indented");
    content.add(indented);
    joinableGamesTable.setText(0, 0, "Loading...");
    indented.add(joinableGamesTable);
    content.add(new HTML("<br />"));

    Hyperlink createGameLink =
        new Hyperlink("Create a Game", ScreenControllers.getHistoryToken(Screen.CREATE_GAME));
    soundPlayer.addMenuClick(createGameLink);
    createGameLink.addStyleName("heavy");
    content.add(createGameLink);
  }
  @Override
  public void render(final Context context, final ResultRowModel result, final SafeHtmlBuilder sb) {
    if (result == null) {
      return;
    }

    final StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(
        "<b>Location</b> " + locationConstants.getString(result.getLocation()) + " <br/>");
    stringBuilder.append("<b>Server</b> " + result.getComputeCost() + " (RAM " + result.getRam());
    if (!ZERO_HERTZ.equals(result.getCpu())) {
      stringBuilder.append(" / CPU " + result.getCpu());
    }
    if (!ZERO_BYTE.equals(result.getStorage())) {
      stringBuilder.append(" / Storage " + result.getStorage());
    }
    stringBuilder.append(
        ") <br/> <b>Bandwidth</b> "
            + result.getBandwidthCost()
            + " (In "
            + result.getBandwidthInCost()
            + " / Out "
            + result.getBandwidthOutCost()
            + ")<br/>");
    final HTML config = new HTML(stringBuilder.toString());
    config.addStyleName("cloud-location-config");

    final String link = providerConstants.getString(result.getProviderName() + "_details_site");
    final Anchor anchor = new Anchor(staticConstants.location_details(), link);
    anchor.setTarget("_top");
    anchor.addStyleName("cloud-location-details");

    final FlowPanel panel = new FlowPanel();
    panel.add(config);
    panel.add(anchor);
    panel.addStyleName("cloud-location");
    final DecoratorPanel decPanel = new DecoratorPanel();
    decPanel.setWidget(panel);
    sb.appendHtmlConstant(decPanel.toString());
  }
示例#18
0
  public void init(final KieImageType imageType, final int containersRunningCount) {
    if (imageType == null) return;

    final SafeUri imageUri = ClientUtils.getImageUri(imageType);
    typeNameText.setText(imageType.getName());
    if (containersRunningCount < 0) {
      countText.setVisible(false);
    } else if (containersRunningCount == 0
        && showCreateButton
        && !KieImageCategory.OTHERS.equals(imageType.getCategory())) {
      countText.setText(Constants.INSTANCE.createNew());
      countText.setTitle(Constants.INSTANCE.createNewForThisType());
      countText.addStyleName(style.createNewButton());
      countText.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
              KieImageTypeView.this.fireEvent(new CreateContainerEvent(imageType));
            }
          });
      countText.setVisible(true);
    } else {
      countText.setText(Integer.toString(containersRunningCount));
      countText.removeStyleName(style.createNewButton());
      countText.setVisible(true);
    }

    typeImage.setUrl(imageUri);
    typeImage.setSize(size, size);
    typeImage.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            KieImageTypeView.this.fireEvent(new ImageTypeSelectedEvent(imageType));
          }
        });
    mainPanel.setVisible(true);
  }
示例#19
0
 private void initContent(String aValue) {
   if (allowHtml) {
     myHtmlView = new HTML();
     myHtmlView.setStylePrimaryName("field_htmlview");
     if (aValue != null) {
       myHtmlView.setHTML(aValue);
     } else {
       myHtmlView.setText(constants.editValue());
       myHtmlView.addStyleName("empty_field");
     }
     myOuterPanel.add(myHtmlView);
   } else {
     myTextView = new Label();
     myTextView.setStylePrimaryName("field_view");
     if (aValue != null && aValue.length() > 0) {
       myTextView.setText(aValue);
     } else {
       myTextView.setText(constants.editValue());
       myTextView.addStyleName("empty_field");
     }
     myOuterPanel.add(myTextView);
   }
 }
示例#20
0
  public CriterionHeader(int idx, int cid, String cdesc, float b, int regrid, int regraccepted) {
    this.mainPanel = new VerticalPanel();
    this.mainPanel.addStyleName(Resources.INSTANCE.css().criterionrow());
    this.criterionId = cid;
    this.criterionDescription = cdesc;
    this.index = idx;

    Label lbl = new Label(cdesc);
    lbl.addStyleName(Resources.INSTANCE.css().criterionheader());
    lbl.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (commentId > 0 && commentPage > 0)
              EMarkingWeb.markingInterface
                  .getMarkingPagesInterface()
                  .highlightRubricMark(commentId, commentPage);
          }
        });
    mainPanel.add(lbl);

    HorizontalPanel horizontal = new HorizontalPanel();
    horizontal.addStyleName(Resources.INSTANCE.css().colorsquaretable());

    // the square with the color
    if (EMarkingConfiguration.isColoredRubric()) {
      Label lbl2 = new Label("");
      Color.setWidgetBackgroundHueColor(cid, lbl2);
      lbl2.addStyleName(Resources.INSTANCE.css().colorsquare());
      lbl2.setTitle(String.valueOf(idx));
      // lbl2.addStyleName(MarkingInterface.getMapCss().get("colorsquare"));

      // HTML rectangle = new HTML();
      // rectangle.setHTML("<div data-index='"+idx+"' style='width:20px;	height:20px;border:1px
      // solid #000;' class='"+ MarkingInterface.getMapCss().get("color"+idx) +"
      // "+MarkingInterface.getMapCss().get("colorsquare") + "' ></div>");
      lbl2.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              Label rectangle = (Label) event.getSource();
              int index = Integer.parseInt(rectangle.getTitle());
              EMarkingWeb.markingInterface
                  .getToolbar()
                  .getMarkingButtons()
                  .changeCriterionList(index);
            }
          });
      horizontal.add(lbl2);
    }

    HTML separation = new HTML();
    separation.setHTML("<div style='width:20px;height:20px;'></div>");
    horizontal.add(separation);

    mainPanel.add(horizontal);

    bonusHtml = new HTML();
    setBonus(b);

    mainPanel.add(bonusHtml);

    regradeHtml = new HTML();
    regradeHtml.setVisible(false);

    mainPanel.add(regradeHtml);

    this.setRegradeData(regrid, regraccepted);

    loadingIcon = new HTML();
    loadingIcon.setVisible(false);
    Icon iconloading = new Icon(IconType.COG);
    loadingIcon.setHTML(iconloading.toString());
    loadingIcon.addStyleName(Resources.INSTANCE.css().loadingicon());
    loadingIcon.addStyleName("icon-spin");

    mainPanel.add(loadingIcon);
    mainPanel.setCellHorizontalAlignment(loadingIcon, HasHorizontalAlignment.ALIGN_CENTER);

    initWidget(mainPanel);
  }
示例#21
0
  public DragHandleExample(DemoDragHandler demoDragHandler) {
    addStyleName(CSS_DEMO_DRAG_HANDLE_EXAMPLE);

    // use the boundary panel as this composite's widget
    final AbsolutePanel boundaryPanel = new AbsolutePanel();
    boundaryPanel.setPixelSize(600, 400);
    setWidget(boundaryPanel);

    // create the title bar
    HTML header =
        new HTML(
            "Title/Header (Drag Handle) with <a href='http://google.com/' target='_blank'>link</a>");
    header.addStyleName(CSS_DEMO_DRAG_HANDLE_EXAMPLE_HEADER);

    // add some text
    HTML content =
        new HTML(
            "This is a <code>VerticalPanel</code> which can be dragged by its header,"
                + " i.e. the title/header widget.");

    // add an editable text area
    final TextArea textArea = new TextArea();
    textArea.addStyleName(CSS_DEMO_DRAG_HANDLE_EXAMPLE_TEXTAREA);
    // textArea.setSize("20em", "5em");
    textArea.setText(
        "You can click in this TextArea to get focus without causing the panel to be dragged.");

    // add a clickable button
    Button button = new Button("Click me");
    button.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            textArea.setText(textArea.getText() + " Click!");
          }
        });

    // create a panel to hold all our widgets
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(2);
    verticalPanel.addStyleName(CSS_DEMO_DRAG_HANDLE_EXAMPLE_PANEL);
    verticalPanel.add(header);
    verticalPanel.add(content);
    verticalPanel.add(textArea);
    verticalPanel.add(button);
    boundaryPanel.add(verticalPanel, 20, 20);

    // instantiate our drag controller
    dragController = new PickupDragController(boundaryPanel, true);
    dragController.addDragHandler(demoDragHandler);
    dragController.setBehaviorConstrainedToBoundaryPanel(true);
    dragController.setBehaviorMultipleSelection(false);
    dragController.setBehaviorDragStartSensitivity(5);

    // instantiate our drop controller
    AbsolutePositionDropController dropController =
        new AbsolutePositionDropController(boundaryPanel);
    dragController.registerDropController(dropController);

    // make the panel draggable by its header
    dragController.makeDraggable(verticalPanel, header);
  }
示例#22
0
 private HTML format(String text) {
   HTML html = new HTML(text);
   html.addStyleName(style.section());
   return html;
 }
 public void addInfoMsg() {
   infoMsg = new HTML(DEFAULT_MSG);
   infoMsg.addStyleName("infoMessage");
   RootPanel.get("gwtIntegrationSampleMsg").add(infoMsg);
 }
  private void buildContent(RowData data) {
    grid = new FlexTable();
    grid.setCellSpacing(5);

    HTML html = new HTML("Working Set Name:  ");
    html.addStyleName("color-dark-blue");
    workingSetName = new TextBox();
    grid.setWidget(0, 0, html);
    grid.setWidget(0, 1, workingSetName);
    workingSetName.setSize("95%", "100%");

    html = new HTML("Creator:  ");
    html.addStyleName("color-dark-blue");
    managerHTML = new HTML();
    grid.setWidget(1, 0, html);
    grid.setWidget(1, 1, managerHTML);

    html = new HTML("Date Created:  ");
    html.addStyleName("color-dark-blue");
    dateCreatedHTML = new HTML();
    grid.setWidget(2, 0, html);
    grid.setWidget(2, 1, dateCreatedHTML);

    html = new HTML("Working Set Type:  ");
    html.addStyleName("color-dark-blue");
    workingSetMode = new ListBox(false);
    workingSetMode.insertItem("none selected", 0);
    workingSetMode.insertItem(WorkingSetData.PRIVATE, PRIVATEINDEX);
    workingSetMode.insertItem(WorkingSetData.PUBLIC, PUBLICINDEX);
    workingSetMode.setVisibleItemCount(1);
    workingSetMode.setEnabled(false);
    workingSetMode.setSelectedIndex(PUBLICINDEX);
    grid.setWidget(3, 0, html);
    grid.setWidget(3, 1, workingSetMode);

    html = new HTML("Associated People:  ");
    html.addStyleName("color-dark-blue");
    people = new SISCompleteList(this, 400);
    grid.setWidget(PEOPLECELL, 0, html);
    grid.setWidget(PEOPLECELL, 1, people);

    html = new HTML("Assessment Scope:  ");
    html.addStyleName("color-dark-blue");
    filterPanel = new AssessmentFilterPanel(new AssessmentFilter(), false, true, false, true);
    grid.setWidget(5, 0, html);
    grid.setWidget(5, 1, filterPanel);

    html = new HTML("Description:  ");
    html.addStyleName("color-dark-blue");
    description = new TextArea();
    grid.setWidget(6, 0, html);
    grid.setWidget(6, 1, description);
    description.setSize("95%", "100%");

    html = new HTML("Working Set Notes: ");
    html.addStyleName("color-dark-blue");
    notes = new TextArea();
    grid.setWidget(7, 0, html);
    grid.setWidget(7, 1, notes);
    notes.setSize("95%", "100%");

    grid.getColumnFormatter().setWidth(0, "130px");
    grid.getColumnFormatter().setWidth(1, "400px");
    grid.getRowFormatter().addStyleName(5, "vertical-align-top");
    grid.getRowFormatter().addStyleName(6, "vertical-align-top");
    grid.getRowFormatter().addStyleName(7, "vertical-align-top");
    grid.getCellFormatter().setHeight(6, 1, "200px");
    grid.getCellFormatter().setHeight(7, 1, "200px");

    HorizontalPanel hp = new HorizontalPanel();
    hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    hp.addStyleName("expert-border");
    hp.add(grid);

    // add(hp, data);

    LayoutContainer widget = new LayoutContainer();
    widget.setScrollMode(Scroll.AUTO);
    widget.setLayout(new FillLayout());
    widget.add(hp);
    add(widget, data);
    grid.setWidth("100%");
  }
示例#25
0
  @Override
  protected void initCenterPanel() {

    FlexTable flexTable = new FlexTable();

    flexTable.getColumnFormatter().setWidth(0, "60px");
    flexTable.getColumnFormatter().setWidth(1, "160px");
    flexTable.getColumnFormatter().setWidth(2, "700px");

    backButton = new Button();
    backButton.addStyleName(Utils.sandboxStyle.appBackButton());
    backButton.getElement().getStyle().setHeight(180, Unit.PX);
    setBackButton(backButton);

    flexTable.setWidget(0, 0, backButton);
    flexTable.getFlexCellFormatter().setRowSpan(0, 0, 2);
    flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);

    projectTitleLabel = new Label();
    projectTitleLabel.addStyleName(Utils.sandboxStyle.contentTitleLabel());
    projectTitleLabel.getElement().getStyle().setPaddingBottom(15, Unit.PX);

    flexTable.setWidget(0, 1, projectTitleLabel);
    flexTable.getFlexCellFormatter().setColSpan(0, 1, 2);
    flexTable.getFlexCellFormatter().setHeight(0, 1, "51px");

    VerticalPanel iconAndButtons = new VerticalPanel();
    iconAndButtons.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    applicationImage = new Image();
    iconAndButtons.add(applicationImage);

    VerticalPanel buttonsPanel = new VerticalPanel();
    buttonsPanel.getElement().getStyle().setPaddingTop(30, Unit.PX);
    buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    buttonsPanel.setWidth("100%");

    getSourceButton = new Button(Utils.constants.getSourceCode());
    getSourceButton.setSize("128px", "32px");
    getSourceButton.getElement().getStyle().setPaddingTop(0, Unit.PX);
    getSourceButton.getElement().getStyle().setPaddingBottom(0, Unit.PX);
    getSourceButton.getElement().getStyle().setFontWeight(FontWeight.BOLD);
    getBinaryButton = new Button(Utils.constants.getBinary());
    getBinaryButton.setSize("128px", "32px");
    getBinaryButton.getElement().getStyle().setPaddingTop(0, Unit.PX);
    getBinaryButton.getElement().getStyle().setPaddingBottom(0, Unit.PX);
    getBinaryButton.getElement().getStyle().setFontWeight(FontWeight.BOLD);

    buttonsPanel.add(getSourceButton);
    SimplePanel spacingPanel = new SimplePanel();
    spacingPanel.setHeight("10px");
    buttonsPanel.add(spacingPanel);
    buttonsPanel.add(getBinaryButton);

    iconAndButtons.add(buttonsPanel);

    flexTable.setWidget(1, 0, iconAndButtons);
    flexTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);

    FlexTable appDetailsPanel = new FlexTable();
    appDetailsPanel.getColumnFormatter().setWidth(0, "90px");
    appDetailsPanel.getColumnFormatter().setWidth(1, "610px");

    descriptionLabel = new Label();
    descriptionLabel.addStyleName(Utils.sandboxStyle.descriptionLabel());
    appDetailsPanel.setWidget(0, 0, descriptionLabel);
    appDetailsPanel.getFlexCellFormatter().setColSpan(0, 0, 2);

    Label platformLabel = new Label(Utils.constants.platform());
    platformLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(1, 0, platformLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(1, 0).getStyle().setPaddingTop(15, Unit.PX);
    appDetailsPanel
        .getFlexCellFormatter()
        .setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    targetPlatformPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(1, 1, targetPlatformPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(1, 1).getStyle().setPaddingTop(15, Unit.PX);
    appDetailsPanel
        .getFlexCellFormatter()
        .setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    Label featuresLabel = new Label(Utils.constants.features());
    featuresLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(2, 0, featuresLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(2, 0).getStyle().setPaddingTop(10, Unit.PX);
    appDetailsPanel
        .getFlexCellFormatter()
        .setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    featuresPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(2, 1, featuresPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(2, 1).getStyle().setPaddingTop(10, Unit.PX);
    appDetailsPanel
        .getFlexCellFormatter()
        .setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    projectDetailsPanel = new HTML();
    projectDetailsPanel.addStyleName(Utils.sandboxStyle.projectDetails());
    projectDetailsPanel.getElement().getStyle().setPaddingTop(15, Unit.PX);

    appDetailsPanel.setWidget(3, 0, projectDetailsPanel);
    appDetailsPanel.getFlexCellFormatter().setColSpan(3, 0, 2);

    flexTable.setWidget(1, 1, appDetailsPanel);
    flexTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP);

    detailsPanel.add(flexTable);
  }
示例#26
0
  public LogTextPanel(
      final String debugId, final TabItemConfig config, final LogTabPanel logTabPanel) {

    this.debugId = debugId;

    setHeaderVisible(false);

    setCollapsible(false);

    setContextMenu(contextMenu);

    stop =
        new MenuItem(
            "停止运行",
            new SelectionHandler<MenuItem>() {

              @Override
              public void onSelection(final SelectionEvent<MenuItem> se) {
                final MessageBox box = new MessageBox("停止调试?", "确定要停止调试么?");
                box.setPredefinedButtons(PredefinedButton.YES, PredefinedButton.NO);
                box.setIcon(MessageBox.ICONS.question());
                box.addHideHandler(
                    new HideHandler() {
                      @Override
                      public void onHide(HideEvent event) {
                        Dialog btn = (Dialog) event.getSource();
                        String choice = btn.getHideButton().getItemId();
                        if (choice.equalsIgnoreCase("yes")) {
                          debugService.cancelDebug(
                              debugId,
                              new AsyncCallback<Void>() {

                                @Override
                                public void onSuccess(Void result) {
                                  se.getSelectedItem().setEnabled(false);
                                }

                                @Override
                                public void onFailure(Throwable caught) {
                                  Window.alert("取消调试失败!\n原因:" + caught);
                                }
                              });
                        }
                      }
                    });
                box.show();
              }
            });

    contextMenu.add(stop);

    html.addStyleName("console-font");
    logTextScrollPanel.setWidget(html);

    this.add(logTextScrollPanel);

    timer =
        new Timer() {
          public void run() {
            final LogTextPanel logTextPanel = LogTextPanel.this;
            debugService.getHistoryModel(
                debugId,
                new AsyncCallback<DebugHistoryModel>() {

                  @Override
                  public void onSuccess(DebugHistoryModel result) {
                    // 刷新日志
                    String[] lines = result.getLog().split("\n");
                    StringBuffer sb = new StringBuffer();
                    for (String line : lines) {
                      for (long i = 1; i < 9; i++) {
                        line = line.replace((char) ('\u0000' + i), (char) ('\u245f' + i));
                      }
                      String job = ToolUtil.extractJobId(line);
                      if (job != null) {
                        String newline =
                            line.replaceFirst(
                                job,
                                "<a target='_blank' href='http://10.249.54.103:50030/jobdetails.jsp?jobid="
                                    + job
                                    + "&refresh=30'>"
                                    + job
                                    + "</a>");
                        sb.append(newline + "<br/>");
                      } else {
                        sb.append(line + "<br/>");
                      }
                    }
                    // 不在底部的时候不自动滚动
                    boolean needScroll =
                        (logTextScrollPanel.getMaximumVerticalScrollPosition()
                                - logTextScrollPanel.getVerticalScrollPosition()
                            < 14);
                    // 判断后才把新内容填进去
                    html.setHTML(sb.toString());
                    if (needScroll) {
                      logTextScrollPanel.scrollToBottom();
                    }

                    // 更新状态
                    if (result.getStatus().equals(DebugHistoryModel.Status.SUCCESS)) {
                      config.setIcon(Images.getImageResources().traffic_green());
                      stop.setEnabled(false);
                      isRunning = false;
                      cancel();
                    } else if (result.getStatus().equals(DebugHistoryModel.Status.FAILED)) {
                      config.setIcon(Images.getImageResources().traffic_red());
                      stop.setEnabled(false);
                      isRunning = false;
                      cancel();
                    } else {
                      config.setIcon(Images.getImageResources().processingIcon());
                      stop.setEnabled(true);
                      isRunning = true;
                    }
                    logTabPanel.update(logTextPanel, config);
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    // 忽略日志刷新失败
                  }
                });
          }
        };
    timer.scheduleRepeating(2000);
  }
示例#27
0
  public Widget asWidget() {

    HorizontalPanel layout = new HorizontalPanel();
    layout.getElement().setAttribute("title", "Notification Center");
    layout.setStyleName("notification-center");

    messageButton = new HTML(MESSAGE_LABEL + ": " + messageCenter.getNewMessageCount());
    messageButton.addStyleName("notification-button");

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

            int numMessages = fetchMessages(messagePopup);
            if (numMessages == 0) numMessages = 1;

            int width = 250;
            int height = numMessages * 35;

            messagePopup.setPopupPosition(
                messageButton.getAbsoluteLeft() - (width + 10 - messageButton.getOffsetWidth()),
                messageButton.getAbsoluteTop() + 25);

            messagePopup.show();
            Scheduler.get()
                .scheduleDeferred(
                    new Scheduler.ScheduledCommand() {
                      @Override
                      public void execute() {
                        messagePopup.focusOnFirstMessage();
                      }
                    });

            messagePopup.setWidth(width + "px");
            messagePopup.setHeight(height + "px");
          }
        };

    messageButton.addClickHandler(clickHandler);

    messageDisplay = new HorizontalPanel();
    messageDisplay.getElement().setAttribute("role", "log");
    messageDisplay.getElement().setAttribute("aria-live", "polite");
    messageDisplay.getElement().setAttribute("aria-atomic", "true");

    layout.add(messageDisplay);
    layout.add(messageButton);

    messageDisplay
        .getElement()
        .getParentElement()
        .setAttribute("style", "width:100%;padding-right:5px");
    messageDisplay.getElement().getParentElement().setAttribute("align", "right");

    messageButton.getElement().getParentElement().setAttribute("style", "width:60px");
    messageButton.getElement().getParentElement().setAttribute("align", "right");

    // register listener
    messageCenter.addMessageListener(this);
    Console.getEventBus().addHandler(ReloadEvent.TYPE, this);

    return layout;
  }