com.google.gwt.user.client.ui.Label Java Examples

The following examples show how to use com.google.gwt.user.client.ui.Label. 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: TaskExecutionsTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
protected Widget getCell(final TaskExecutionInterface e, final TaskExecutionsTableColumn column, final int idx) {
	switch (column) {
	case DATE: return new Label(sDateFormatMeeting.format(e.getExecutionDate()));
	case TIME: return new Label(e.getExecutionTime(CONSTANTS));
	case QUEUED: return new Label(e.getQueued() == null ? "" : sDateFormatTS.format(e.getQueued()));
	case STARTED: return new Label(e.getStarted() == null ? "" : sDateFormatTS.format(e.getStarted()));
	case FINISHED: return new Label(e.getFinished() == null ? "" : sDateFormatTS.format(e.getFinished()));
	case STATUS: return new Label(CONSTANTS.taskStatus()[e.getStatus().ordinal()]);
	case MESSAGE:
		Label message = new Label(e.getStatusMessage() == null ? "" : e.getStatusMessage()); message.addStyleName("status-message");
		if (e.getStatusMessage() != null)
			message.setTitle(e.getStatusMessage());
		return message;
	case OUTPUT:
		if (e.getOutput() != null) return new Anchor(e.getOutput(), GWT.getHostPageBaseURL() + "taskfile?e=" + e.getId());
		return new Label("");
	default:
		return null;
	}
}
 
Example #2
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 #3
Source File: InstructorAttributesTable.java    From unitime with Apache License 2.0 6 votes vote down vote up
protected Widget getCell(final AttributeInterface feature, final AttributesColumn column, final int idx) {
	switch (column) {
	case NAME:
		return new Label(feature.getName() == null ? "" : feature.getName(), false);
	case CODE:
		return new Label(feature.getCode() == null ? "" : feature.getCode(), false);
	case TYPE:
		if (feature.getType() == null)
			return null;
		else {
			Label type = new Label(feature.getType().getAbbreviation(), false);
			type.setTitle(feature.getType().getLabel());
			return type;
		}
	case PARENT:
		return new Label(feature.getParentName() == null ? "" : feature.getParentName(), false);
	case INSTRUCTORS:
		if (feature.hasInstructors())
			return new InstructorsCell(feature);
		else
			return null;
	default:
		return null;
	}
}
 
Example #4
Source File: JoinDataDialog.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private FormPanel createFilePanel() {
	final VerticalLayoutContainer layoutContainer = new VerticalLayoutContainer();

	file = new FileUploadField();
	file.setName(UIMessages.INSTANCE.gdidFileUploadFieldText());
	file.setAllowBlank(false);

	layoutContainer.add(new FieldLabel(file, UIMessages.INSTANCE.file()),
			new VerticalLayoutData(-18, -1));
	layoutContainer.add(new Label(UIMessages.INSTANCE.maxFileSizeText()),
			new VerticalLayoutData(-18, -1));

	uploadPanel = new FormPanel();
	uploadPanel.setMethod(Method.POST);
	uploadPanel.setEncoding(Encoding.MULTIPART);
	uploadPanel.setAction("fileupload.do");
	uploadPanel.setWidget(layoutContainer);

	return uploadPanel;
}
 
Example #5
Source File: GalleryAppBox.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Creates new Gallery app box.
 */
private GalleryAppBox() {
  gContainer = new FlowPanel();
  final HorizontalPanel container = new HorizontalPanel();
  container.setWidth("100%");
  container.setSpacing(0);
  container.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
  HorizontalPanel panel = new HorizontalPanel();
  Image image = new Image();
  image.setResource(Ode.getImageBundle().waitingIcon());
  panel.add(image);
  Label label = new Label();
  label.setText(Ode.getMessages().defaultRpcMessage());
  panel.add(label);
  gContainer.add(panel);
  this.add(gContainer);
}
 
Example #6
Source File: JoinDataDialog.java    From geowe-core with 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 #7
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's title section
 * @param container   The container that title resides
 */
private void initAppTitle(Panel container) {
  if (newOrUpdateApp()) {
    // GUI for editable title container
    if (editStatus==NEWAPP) {
      // If it's new app, give a textual hint telling user this is title
      titleText.setText(app.getTitle());
    } else if (editStatus==UPDATEAPP) {
      // If it's not new, just set whatever's in the data field already
      titleText.setText(app.getTitle());
    }
    titleText.addValueChangeHandler(new ValueChangeHandler<String>() {
      @Override
      public void onValueChange(ValueChangeEvent<String> event) {
        app.setTitle(titleText.getText());
      }
    });
    titleText.addStyleName("app-desc-textarea");
    container.add(titleText);
    container.addStyleName("app-title-container");
  } else {
    Label title = new Label(app.getTitle());
    title.addStyleName("app-title");
    container.add(title);
  }
}
 
Example #8
Source File: FilterBox.java    From unitime with Apache License 2.0 6 votes vote down vote up
public ChipPanel(Chip chip, String color) {
	iChip = chip;
	setStyleName("chip");
	addStyleName(color);
	iLabel = new Label(chip.getTranslatedValue());
	iLabel.setStyleName("text");
	add(iLabel);
	iButton = new HTML("&times;");
	iButton.setStyleName("button");
	add(iButton);
	if (chip.hasToolTip())
		setTitle(toString() + "\n" + chip.getToolTip());
	else
		setTitle(toString());
	Roles.getDocumentRole().setAriaHiddenState(getElement(), true);
}
 
Example #9
Source File: ApiUser.java    From sc2gears with Apache License 2.0 6 votes vote down vote up
private static DialogBox createWaitingDialog( final String message ) {
	final DialogBox dialogBox = new DialogBox();
	dialogBox.setText( "Info" );
	
	final HorizontalPanel hp = new HorizontalPanel();
	DOM.setStyleAttribute( hp.getElement(), "padding", "20px" );
	hp.setHeight( "20px" );
	hp.add( new Image( "/images/loading.gif" ) );
	hp.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
	hp.add( new Label( message ) );
	dialogBox.setWidget( hp );
	
	dialogBox.center();
	
	return dialogBox;
}
 
Example #10
Source File: Client.java    From unitime with Apache License 2.0 6 votes vote down vote up
public void initPageAsync(final String page) {
	GWT.runAsync(new RunAsyncCallback() {
		public void onSuccess() {
			init(page);
			LoadingWidget.getInstance().hide();
		}
		public void onFailure(Throwable reason) {
			Label error = new Label(MESSAGES.failedToLoadPage(reason.getMessage()));
			error.setStyleName("unitime-ErrorMessage");
			RootPanel loading = RootPanel.get("UniTimeGWT:Loading");
			if (loading != null) loading.setVisible(false);
			RootPanel.get("UniTimeGWT:Body").add(error);
			LoadingWidget.getInstance().hide();
			UniTimeNotifications.error(MESSAGES.failedToLoadPage(reason.getMessage()), reason);
		}
	});
}
 
Example #11
Source File: Leaf.java    From EasyML with Apache License 2.0 6 votes vote down vote up
/**
 * Create a leaf node for the Tree
 *
 * @param name   name of the TreeItem
 * @param module Attached moduleId for the TreeItem
 */
public Leaf(String name,
		T module,
		String style) {
	// add context menu
	this.menu = new ContextMenu();
	label = new Label(name);
	this.setWidget(label);

	label.addMouseDownHandler(new MouseDownHandler() {
		@Override
		public void onMouseDown(MouseDownEvent event) {
			// display the context menu when right click
			if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
				menu.setPopupPosition(event.getClientX(), event.getClientY());
				menu.show();
			}
		}
	});

	// set moduleId
	this.module = module;
	this.addStyleName("bda-treeleaf");
	if (!style.equals(""))
		this.addStyleName(style);
}
 
Example #12
Source File: User.java    From sc2gears with Apache License 2.0 6 votes vote down vote up
private static DialogBox createWaitingDialog( final String message ) {
	final DialogBox dialogBox = new DialogBox();
	dialogBox.setText( "Info" );
	
	final HorizontalPanel hp = new HorizontalPanel();
	DOM.setStyleAttribute( hp.getElement(), "padding", "20px" );
	hp.setHeight( "20px" );
	hp.add( new Image( "/images/loading.gif" ) );
	hp.add( ClientUtils.createHorizontalEmptyWidget( 5 ) );
	hp.add( new Label( message ) );
	dialogBox.setWidget( hp );
	
	dialogBox.center();
	
	return dialogBox;
}
 
Example #13
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's stats fields
 * @param container   The container that stats fields reside
 */
private void initAppStats(Panel container) {
  // Images for stats data
  Image numDownloads = new Image();
  numDownloads.setUrl(DOWNLOAD_ICON_URL);
  Image numLikes = new Image();
  numLikes.setUrl(HOLLOW_HEART_ICON_URL);

  // Add stats data
  container.addStyleName("app-stats");
  container.add(numDownloads);
  container.add(new Label(Integer.toString(app.getDownloads())));
  // Adds dynamic like
  initLikeSection(container);
  // Adds dynamic feature
  initFeatureSection(container);
  // Adds dynamic tutorial
  initTutorialSection(container);
  // Adds dynamic salvage
  initSalvageSection(container);

  // We are not using views and comments at initial launch
  /*
  Image numViews = new Image();
  numViews.setUrl(NUM_VIEW_ICON_URL);
  Image numComments = new Image();
  numComments.setUrl(NUM_COMMENT_ICON_URL);
  container.add(numViews);
  container.add(new Label(Integer.toString(app.getViews())));
  container.add(numComments);
  container.add(new Label(Integer.toString(app.getComments())));
  */
}
 
Example #14
Source File: GalleryGuiFactory.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private GalleryAppWidget(final GalleryApp app) {
  nameLabel = new Label(app.getTitle());
  authorLabel = new Label(app.getDeveloperName());
  numDownloadsLabel = new Label(Integer.toString(app.getDownloads()));
  numLikesLabel = new Label(Integer.toString(app.getLikes()));
  numViewsLabel = new Label(Integer.toString(app.getViews()));
  numCommentsLabel = new Label(Integer.toString(app.getComments()));
  image = new Image();
  image.addErrorHandler(new ErrorHandler() {
    public void onError(ErrorEvent event) {
      image.setResource(GalleryImages.get().genericApp());
    }
  });
  String url = gallery.getCloudImageURL(app.getGalleryAppId());
  image.setUrl(url);

  if(gallery.getSystemEnvironment() != null &&
      gallery.getSystemEnvironment().equals("Development")){
    final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(String newUrl) {
          if (newUrl != null) {
            image.setUrl(newUrl + "?" + System.currentTimeMillis());
          }
        }
      };
    Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
  }
}
 
Example #15
Source File: MaterialInfo.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
public void showInfo(HTMLPanel panel, ImageResource resource, String message) {
    panel.clear();

    HTMLPanel container = new HTMLPanel("");
    container.addStyleName(CssName.MATERIAL_INFO);
    container.add(new Image(resource));
    container.add(new Label(message));
    panel.add(container);
}
 
Example #16
Source File: IconButtonTemplate.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
@UiConstructor
public IconButtonTemplate() {
  Label label = new Label();
  initWidget(label);
  label.addClickHandler(this);
  label.addMouseOverHandler(this);
  label.addMouseOutHandler(this);
  label.addMouseUpHandler(this);
  label.addMouseDownHandler(this);
}
 
Example #17
Source File: ProjectList.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new ProjectList
 */
public ProjectList() {
  projects = new ArrayList<Project>();
  selectedProjects = new ArrayList<Project>();
  projectWidgets = new HashMap<Project, ProjectWidgets>();

  sortField = SortField.DATE_MODIFIED;
  sortOrder = SortOrder.DESCENDING;

  // Initialize UI
  table = new Grid(1, 5); // The table initially contains just the header row.
  table.addStyleName("ode-ProjectTable");
  table.setWidth("100%");
  table.setCellSpacing(0);
  nameSortIndicator = new Label("");
  dateCreatedSortIndicator = new Label("");
  dateModifiedSortIndicator = new Label("");
  publishedSortIndicator = new Label("");
  refreshSortIndicators();
  setHeaderRow();

  VerticalPanel panel = new VerticalPanel();
  panel.setWidth("100%");

  panel.add(table);
  initWidget(panel);

  // It is important to listen to project manager events as soon as possible.
  Ode.getInstance().getProjectManager().addProjectManagerEventListener(this);

  gallery = GalleryClient.getInstance();
}
 
Example #18
Source File: ReportList.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor of ReportWidgets
 * @param report GalleryAppReport
 */
private ReportWidgets(final GalleryAppReport report) {

  reportTextLabel = new Label(report.getReportText());
  reportTextLabel.addStyleName("ode-ProjectNameLabel");
  reportTextLabel.setWordWrap(true);
  reportTextLabel.setWidth("200px");

  appLabel = new Label(report.getApp().getTitle());
  appLabel.addStyleName("primary-link");

  DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat();
  Date dateCreated = new Date(report.getTimeStamp());
  dateCreatedLabel = new Label(dateTimeFormat.format(dateCreated));

  appAuthorlabel = new Label(report.getOffender().getUserName());
  appAuthorlabel.addStyleName("primary-link");

  reporterLabel = new Label(report.getReporter().getUserName());
  reporterLabel.addStyleName("primary-link");

  sendEmailButton = new Button(MESSAGES.buttonSendEmail());

  deactiveAppButton = new Button(MESSAGES.labelDeactivateApp());

  markAsResolvedButton = new Button(MESSAGES.labelmarkAsResolved());

  seeAllActions = new Button(MESSAGES.labelSeeAllActions());
}
 
Example #19
Source File: GwtMockitoTest.java    From gwtmockito with Apache License 2.0 5 votes vote down vote up
@Test
public void typeProvidersShouldWorkForSubtypes() {
  final Widget someWidget = mock(Widget.class);

  GwtMockito.useProviderForType(Widget.class, new FakeProvider<Widget>() {
    @Override
    public Widget getFake(Class<?> type) {
      assertTrue(type == Label.class);
      return someWidget;
    }
  });

  assertSame(someWidget, GWT.create(Label.class));
}
 
Example #20
Source File: ReportList.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Help method for Email Collapse Function
 * When the button(see more) is clicked, it will retrieve the whole email from database.
 * @param parent the parent container
 * @param emailId email id
 * @param preview email preview
 */
void createEmailCollapse(final FlowPanel parent, final long emailId, final String preview){
  final Label emailContent = new Label();
  emailContent.setText(preview);
  emailContent.addStyleName("inline-label");
  parent.add(emailContent);
  final Label actionButton = new Label();
  actionButton.setText(MESSAGES.seeMoreLink());
  actionButton.addStyleName("seemore-link");
  parent.add(actionButton);
  if(preview.length() <= MAX_EMAIL_PREVIEW_LENGTH){
    actionButton.setVisible(false);
  }
  actionButton.addClickHandler(new ClickHandler() {
    boolean ifPreview = true;
    @Override
    public void onClick(ClickEvent event) {
      if(ifPreview == true){
        OdeAsyncCallback<Email> callback = new OdeAsyncCallback<Email>(
            // failure message
            MESSAGES.serverUnavailable()) {
              @Override
              public void onSuccess(final Email email) {
                emailContent.setText(email.getBody());
                emailContent.addStyleName("inline");
                actionButton.setText(MESSAGES.hideLink());
                ifPreview = false;
              }
            };
        Ode.getInstance().getGalleryService().getEmail(emailId, callback);
      }else{
        emailContent.setText(preview);
        actionButton.setText(MESSAGES.seeMoreLink());
        ifPreview = true;
      }
    }
  });
}
 
Example #21
Source File: NamedGroupRenderer.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget render(RenderMetaData metaData, String groupName, Map<String, FormItem> groupItems) {
    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("fill-layout-width");
    Label label = new Label(groupName);
    label.setStyleName("form-group-label");
    panel.add(label);
    panel.add(delegate.render(metaData, groupName, groupItems));
    return panel;
}
 
Example #22
Source File: InstructorsTable.java    From unitime with Apache License 2.0 5 votes vote down vote up
protected Widget getCell(final InstructorInterface instructor, final InstructorsColumn column, final int idx) {
	switch (column) {
	case ID:
		if (instructor.getExternalId() == null) {
			Image warning = new Image(RESOURCES.warning());
			warning.setTitle(MESSAGES.warnInstructorHasNoExternalId(instructor.getFormattedName()));
			return warning;
		} else {
			return new Label(instructor.getExternalId());
		}
	case NAME:
		return new Label(instructor.getFormattedName());
	case POSITION:
		return new Label(instructor.getPosition() == null ? "" : instructor.getPosition().getLabel());
	case TEACHING_PREF:
		if (instructor.getTeachingPreference() == null) {
			return new Label("");
		} else {
			Label pref = new Label(instructor.getTeachingPreference().getName());
			if (instructor.getTeachingPreference().getColor() != null)
				pref.getElement().getStyle().setColor(instructor.getTeachingPreference().getColor());
			return pref;
		}
	case MAX_LOAD:
		return new Label(instructor.hasMaxLoad() ? NumberFormat.getFormat(CONSTANTS.teachingLoadFormat()).format(instructor.getMaxLoad()) : "");
	case SELECTION:
		return new SelectableCell(instructor);
	case ATTRIBUTES:
		AttributeTypeInterface type = iProperties.getAttributeTypes().get(idx);
		List<AttributeInterface> attributes = instructor.getAttributes(type);
		if (!attributes.isEmpty() && !isColumnVisible(getCellIndex(column) + idx)) {
			setColumnVisible(getCellIndex(column) + idx, true);
		}
		return new AttributesCell(attributes);
	default:
		return null;
	}
}
 
Example #23
Source File: Pagination.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
* Load the first page
*/
public void load(){
if(pageSize>pageType*2){
	headStart = 1;
	tailStart = lastPage - (pageType - 1);
	grid.resize(1, (pageType*2+5));
	grid.setWidget(0, 0, first);
	grid.setWidget(0, 1, prev);
	for(int count=2;count<(pageType+2);count++){
		grid.setWidget(0, count, new Label(headStart+""));
		headStart++;
	}
	grid.setText(0, (pageType+2), "...");
	for(int count=(pageType+3);count<(pageType*2+3);count++){
		grid.setWidget(0, count, new Label(tailStart+""));
		tailStart++;
	}
	grid.setWidget(0, (pageType*2+3), next);
	grid.setWidget(0, (pageType*2+4), last);
}else{
	grid.resize(1, pageSize + 4);
	grid.setWidget(0, 0, first);
	grid.setWidget(0, 1, prev);
	for(int count=2;count<pageSize+2;count++){
		grid.setWidget(0, count, new Label((count-1)+""));
	}
	grid.setWidget(0, pageSize+2, next);
	grid.setWidget(0, pageSize+3, last);
}
grid.getWidget(0, 2).removeStyleName("gwt-Label");
grid.getWidget(0, 2).addStyleName("admin-page-selected");
}
 
Example #24
Source File: SelectPatchStep.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected IsWidget body(final ApplyContext context) {
    FormPanel form = new FormPanel();
    FlowPanel panel = new FlowPanel();
    form.setWidget(panel);
    panel.add(new Label(Console.CONSTANTS.patch_manager_select_patch_body()));

    if (!context.standalone) {
        info = new HTML("");
        info.getElement().getStyle().setMarginTop(2, Style.Unit.EM);
        panel.add(info);
    }

    FlowPanel uploadPanel = new FlowPanel();
    uploadPanel.getElement().getStyle().setMarginTop(2, Style.Unit.EM);
    InlineLabel uploadLabel = new InlineLabel(Console.CONSTANTS.patch_manager_select_patch_upload());
    uploadLabel.getElement().getStyle().setMarginRight(1, Style.Unit.EM);
    uploadPanel.add(uploadLabel);
    context.fileUpload = new FileUpload();
    context.fileUpload.setName("patch_file");
    context.fileUpload.getElement().setId(asId(PREFIX, getClass(), "_Upload"));
    uploadPanel.add(context.fileUpload);
    panel.add(uploadPanel);

    errorMessages = new HTML(
            "<i class=\"icon-exclamation-sign\"></i> " + Console.CONSTANTS.patch_manager_select_file());
    errorMessages.addStyleName("error");
    errorMessages.setVisible(false);
    panel.add(errorMessages);

    return form;
}
 
Example #25
Source File: LayerLegend.java    From geomajas-gwt2-quickstart-application with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Init the layer legend panel.
 */
private void initLayerLegend() {

		HTMLPanel layerPopupPanelWrapper = new HTMLPanel("");

		closeLayerPopupPanelButton.addStyleName(ApplicationResource.INSTANCE.css().closePopupPanelButton());
		closeLayerPopupPanelButton.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				layerLegendPanel.hide();
				ApplicationService.getInstance().setTooltipShowingAllowed(true);
			}
		});

		HTMLPanel closeLayerButtonContainer = new HTMLPanel("");
		closeLayerButtonContainer.addStyleName(ApplicationResource.INSTANCE.css().popupPanelHeader());
		Label layerTitle = new Label(msg.layerLegendPanelTitle());
		closeLayerButtonContainer.add(layerTitle);
		closeLayerButtonContainer.add(closeLayerPopupPanelButton);
		layerPopupPanelWrapper.add(closeLayerButtonContainer);

		HTMLPanel layerPopupPanelContent = new HTMLPanel("");
		layerPopupPanelContent.addStyleName(ApplicationResource.INSTANCE.css().layerPopupPanelContent());

		// Add a generated layers legend.
		layerPopupPanelWrapper.add(
				getLayersLegend(layerPopupPanelContent, mapPresenter.getLayersModel())
		);

		layerLegendPanel.add(layerPopupPanelWrapper);

}
 
Example #26
Source File: RoomNoteChanges.java    From unitime with 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 #27
Source File: PropertiesPanel.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a new property to be displayed in the UI.
 *
 * @param property  new property to be shown
 */
void addProperty(EditableProperty property) {
  Label label = new Label(property.getCaption());
  label.setStyleName("ode-PropertyLabel");
  panel.add(label);
  PropertyEditor editor = property.getEditor();
  // Since UIObject#setStyleName(String) clears existing styles, only
  // style the editor if it hasn't already been styled during instantiation.
  if(!editor.getStyleName().contains("PropertyEditor")) {
    editor.setStyleName("ode-PropertyEditor");
  }
  panel.add(editor);
}
 
Example #28
Source File: ScriptParameterPanel.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Init UI
 * @param editable Wheather is editable
 */
protected void init(boolean editable){

	initGridHead( 3 );
	inCountBox = new TextBox();
	outCountBox = new TextBox();
	inCountBox.setText( "" +widget.getInNodeShapes().size() );
	outCountBox.setText( "" + widget.getOutNodeShapes().size());

	paramsGrid.setVisible(true);
	paramsGrid.setWidget( 1 , 0, new Label("Input File Number"));
	paramsGrid.setWidget( 1, 1, new Label("Int"));
	paramsGrid.setWidget( 1, 2, inCountBox );
	inCountBox.setSize("95%", "100%");
	inCountBox.setStyleName("okTextbox");
	inCountBox.setEnabled(editable);
	inCountBox.setTabIndex(0);

	paramsGrid.setWidget( 2 , 0, new Label("Output File Number"));
	paramsGrid.setWidget( 2,  1, new Label("Int"));
	paramsGrid.setWidget( 2 , 2, outCountBox );
	outCountBox.setSize("95%", "100%");
	outCountBox.setStyleName("okTextbox");
	outCountBox.setEnabled(editable);
	outCountBox.setTabIndex(1);
	scriptArea = new TextArea();
	scriptArea.setText( widget.getProgramConf().getScriptContent());
	this.add( paramsGrid );
	this.add( new Label("Script"));
	this.add( scriptArea );
}
 
Example #29
Source File: GeoDataImportDialog.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private FormPanel getFilePanel() {
	VerticalLayoutContainer layoutContainer = new VerticalLayoutContainer();

	file = new FileUploadField();

	file.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			setAutoFormat(file.getValue());
			String name = file.getValue().substring(0, file.getValue().lastIndexOf("."));
			name = name.substring(file.getValue().lastIndexOf("\\") +1);
			layerName.setText(name);
		}
	});

	file.setName(UIMessages.INSTANCE.gdidFileUploadFieldText());
	file.setAllowBlank(false);

	layoutContainer.add(new FieldLabel(file, UIMessages.INSTANCE.file()),
			new VerticalLayoutData(-18, -1));
	layoutContainer.add(new Label(UIMessages.INSTANCE.maxFileSizeText()),
			new VerticalLayoutData(-18, -1));

	uploadPanel = new FormPanel();
	uploadPanel.setMethod(Method.POST);
	uploadPanel.setEncoding(Encoding.MULTIPART);
	uploadPanel.setAction("fileupload.do");
	uploadPanel.setWidget(layoutContainer);

	return uploadPanel;
}
 
Example #30
Source File: SettingsPanel.java    From swcv with MIT License 5 votes vote down vote up
private Widget createLabel(String text)
{
    Label label = new Label(text);
    label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    //label.addStyleName("small");
    return label;
}