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

The following examples show how to use com.google.gwt.user.client.ui.Label. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: geowe-core   Source File: JoinDataDialog.java    License: 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 2
Source Project: unitime   Source File: InstructorAttributesTable.java    License: 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 3
Source Project: appinventor-extensions   Source File: GalleryAppBox.java    License: 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 4
Source Project: sc2gears   Source File: ApiUser.java    License: 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 5
Source Project: EasyML   Source File: Leaf.java    License: 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 6
Source Project: unitime   Source File: TaskExecutionsTable.java    License: 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 7
Source Project: sc2gears   Source File: User.java    License: 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 8
Source Project: unitime   Source File: Client.java    License: 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 9
Source Project: unitime   Source File: FilterBox.java    License: 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("×");
	iButton.setStyleName("button");
	add(iButton);
	if (chip.hasToolTip())
		setTitle(toString() + "\n" + chip.getToolTip());
	else
		setTitle(toString());
	Roles.getDocumentRole().setAriaHiddenState(getElement(), true);
}
 
Example 10
Source Project: appinventor-extensions   Source File: GalleryPage.java    License: 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 11
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 12
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 13
Source Project: unitime   Source File: InstructorsTable.java    License: 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 14
private void build(DebugPanelFilterModel model) {
  Label label = new Label("Currently filtering");
  label.setVisible(false);
  label.setStyleName(Utils.style() + "-filterTrailLabel");
  panel.add(label);
  for (int i = 0; i < model.getCountOfAvailableFilters(); i++) {
    panel.add(new Item(model, i));
    if (model.isFilterActive(i)) {
      activeCount++;
      panel.getWidget(0).setVisible(true);
    }
  }
}
 
Example 15
@Override
protected List<Widget> getData() {
	List<Widget> widgets = new ArrayList<Widget>();
	for (Layer layer : layers) {
		HorizontalPanel hpanel = new HorizontalPanel();
		hpanel.setSpacing(2);
		hpanel.add(getColorPanel(layer));
		hpanel.add(new Label(layer.getName()));

		widgets.add(hpanel);
	}
	return widgets;
}
 
Example 16
public Widget asWidget() {


        filter.setMaxLength(30);
        filter.setVisibleLength(20);
        filter.getElement().setAttribute("style", "width:120px;");

        filter.addKeyUpHandler(new KeyUpHandler() {
            @Override
            public void onKeyUp(KeyUpEvent keyUpEvent) {

                Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {

                    @Override
                    public void execute() {
                        String prefix = filter.getText();

                        if (prefix != null && !prefix.equals("")) {
                            // filter by prefix
                            filterByPrefix(prefix);
                        } else {
                            clearFilter();
                        }
                    }

                });
            }
        });
        HorizontalPanel panel = new HorizontalPanel();
        Label label = new Label(Console.CONSTANTS.common_label_filter() + ": ");
        panel.add(label);
        panel.add(filter);

        label.getElement().setAttribute("style", "padding-top:8px;margin-right:8px");
        return panel;
    }
 
Example 17
Source Project: geowe-core   Source File: JoinDataDialog.java    License: GNU General Public License v3.0 5 votes vote down vote up
private VerticalPanel getURLPanel() {
	final VerticalPanel vPanel = new VerticalPanel();
	vPanel.setWidth("100%");

	vPanel.add(new Label(UIMessages.INSTANCE.messageURLPanel()));

	urlTextField = new TextField();
	urlTextField.setBorders(true);
	urlTextField.setEmptyText("http://");
	urlTextField.setWidth(390);
	urlTextField.setAllowBlank(false);
	vPanel.add(urlTextField);

	return vPanel;
}
 
Example 18
/**
 * Add content to the tooltip and show it with the given parameters.
 *
 * @param content a list of Labels
 * @param left the left position of the tooltip
 * @param top the top position of the tooltip
 */
public void addContentAndShow(List<Label> content, int left, int top) {

	// Add the content to the panel.
	for (Label l : content) {
		contentPanel.add(l);
	}

	// Finally set position of the tooltip and show it.
	toolTip.setPopupPosition(left, top);
	toolTip.show();

}
 
Example 19
Source Project: EasyML   Source File: JobDescPopupPanel.java    License: Apache License 2.0 5 votes vote down vote up
public JobDescPopupPanel(String title) {

		Label label = new Label(title);
		label.setStyleName("bda-newjob-head");
		verticalPanel.add(label);
		verticalPanel.add(createGrid());
		HorizontalPanel hpanel = new HorizontalPanel();

		hpanel.setStyleName("bda-newjob-hpanel");
		verticalPanel.add(errorLabel);
		Button cancelBtn = new Button(Constants.studioUIMsg.cancel());
		cancelBtn.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				JobDescPopupPanel.this.hide();
			}

		});

		hpanel.add(submitBtn);
		hpanel.add(cancelBtn);
		submitBtn.removeStyleName("gwt-Button");
		cancelBtn.removeStyleName("gwt-Button");
		submitBtn.addStyleName("button-style");
		cancelBtn.addStyleName("button-style");
		errorLabel.setStyleName("error-label");
		verticalPanel.add(hpanel);
		verticalPanel.addStyleName("bda-newjob");
		this.setCloseEnable(false);
	}
 
Example 20
Source Project: EasyML   Source File: PopupRetDirLeaf.java    License: Apache License 2.0 5 votes vote down vote up
public PopupRetDirLeaf(String path)
{
	this.path = path;
	setName(path);
	label = new Label(getName());
	this.setWidget(label);
}
 
Example 21
Source Project: geowe-core   Source File: JoinDataDialog.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void getCSVComboPanel() {
	comboPanel = new HorizontalPanel();
	comboPanel.setWidth("100%");
	comboPanel.addStyleName(ThemeStyles.get().style().borderTop());
	comboPanel.setSpacing(5);
	comboPanel.setVisible(false);
	comboPanel.add(new Label(UIMessages.INSTANCE.bindableAttribute()));
	comboPanel.add(csvAttributeCombo);
}
 
Example 22
Source Project: EasyML   Source File: ScriptParameterPanel.java    License: 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 23
/**
 * 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 24
Source Project: EasyML   Source File: Pagination.java    License: 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 25
Source Project: swcv   Source File: SettingsPanel.java    License: 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;
}
 
Example 26
Source Project: appinventor-extensions   Source File: GalleryPage.java    License: 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 27
Source Project: gwt-material   Source File: MaterialInfo.java    License: 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 28
@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 29
Source Project: incubator-retired-wave   Source File: IconButtonTemplate.java    License: 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 30
Source Project: appinventor-extensions   Source File: ProjectList.java    License: 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();
}