Java Code Examples for com.google.gwt.user.client.ui.HasVerticalAlignment

The following examples show how to use com.google.gwt.user.client.ui.HasVerticalAlignment. These examples are extracted from open source projects. 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 Project: EasyML   Source File: FileUploader.java    License: Apache License 2.0 6 votes vote down vote up
public void init() {

		uploader.setButtonImageURL("studio/img/uploadimg.png").setButtonWidth(32)
		.setButtonHeight(32)
		.setButtonCursor(Uploader.Cursor.HAND);

		horizontalPanel.setStyleName("bda-fileupload-bottom-hpanel");
		horizontalPanel.setSpacing(10);
		horizontalPanel.add(uploader);
		if (Uploader.isAjaxUploadWithProgressEventsSupported()) {

			dropFilesLabel.getElement().getStyle().setCursor(Cursor.POINTER);
			dropFilesLabel.setSize("32px", "32px");
			dropFilesLabel.setTitle("File dragable upload area");
		}
		horizontalPanel.add(dropFilesLabel);
		horizontalPanel.add(progressBarPanel);
		horizontalPanel.setCellVerticalAlignment(progressBarPanel,
				HasVerticalAlignment.ALIGN_MIDDLE);
		this.add(horizontalPanel);
		initFacet();
	}
 
Example 2
Source Project: appinventor-extensions   Source File: LabeledTextBox.java    License: 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 3
Source Project: appinventor-extensions   Source File: MockSwitch.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Draw the SVG graphic of the toggle switch. It can be drawn in either checked or
 * unchecked positions, each with their own colors.
 *
 */
private void paintSwitch() {
  if (isInitialized) {
    panel.remove(switchGraphic);
  } else {
    isInitialized = true;
  }
  switchGraphic = new SVGPanel();
  int switchHeight = 14;  // pixels (Android asset is 28 px at 160 dpi)

  int switchWidth = (int) Math.round(switchHeight * 2);
  switchGraphic.setWidth(switchWidth + "px");
  switchGraphic.setHeight(switchHeight + "px");

  switchGraphic.setInnerSVG("<rect x=\"0\" y=\"0\" rx=\"" +
          switchHeight/2 + "\" yx=\"" + switchWidth/2 + "\" stroke-width=\"1\" stroke=\"black\"" +
          "height=\"" + switchHeight + "\" width=\"" + switchWidth + "\" fill=\"" + (checked? trackColorActive : trackColorInactive) + "\" />" +
          "<circle cx=\"" + (checked? switchWidth - switchHeight/2: switchHeight/2) + "\" fill=\"" + (checked? thumbColorActive : thumbColorInactive) + "\" " +
          "cy=\"" + (switchHeight/2) + "\" r=\"" + (switchHeight/2 - 1) + "\"/>");
  panel.add(switchGraphic);
  panel.setCellWidth(switchGraphic, switchWidth + "px");
  panel.setCellHorizontalAlignment(switchGraphic, HasHorizontalAlignment.ALIGN_RIGHT);
  panel.setCellVerticalAlignment(switchGraphic, HasVerticalAlignment.ALIGN_MIDDLE);
  toggleWidget = panel;
  refreshForm();
}
 
Example 4
Source Project: geowe-core   Source File: JoinDataDialog.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void createSeparatorPanel() {
	separatorPanel = new HorizontalPanel();
	separatorPanel.setSpacing(1);
	separatorPanel.setWidth("100%");
	separatorPanel.addStyleName(ThemeStyles.get().style().borderTop());
	separatorPanel.addStyleName(ThemeStyles.get().style().borderBottom());
	separatorPanel
			.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	separatorPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	separatorPanel.add(new Label(UIMessages.INSTANCE
			.separator(DEFAULT_CSV_SEPARATOR)));
	separatorTextField = new TextField();
	separatorTextField.setText(DEFAULT_CSV_SEPARATOR);
	separatorTextField.setWidth(30);

	separatorPanel.add(separatorTextField);
}
 
Example 5
Source Project: geowe-core   Source File: FeatureGrid.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected ColumnModel<VectorFeature> createColumnList(List<VectorFeature> features) {
	List<ColumnConfig<VectorFeature, ?>> columns = new ArrayList<ColumnConfig<VectorFeature, ?>>();
	
	if(features != null && features.size() > 0) {
		VectorFeature feature = features.get(0);

		if(feature.getAttributes() != null) {
			for(String attributeName : feature.getAttributes().getAttributeNames()) {	
				AttributeValueProvider attributeProvider = new AttributeValueProvider(attributeName);
				
				ColumnConfig<VectorFeature, String> attributeColumn = new ColumnConfig<VectorFeature, String>(
						attributeProvider, 100, attributeName);
				attributeColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
				if(isEnableCellRender()) {
					attributeColumn.setCell(new FeatureGridCellRenderer());
				}					
				
				columns.add(attributeColumn);
			}
		}					
	}
		
	return new ColumnModel<VectorFeature>(columns);
}
 
Example 6
Source Project: unitime   Source File: WebTable.java    License: 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 7
Source Project: unitime   Source File: WebTable.java    License: Apache License 2.0 6 votes vote down vote up
public IconsCell add(ImageResource resource, final String title, final boolean html) {
	if (resource == null) return this;
	Image icon = new Image(resource);
	String text = title;
	if (html) { HTML h = new HTML(title); text = h.getText(); }
	icon.setTitle(text);
	icon.setAltText(text);
	if (iPanel.getWidgetCount() > 0)
		icon.getElement().getStyle().setMarginLeft(3, Unit.PX);
	iPanel.add(icon);
	iPanel.setCellVerticalAlignment(icon, HasVerticalAlignment.ALIGN_MIDDLE);
	if (title != null && !title.isEmpty()) {
		icon.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				event.stopPropagation();
				UniTimeConfirmationDialog.info(title, html);
			}
		});
	}
	return this;
}
 
Example 8
Source Project: swcv   Source File: AppUtils.java    License: MIT License 6 votes vote down vote up
public static DialogBox createShadow()
{
    final DialogBox box = new DialogBox();
    VerticalPanel rows = new VerticalPanel();
    rows.setSpacing(1);
    HTML html = new HTML("<div></div>");
    rows.add(html);
    rows.addStyleName("blackTransparent");
    rows.setCellHeight(html, "" + Window.getClientHeight());
    rows.setCellWidth(html, "" + Window.getClientWidth());

    rows.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER);
    rows.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_MIDDLE);

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(rows);
    box.setWidget(hp);
    return box;
}
 
Example 9
Source Project: swcv   Source File: AppUtils.java    License: MIT License 6 votes vote down vote up
public static DialogBox createLoadingBox()
{
    final DialogBox box = new DialogBox();
    VerticalPanel rows = new VerticalPanel();
    rows.setSpacing(1);

    HTML html = new HTML("<img src=\"" + GWT.getHostPageBaseURL() + "static/imgs/loader.gif\" alt=\"loading\" />");
    rows.add(html);
    rows.addStyleName("whiteWithBorder");
    rows.setCellHeight(html, "100");
    rows.setCellWidth(html, "300");

    rows.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER);
    rows.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_MIDDLE);

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(rows);
    box.setWidget(hp);
    box.hide();
    return box;
}
 
Example 10
Source Project: appinventor-extensions   Source File: LabeledTextBox.java    License: 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 11
Source Project: geowe-core   Source File: Welcome.java    License: GNU General Public License v3.0 5 votes vote down vote up
private HorizontalPanel getPanel(final HTML data) {
	HorizontalPanel panel = new HorizontalPanel();
	panel.setSize("520px", "310px");
	panel.setSpacing(5);
	panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	Anchor anchor = new AnchorBuilder().setHref("http://www.geowe.org")
			.setImage(new Image(ImageProvider.INSTANCE.geoweSquareLogo()))
			.build();

	panel.add(anchor);
	panel.add(data);
	return panel;
}
 
Example 12
Source Project: geowe-core   Source File: LayerInfoToolBar.java    License: GNU General Public License v3.0 5 votes vote down vote up
public LayerInfoToolBar() {
	super();
	setHeight("200px");
	setHeaderVisible(false);		
	
	tools = new ArrayList<FeatureTool>();
	verticalGroup = new VerticalPanel();		
	verticalGroup.setSpacing(3);
	verticalGroup.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
}
 
Example 13
private ColumnModel<LayerDef> createColumnList(LayerDefProperties props, 
		RowExpander<LayerDef> rowExpander) {
	
	rowExpander.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	rowExpander.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	
	ColumnConfig<LayerDef, String> nameColumn = new ColumnConfig<LayerDef, String>(
			props.name(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UIMessages.INSTANCE.layerManagerToolText() + "</b>"));
	nameColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, String> typeColumn = new ColumnConfig<LayerDef, String>(
			props.type(), 75, UICatalogMessages.INSTANCE.type());
	typeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	typeColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, ImageResource> iconColumn = new ColumnConfig<LayerDef, ImageResource>(
			props.icon(), 32, "");
	iconColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	iconColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	iconColumn.setCell(new ImageResourceCell() {
		@Override
		public void render(Context context, ImageResource value, SafeHtmlBuilder sb) {
			super.render(context, value, sb);
		}
	});
			
	List<ColumnConfig<LayerDef, ?>> columns = new ArrayList<ColumnConfig<LayerDef, ?>>();
	columns.add(rowExpander);
	columns.add(iconColumn);		
	columns.add(nameColumn);
	columns.add(typeColumn);		
	
	return new ColumnModel<LayerDef>(columns);
}
 
Example 14
Source Project: unitime   Source File: ClassificationsEdit.java    License: 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 15
Source Project: unitime   Source File: ClassificationsEdit.java    License: 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 16
Source Project: unitime   Source File: RoomNoteChanges.java    License: Apache License 2.0 5 votes vote down vote up
private void populate(GwtRpcResponseList<ChangeLogInterface> logs) {
	List<UniTimeTableHeader> header = new ArrayList<UniTimeTableHeader>();
	
	header.add(new UniTimeTableHeader(MESSAGES.colDate(), clickHandler(0)));
	header.add(new UniTimeTableHeader(MESSAGES.colAcademicSession(), clickHandler(1)));
	header.add(new UniTimeTableHeader(MESSAGES.colManager(), clickHandler(2)));
	header.add(new UniTimeTableHeader(MESSAGES.colNote(), clickHandler(3)));
	iChanges.addRow(null, header);
	
	for (ChangeLogInterface log: logs) {
		List<Widget> line = new ArrayList<Widget>();
		
		line.add(new Label(sDateFormat.format(log.getDate()), false));
		line.add(new Label(log.getSession(), false));
		line.add(new HTML(log.getManager() == null ? "<i>" + MESSAGES.notApplicable() + "</i>" : log.getManager(), false));
		HTML note = new HTML(log.getObject() == null || log.getObject().isEmpty() || "-".equals(log.getObject()) ? "<i>" + MESSAGES.emptyNote() + "</i>" : log.getObject());
		note.getElement().getStyle().setWhiteSpace(WhiteSpace.PRE_WRAP);
		line.add(note);
		
		iChanges.addRow(log, line);
		iChanges.getRowFormatter().setVerticalAlign(iChanges.getRowCount() - 1, HasVerticalAlignment.ALIGN_TOP);
	}
	
	if (LastChangesCookie.getInstance().getSortColumn() >= 0) {
		iChanges.sort((UniTimeTableHeader)null, comparator(LastChangesCookie.getInstance().getSortColumn(), LastChangesCookie.getInstance().getSortOrder()));
		header.get(LastChangesCookie.getInstance().getSortColumn()).setOrder(LastChangesCookie.getInstance().getSortOrder());
	}
	
	iChanges.setColumnVisible(1, iMultiSessionToggle.getValue());
}
 
Example 17
Source Project: unitime   Source File: WebTable.java    License: 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 18
Source Project: unitime   Source File: WebTable.java    License: 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 19
Source Project: EasyML   Source File: PreviewPopupPanel.java    License: 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");
}
 
Example 20
Source Project: appinventor-extensions   Source File: Ode.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Creates a dialog box to show empty trash list message.
 * @param showDialog Convenience variable to show the created DialogBox.
 * @return The created and optionally displayed Dialog box.
 */

public DialogBox createEmptyTrashDialog(boolean showDialog) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(true, false); //DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.createNoProjectsDialogText());

  Grid mainGrid = new Grid(2, 2);
  mainGrid.getCellFormatter().setAlignment(0,
          0,
          HasHorizontalAlignment.ALIGN_CENTER,
          HasVerticalAlignment.ALIGN_MIDDLE);
  mainGrid.getCellFormatter().setAlignment(0,
          1,
          HasHorizontalAlignment.ALIGN_CENTER,
          HasVerticalAlignment.ALIGN_MIDDLE);
  mainGrid.getCellFormatter().setAlignment(1,
          1,
          HasHorizontalAlignment.ALIGN_RIGHT,
          HasVerticalAlignment.ALIGN_MIDDLE);

  Image dialogImage = new Image(Ode.getImageBundle().codiVert());

  Grid messageGrid = new Grid(2, 1);
  messageGrid.getCellFormatter().setAlignment(0,
          0,
          HasHorizontalAlignment.ALIGN_JUSTIFY,
          HasVerticalAlignment.ALIGN_MIDDLE);
  messageGrid.getCellFormatter().setAlignment(1,
          0,
          HasHorizontalAlignment.ALIGN_LEFT,
          HasVerticalAlignment.ALIGN_MIDDLE);


  Label messageChunk2 = new Label(MESSAGES.showEmptyTrashMessage());
  messageGrid.setWidget(1, 0, messageChunk2);
  mainGrid.setWidget(0, 0, dialogImage);
  mainGrid.setWidget(0, 1, messageGrid);

  dialogBox.setWidget(mainGrid);
  dialogBox.center();

  if (showDialog) {
    dialogBox.show();
  }

  return dialogBox;
}
 
Example 21
@Override
public Widget asWidget() {

	if (panel == null) {
		panel = new ContentPanel();
		panel.setBorders(true);
		panel.setPixelSize(490, 47);
		panel.setHeaderVisible(false);
		panel.setPosition(300, 0);
		panel.getElement().getStyle().setPosition(Position.ABSOLUTE);

		StyleInjector.inject(".statusBarStyle { " + "position: absolute; " + "bottom: 35 px;"
				+ "background: #E0ECF8;" + "border-radius: 5px 10px;" + "opacity: 0.8}");
		panel.setStyleName("geocodingPanelStyle");

		final HorizontalPanel horizontalGroup = new HorizontalPanel();
		horizontalGroup.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
		horizontalGroup.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
		horizontalGroup.setSpacing(5);
		horizontalGroup.getElement().getStyle().setBackgroundColor("#E0ECF8");

		addressTextField.setWidth("320px");
		addressTextField.setEmptyText(UIMessages.INSTANCE.gcAddressTextField());
		addressTextField.getElement().setId("autocompletar");

		addressTextField.addKeyDownHandler(new KeyDownHandler() {
			@Override
			public void onKeyDown(final KeyDownEvent event) {
				if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
					searchGeocoding(addressTextField.getText());
				}
			}
		});

		horizontalGroup.add(addressTextField);
		horizontalGroup.add(getSearchButton());
		horizontalGroup.add(getW3WLocationButton());
		horizontalGroup.add(getLocationMenuButton());
		panel.setWidget(horizontalGroup);
		panel.setVisible(false);
	}
	return panel;
}
 
Example 22
Source Project: unitime   Source File: SuggestionsTable.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public VerticalAlignmentConstant getVerticalCellAlignment() {
	return HasVerticalAlignment.ALIGN_MIDDLE;
}
 
Example 23
Source Project: unitime   Source File: EnrollmentTable.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public VerticalAlignmentConstant getVerticalCellAlignment() {
	return HasVerticalAlignment.ALIGN_TOP;
}
 
Example 24
Source Project: dashbuilder   Source File: GoogleTableDisplayerView.java    License: Apache License 2.0 4 votes vote down vote up
protected HorizontalPanel createTablePager() {
    HorizontalPanel pagerPanel = new HorizontalPanel();
    pagerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pagerPanel.getElement().setAttribute("cellpadding", "5");

    Pagination pagination = new Pagination();
    pagination.setPaginationSize(PaginationSize.NONE);

    for (int i = leftMostPageNumber; i <= rightMostPageNumber; i++) {
        AnchorListItem pageLink = new AnchorListItem(Integer.toString(i));
        final Integer _currentPage = i;
        if (currentPage != i) {
            pageLink.setActive(false);
            pageLink.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    getPresenter().gotoPage(_currentPage.intValue());
                }
            });
        } else {
            pageLink.setActive(true);
        }
        pagination.add(pageLink);
    }

    Icon leftPageIcon = new Icon(IconType.ANGLE_LEFT);
    leftPageIcon.setSize(IconSize.LARGE );
    leftPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    leftPageIcon.sinkEvents(Event.ONCLICK);
    leftPageIcon.addHandler(createGotoPageHandler(currentPage - 1), ClickEvent.getType());
    Tooltip leftPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoPreviousPage());
    leftPageTooltip.add(leftPageIcon);

    Icon rightPageIcon = new Icon(IconType.ANGLE_RIGHT);
    rightPageIcon.setSize(IconSize.LARGE);
    rightPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    rightPageIcon.sinkEvents(Event.ONCLICK);
    rightPageIcon.addHandler(createGotoPageHandler(currentPage + 1), ClickEvent.getType());
    Tooltip rightPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoNextPage() );
    rightPageTooltip.add(rightPageIcon);

    Icon firstPageIcon = new Icon(IconType.ANGLE_DOUBLE_LEFT);
    firstPageIcon.setSize(IconSize.LARGE);
    firstPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    firstPageIcon.sinkEvents(Event.ONCLICK);
    firstPageIcon.addHandler(createGotoPageHandler(1), ClickEvent.getType());
    Tooltip firstPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoFirstPage());
    firstPageTooltip.add(firstPageIcon);

    Icon lastPageIcon = new Icon(IconType.ANGLE_DOUBLE_RIGHT);
    lastPageIcon.setSize(IconSize.LARGE);
    lastPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    lastPageIcon.sinkEvents(Event.ONCLICK);
    lastPageIcon.addHandler(createGotoPageHandler(totalPages), ClickEvent.getType());
    Tooltip lastPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoLastPage());
    lastPageTooltip.add(lastPageIcon);

    pagerPanel.add(firstPageTooltip);
    pagerPanel.add(leftPageTooltip);
    pagerPanel.add(pagination);
    pagerPanel.add(rightPageTooltip);
    pagerPanel.add(lastPageTooltip);

    if (totalPagesHintEnabled) {
        pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_pages(
                Integer.toString(leftMostPageNumber),
                Integer.toString(rightMostPageNumber),
                Integer.toString(totalPages))));
    }
    if (totalRowsHintEnabled) {
        int currentRowsShown = currentPage * pageSize > totalRows ? totalRows : currentPage * pageSize;
        pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_rows(
                Integer.toString(((currentPage - 1) * pageSize) + 1),
                Integer.toString(currentRowsShown),
                Integer.toString(totalRows))));
    }
    return pagerPanel;
}