Java Code Examples for com.google.gwt.user.client.ui.HorizontalPanel#setCellVerticalAlignment()

The following examples show how to use com.google.gwt.user.client.ui.HorizontalPanel#setCellVerticalAlignment() . 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: LabeledTextBox.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new TextBox with the given leading caption.
 *
 * @param caption  caption for leading label
 */
public LabeledTextBox(String caption) {
  HorizontalPanel panel = new HorizontalPanel();
  Label label = new Label(caption);
  panel.add(label);
  panel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_MIDDLE);
  textbox = new TextBox();
  textbox.setStylePrimaryName("ode-LabeledTextBox");
  textbox.setWidth("100%");
  panel.add(textbox);
  panel.setCellWidth(label, "40%");
  panel.setCellVerticalAlignment(textbox, HasVerticalAlignment.ALIGN_MIDDLE);

  initWidget(panel);

  setWidth("100%");
}
 
Example 2
Source File: TopPanel.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
private void addLogo(HorizontalPanel panel) {
  // Logo is a link to App Inv homepage. Add timestamp to logo url
  // to get around browsers that agressively cache the image! This
  // same trick is used in StorageUtil.getFilePath().
  Image logo = new Image(LOGO_IMAGE_URL + "?t=" + System.currentTimeMillis());
  logo.setSize("180px", "40px");
  logo.setStyleName("ode-Logo");
  String logoUrl = ode.getSystemConfig().getLogoUrl();
  if (!Strings.isNullOrEmpty(logoUrl)) {
    logo.addClickHandler(new WindowOpenClickHandler(logoUrl));
  }
  panel.add(logo);
  panel.setCellWidth(logo, "230px");
  panel.setCellHorizontalAlignment(logo, HorizontalPanel.ALIGN_LEFT);
  panel.setCellVerticalAlignment(logo, HorizontalPanel.ALIGN_MIDDLE);
}
 
Example 3
Source File: Status.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The status
 */
public Status() {
	super(false, true);
	hPanel = new HorizontalPanel();
	image = new Image(OKMBundleResources.INSTANCE.indicator());
	msg = new HTML("");
	space = new HTML("");

	hPanel.add(image);
	hPanel.add(msg);
	hPanel.add(space);

	hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
	hPanel.setCellWidth(image, "30px");
	hPanel.setCellWidth(space, "7px");

	hPanel.setHeight("25px");

	msg.setStyleName("okm-NoWrap");

	super.hide();
	setWidget(hPanel);
}
 
Example 4
Source File: Status.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Status
 */
public Status() {
	super(false, true);
	hPanel = new HorizontalPanel();
	image = new Image(OKMBundleResources.INSTANCE.indicator());
	msg = new HTML("");
	space = new HTML("");

	hPanel.add(image);
	hPanel.add(msg);
	hPanel.add(space);

	hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
	hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
	hPanel.setCellWidth(image, "30px");
	hPanel.setCellWidth(space, "7px");

	hPanel.setHeight("25px");

	msg.setStyleName("okm-NoWrap");

	super.hide();
	setWidget(hPanel);
}
 
Example 5
Source File: WebTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
public IconCell(ImageResource resource, final String title, String text) {
	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");
		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 6
Source File: LabeledTextBox.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Use this TextBox if you want to have text validation while a user is typing
 *
 * @param caption    caption for leading label
 * @param validator  The validator to use for a specific textBox
 */
public LabeledTextBox(String caption, Validator validator) {
  this.validator = validator;

  HorizontalPanel panel = new HorizontalPanel();
  Label label = new Label(caption);
  panel.add(label);
  panel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_MIDDLE);
  textbox = new TextBox();
  textbox.setStylePrimaryName("ode-LabeledTextBox");
  defaultTextBoxColor = textbox.getElement().getStyle().getBorderColor();
  textbox.setWidth("100%");
  panel.add(textbox);
  panel.setCellWidth(label, "40%");
  panel.setCellVerticalAlignment(textbox, HasVerticalAlignment.ALIGN_MIDDLE);

  HorizontalPanel errorPanel = new HorizontalPanel();
  errorLabel = new Label("");
  errorPanel.add(errorLabel);

  VerticalPanel vp = new VerticalPanel();
  vp.add(panel);
  vp.add(errorPanel);
  vp.setHeight("85px");

  initWidget(vp);

  setWidth("100%");
}
 
Example 7
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 8
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 9
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 10
Source File: WebTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public InstructorCell(ArrayList<String> names, ArrayList<String> emails, String separator) {
	super(null, separator);
	if (names != null && !names.isEmpty()) {
		separator = separator.replace(" ", "&nbsp;");
		for (int i = 0; i < names.size(); i++) {
			String text = names.get(i) + (i + 1 < names.size() ? separator : "");
			String email = (emails != null && i < emails.size() ? emails.get(i) : null);
			if (email != null && !email.isEmpty()) {
				iText += text;
				HorizontalPanel p = new HorizontalPanel();
				p.setStyleName("instructor");
				Anchor a = new Anchor();
				a.setHref("mailto:" + email);
				a.setHTML(new Image(RESOURCES.email()).getElement().getString());
				a.setTitle(MESSAGES.sendEmail(names.get(i)));
				a.setStyleName("unitime-SimpleLink");
				a.addClickHandler(new ClickHandler() {
					public void onClick(ClickEvent event) {
						event.stopPropagation();
					}
				});
				p.add(a);
				p.setCellVerticalAlignment(a, HasVerticalAlignment.ALIGN_MIDDLE);
				HTML h = new HTML(text, false);
				h.getElement().getStyle().setMarginLeft(2, Unit.PX);
				p.add(h);
				iPanel.add(p);
				iContent.add(h);
			} else
				add(text);
		}
	} else {
		add("&nbsp;");
	}
}
 
Example 11
Source File: PreviewPopupPanel.java    From EasyML with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize
 * 
 * @param path  Result root address
 */
protected void init(String path) {
	this.setSize("650px", "400px");
	this.setGlassEnabled(true);
	this.setModal(true);
	closeButton.setSize("10px", "10px");
	closeButton.setStyleName("closebtn");
	closeButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			PreviewPopupPanel.this.hide();
		}
	});
	VerticalPanel verticalPanel = new VerticalPanel();
	verticalPanel.add(closeButton);
	verticalPanel.setCellHeight(closeButton, "13px");
	verticalPanel.setStyleName("vpanel");
	desc.setStyleName("popupTitle");
	verticalPanel.add(desc);
	verticalPanel.setCellHeight(desc, "30px");

	HorizontalPanel hPanel = new HorizontalPanel();
	savebtn.setStyleName("popupsavebtn");
	savebtn.setVisible(false);
	refreshBtn.setStyleName("popuprefreshbtn");
	refreshBtn.setVisible(false);
	uploadSubmitButton.setVisible(false);
	hPanel.add(uploadSubmitButton);
	hPanel.add(savebtn);
	hPanel.add(refreshBtn);
	hPanel.setCellVerticalAlignment(uploadSubmitButton,
			HasVerticalAlignment.ALIGN_BOTTOM);

	tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);
	tabPanel.setSize("650px", "355px");
	dirPanel = new HorizontalPanel();
	resultDirTree = PopupRetDirTreeLoad.load(path);
	resultDirTree.getRoot().setState(false);
	ScrollPanel dirScrollPanel = new ScrollPanel();
	dirScrollPanel.add(resultDirTree);
	dirScrollPanel.setAlwaysShowScrollBars(true);
	dirScrollPanel.setSize("300px", "320px");

	VerticalPanel fileViewPanel = new VerticalPanel();
	fileLabel.setText("Please select a file to view!");
	fileLabel.setStyleName("popupFileSelectName");
	fileViewPanel.add(fileLabel);
	fileTextArea.setStyleName("popupMsg");
	fileTextArea.setSize("342px", "298px");
	fileTextArea.getElement().setAttribute("wrap", "off");    
	fileTextArea.setReadOnly(true);
	fileViewPanel.add(fileTextArea);
	dirPanel.add(dirScrollPanel);
	dirPanel.add(fileViewPanel);
	tabPanel.add(dirPanel,"Results directory");

	AbsolutePanel bottomPanel = new AbsolutePanel(); 
	bottomPanel.setSize("650px", "360px");
	bottomPanel.add(tabPanel, 0, 0);
	bottomPanel.add(hPanel,460,3);

	fileSizeLabel.setStyleName("popupFileSelectName");
	verticalPanel.add(bottomPanel); 
	verticalPanel.add(fileSizeLabel);
	this.add(verticalPanel);
	this.setStyleName("loading_container");
}