Java Code Examples for com.google.gwt.user.client.ui.HTML#setWidth()

The following examples show how to use com.google.gwt.user.client.ui.HTML#setWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleDayCell.java    From calendar-component with Apache License 2.0 6 votes vote down vote up
public SimpleDayCell(VCalendar calendar, int row, int cell) {
    this.calendar = calendar;
    this.row = row;
    this.cell = cell;
    setStylePrimaryName("v-calendar-month-day");
    caption = new Label();
    caption.setStyleName("v-calendar-day-number");
    caption.addMouseDownHandler(this);
    caption.addMouseUpHandler(this);
    add(caption);

    bottomspacer = new HTML();
    bottomspacer.setStyleName("v-calendar-bottom-spacer-empty");
    bottomspacer.setWidth(3 + "em");
    add(bottomspacer);
}
 
Example 2
Source File: OdeLog.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new output panel for displaying internal messages.
 */
private OdeLog() {
  // Initialize UI
  Button clearButton = new Button(MESSAGES.clearButton());
  clearButton.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      clear();
    }
  });

  text = new HTML();
  text.setWidth("100%");

  VerticalPanel panel = new VerticalPanel();
  panel.add(clearButton);
  panel.add(text);
  panel.setSize("100%", "100%");
  panel.setCellHeight(text, "100%");
  panel.setCellWidth(text, "100%");

  initWidget(panel);
}
 
Example 3
Source File: DiagramTab.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private HTML buildSliderPart(String width, String height, String cursor, String color, double transparancy) {
    HTML container = new HTML();
    container.setWidth(width);
    container.setHeight(height);
    DOM.setStyleAttribute(container.getElement(), "cursor", cursor);
    DOM.setStyleAttribute(container.getElement(), "backgroundColor", color);

    // transparency styling (see also bug#449 and http://www.quirksmode.org/css/opacity.html)
    // note: since GWT complains, '-msFilter' has to be in plain camelCase (w/o '-')
    // ordering is important here
    DOM.setStyleAttribute(container.getElement(), "opacity", Double.toString(transparancy));
    DOM.setStyleAttribute(container.getElement(), "mozOpacity", Double.toString(transparancy));
    String opacity = "(opacity=" +Double.toString(transparancy*100) + ")";
    DOM.setStyleAttribute(container.getElement(), "msFilter", "\"progid:DXImageTransform.Microsoft.Alpha"+ opacity + "\"");
    DOM.setStyleAttribute(container.getElement(), "filter", "alpha" + opacity);
    return container;
}
 
Example 4
Source File: ClassificationsEdit.java    From unitime with Apache License 2.0 5 votes vote down vote up
public MyCell(CurriculumInterface curriculum, CurriculumClassificationInterface classification) {
	iCurriculum	= curriculum;
	iClasf = classification;
	
	iPanel = new HorizontalPanel();
	
	iTextBox = new UniTimeTextBox(6, ValueBoxBase.TextAlignment.RIGHT);
	iTextBox.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			try {
				if (iTextBox.getText().isEmpty()) {
					iClasf.setExpected(null);
				} else {
					iClasf.setExpected(Integer.valueOf(iTextBox.getText()));
				}
			} catch (Exception e) {
				iClasf.setExpected(null);
			}
			update();
			for (MySumCell sum: iSums)
				sum.update();
		}
	});
	
	iRearLabel = new HTML("", false);
	iRearLabel.setWidth("50px");
	iRearLabel.setStyleName("unitime-Label");
	iRearLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iPanel.add(iTextBox);
	iPanel.setCellVerticalAlignment(iTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
	
	iPanel.add(iRearLabel);
	iPanel.setCellVerticalAlignment(iRearLabel, HasVerticalAlignment.ALIGN_MIDDLE);

	initWidget(iPanel);	
	
	update();
}
 
Example 5
Source File: ClassificationsEdit.java    From unitime with Apache License 2.0 5 votes vote down vote up
public MySumCell(List<MyCell> cells) {
	iCells = cells;
	for (MyCell cell: iCells)
		cell.iSums.add(this);
	
	iPanel = new HorizontalPanel();
	
	iTextBox = new HTML("", false);
	iTextBox.setWidth("60px");
	iTextBox.setStyleName("unitime-Label");
	iTextBox.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iRearLabel = new HTML("", false);
	iRearLabel.setWidth("55px");
	iRearLabel.setStyleName("unitime-Label");
	iRearLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iPanel.add(iTextBox);
	iPanel.setCellVerticalAlignment(iTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
	
	iPanel.add(iRearLabel);
	iPanel.setCellVerticalAlignment(iRearLabel, HasVerticalAlignment.ALIGN_MIDDLE);

	initWidget(iPanel);	
	
	update();
}
 
Example 6
Source File: WebTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public IconCell(ImageResource resource, final String title, String text, boolean reverse) {
	super(null);
	iIcon = new Image(resource);
	iIcon.setTitle(title);
	iIcon.setAltText(title);
	if (text != null && !text.isEmpty()) {
		iLabel = new HTML(text, false);
		iPanel = new HorizontalPanel();
		iPanel.setStyleName("icon");
		if (reverse) {
			iPanel.add(iLabel);
			iPanel.add(iIcon);
			iLabel.getElement().getStyle().setPaddingRight(3, Unit.PX);
			iLabel.setWidth("100%");
			iPanel.setWidth("100%");
			iIcon.getElement().getStyle().setFloat(Float.RIGHT);
		} else {
			iPanel.add(iIcon);
			iPanel.add(iLabel);
			iIcon.getElement().getStyle().setPaddingRight(3, Unit.PX);
		}
		iPanel.setCellVerticalAlignment(iIcon, HasVerticalAlignment.ALIGN_MIDDLE);
	}
	if (title != null && !title.isEmpty()) {
		iIcon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title);
			}
		});
	}
}
 
Example 7
Source File: WordCloudDetailApp.java    From swcv with MIT License 5 votes vote down vote up
private SimplePanel createPanel(String svg, int width, int height)
{
    SimplePanel panel = new SimplePanel();
    panel.setPixelSize(width, height);
    panel.addStyleName("center");
    HTML html = new HTML(svg);
    html.setWidth("100%");
    html.setHeight("100%");
    panel.add(html);
    return panel;
}
 
Example 8
Source File: ShowBarcodeCommand.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
BarcodeDialogBox(String projectName, String appInstallUrl) {
      super(false, true);
      setStylePrimaryName("ode-DialogBox");
      setText(MESSAGES.barcodeTitle(projectName));

      ClickHandler buttonHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          hide();
        }
      };

      Button cancelButton = new Button(MESSAGES.cancelButton());
      cancelButton.addClickHandler(buttonHandler);
      Button okButton = new Button(MESSAGES.okButton());
      okButton.addClickHandler(buttonHandler);
      HTML barcodeQrcode = new HTML("<center>" + BlocklyPanel.getQRCode(appInstallUrl) + "</center>");
      HTML linkQrcode = new HTML("<center><a href=\"" + appInstallUrl + "\" target=\"_blank\">" + appInstallUrl + "</a></center>");
      HorizontalPanel buttonPanel = new HorizontalPanel();
      buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
      HTML warningLabel = new HTML(MESSAGES.barcodeWarning(
          "<a href=\"" + "http://appinventor.mit.edu/explore/ai2/share.html" +
          "\" target=\"_blank\">",
          "</a>"));
      warningLabel.setWordWrap(true);
      warningLabel.setWidth("200px");  // set width to get the text to wrap
      HorizontalPanel warningPanel = new HorizontalPanel();
      warningPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
      warningPanel.add(warningLabel);

      // The cancel button is removed from the panel since it has no meaning in this
      // context.  But the logic is still here in case we want to restore it, and as
      // an example of how to code this stuff in GWT.
      // buttonPanel.add(cancelButton);
      buttonPanel.add(okButton);
      buttonPanel.setSize("100%", "24px");
      VerticalPanel contentPanel = new VerticalPanel();
      contentPanel.add(barcodeQrcode);
      contentPanel.add(linkQrcode);
      contentPanel.add(buttonPanel);
      contentPanel.add(warningPanel);
//      contentPanel.setSize("320px", "100%");
      add(contentPanel);
    }
 
Example 9
Source File: ProgressBarDialogBox.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public ProgressBarDialogBox(String serviceName, ProjectNode projectNode) {
  super(false, true);
  this.serviceName = serviceName;
  setStylePrimaryName("ode-DialogBox");
  setText(projectNode.getName() + " " + MESSAGES.ProgressBarFor());

  //click handler for the mini html buttons
  ClickHandler buttonHandler = new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      hide();
      progressBarShow++;
    }
  };

  //declare the ok button
  dismissButton.addClickHandler(buttonHandler);
  HorizontalPanel buttonPanel = new HorizontalPanel();
  buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
  dismissButton.setVisible(false); // we don't need the button unless we get an error

  //warning label
  warningLabel = new HTML("");
  warningLabel.setWordWrap(true);
  warningLabel.setWidth("60em");  // set width to get the text to wrap

  //warning panel
  HorizontalPanel warningPanel = new HorizontalPanel();
  warningPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
  warningPanel.add(warningLabel);

  // button panel
  buttonPanel.add(dismissButton);
  buttonPanel.setSize("100%", "24px");

  //content panel
  VerticalPanel contentPanel = new VerticalPanel();
  contentPanel.add(mpb);
  contentPanel.add(warningPanel);
  contentPanel.add(buttonPanel);
  setWidget(contentPanel);
}
 
Example 10
Source File: Util.java    From document-management-system with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates an square spacer
 *
 * @param width  The desired width space
 * @param height The desired height space
 * @return an HTML element meaning the with and height
 */
public static HTML space(String width, String height) {
	HTML spacer = new HTML("");
	spacer.setWidth(width);
	spacer.setHeight(height);
	return spacer;
}
 
Example 11
Source File: Util.java    From document-management-system with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates an horizontal spacer
 *
 * @param width The desired width space
 * @return an HTML element meaning the with
 */
public static HTML hSpace(String width) {
	HTML spacer = new HTML("");
	spacer.setWidth(width);
	return spacer;
}