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

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.Label. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: empiria.player   File: PageViewSocketImpl.java   View source code 6 votes vote down vote up
@Override
public void setPageViewCarrier(PageViewCarrier pageViewCarrier) {
    view.getTitlePanel().clear();
    view.getTitlePanel().add(pageViewCarrier.getPageTitle());
    if (pageViewCarrier.hasContent()) {
        Panel contentPanel = new FlowPanel();

        if (pageViewCarrier.pageType == PageType.ERROR) {
            contentPanel.setStyleName(styleNames.QP_PAGE_ERROR());
            Label errorLabel = new Label(pageViewCarrier.errorMessage);
            errorLabel.setStyleName(styleNames.QP_PAGE_ERROR_TEXT());
            contentPanel.add(errorLabel);
        }

        view.getItemsPanel().clear();
        view.getItemsPanel().add(contentPanel);
    }
}
 
Example 2
Project: EasyML   File: Leaf.java   View source code 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 3
Project: EasyML   File: ParameterPanel.java   View source code 6 votes vote down vote up
protected void initGridHead(int size){
	this.setSpacing(3);
	paramsGrid = new Grid(size, 3);

	paramsGrid.setStyleName("gridstyle");
	paramsGrid.setBorderWidth(1);
	paramsGrid.setWidth("250px");
	Label nameLabel = new Label(Constants.studioUIMsg.parameter());
	nameLabel.setWidth("65px");
	paramsGrid.setWidget(0, 0, nameLabel);

	Label typeLabel = new Label(Constants.studioUIMsg.type());
	typeLabel.setWidth("40px");
	paramsGrid.setWidget(0, 1, typeLabel);

	Label valueLabel = new Label(Constants.studioUIMsg.value());
	paramsGrid.setWidget(0, 2, valueLabel);
	paramsGrid.setVisible(false);
}
 
Example 4
Project: EasyML   File: BaseWidget.java   View source code 6 votes vote down vote up
public BaseWidget(String text, String id) {
	this.label = new Label(text);
	p.setWidget(new HTML(text));
	p.getElement().getStyle().setZIndex(6);
	this.id = id;

	label.setStyleName("basewidget");
	label.setTitle(text);

	canvas = new GWTCanvas();
	abspanel.add(label, 0, 0);
	abspanel.add(canvas, 0, 0);
	focusPanel.add(abspanel.asWidget());
	focusPanel.setHeight("35px");
	focusPanel.setFocus(true);
	focusPanel.setStyleName("basefocuspanel");
	abspanel.setHeight("100%");
	initWidget(focusPanel);

	addDomHandler(this, MouseDownEvent.getType());
	addDomHandler(this, MouseUpEvent.getType());
	addDomHandler(this, MouseOverEvent.getType());
	addDomHandler(this, MouseOutEvent.getType());


}
 
Example 5
Project: unitimes   File: InstructorAttributesTable.java   View source code 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 6
Project: unitimes   File: Client.java   View source code 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 7
Project: appinventor-extensions   File: GalleryPage.java   View source code 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the salvage section
 * @param container   The container that salvage label reside
 */
private void initSalvageSection(Panel container) { //TODO: Update the location of this button
  if (!canSalvage()) {                              // Permitted to salvage?
    return;
  }

  final Label salvagePrompt = new Label("salvage");
  salvagePrompt.addStyleName("primary-link");
  container.add(salvagePrompt);

  salvagePrompt.addClickHandler(new ClickHandler() {
    public void onClick(ClickEvent event) {
      final OdeAsyncCallback<Void> callback = new OdeAsyncCallback<Void>(
          // failure message
          MESSAGES.galleryError()) {
            @Override
            public void onSuccess(Void bool) {
              salvagePrompt.setText("done");
            }
        };
      Ode.getInstance().getGalleryService().salvageGalleryApp(app.getGalleryAppId(), callback);
    }
  });
}
 
Example 8
Project: unitimes   File: UniTimeVersion.java   View source code 6 votes vote down vote up
public UniTimeVersion() {
	iLabel = new Label();
	
	RPC.execute(new MenuInterface.VersionInfoRpcRequest(), new AsyncCallback<VersionInfoInterface>() {
		@Override
		public void onSuccess(VersionInfoInterface result) {
			iLabel.setText(MESSAGES.pageVersion(result.getVersion(), result.getReleaseDate()));
		}
		
		@Override
		public void onFailure(Throwable caught) {
		}
	});
	
	initWidget(iLabel);
}
 
Example 9
Project: unitimes   File: RestrictionsTable.java   View source code 6 votes vote down vote up
private void addConfig(Config config) {
	List<Widget> line = new ArrayList<Widget>();
	Node node = new Node(null, MESSAGES.labelConfiguration(config.getAbbv()), config);
	line.add(node);
	line.add(new Label(config.hasInstructionalMethod() ? config.getInstructionalMethod() : ""));
	line.add(new UniTimeTable.NumberCell(config.getLimit() == null ? MESSAGES.configUnlimited() : config.getLimit().toString()));
	line.add(new Label(""));
	line.add(new Label(""));
	line.add(new Label(""));
	line.add(new Label(""));
	iConfigs.put(config.getId(), node);
	node.setRow(addRow(node, line));
	for (Subpart subpart: config.getSubparts()) {
		if (subpart.getParentId() == null)
			addClasses(node, subpart, null);
	}
}
 
Example 10
Project: sig-seguimiento-vehiculos   File: BasicToolBar.java   View source code 6 votes vote down vote up
private void initializew3wPanel() {
	w3wPanel = new HorizontalPanel();
	w3wPanel.setSpacing(5);
	w3wPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	StyleInjector.inject(".w3wPanel { " + "background: #E0ECF8;"
			+ "border-radius: 5px 10px;" + "opacity: 0.8}");
	w3wPanel.setStyleName("w3wPanel");
	w3wPanel.setWidth("415px");

	wordsLabel = new Label();
	w3wAnchor = new AnchorBuilder().setHref("https://what3words.com/")
			.setText(UIMessages.INSTANCE.what3Words())
			.setTitle("https://what3words.com/").build();
	w3wAnchor.getElement().getStyle().setColor("#FF0000");
	w3wAnchor.setVisible(false);
	w3wPanel.add(w3wAnchor);
	w3wPanel.add(wordsLabel);
}
 
Example 11
Project: appinventor-extensions   File: PropertiesPanel.java   View source code 6 votes vote down vote up
/**
 * Creates a new properties panel.
 */
public PropertiesPanel() {
  // Initialize UI
  VerticalPanel outerPanel = new VerticalPanel();
  outerPanel.setWidth("100%");

  componentName = new Label("");
  componentName.setStyleName("ode-PropertiesComponentName");
  outerPanel.add(componentName);

  panel = new VerticalPanel();
  panel.setWidth("100%");
  panel.setStylePrimaryName("ode-PropertiesPanel");
  outerPanel.add(panel);

  initWidget(outerPanel);
}
 
Example 12
Project: appinventor-extensions   File: GalleryPage.java   View source code 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 13
Project: sig-seguimiento-vehiculos   File: OpenProjectDialog.java   View source code 6 votes vote down vote up
private FormPanel getFilePanel() {
	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("fileuploadzip.do");
	uploadPanel.setWidget(layoutContainer);

	return uploadPanel;
}
 
Example 14
Project: sig-seguimiento-vehiculos   File: JoinDataDialog.java   View source code 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 15
Project: sig-seguimiento-vehiculos   File: CustomExtentDialog.java   View source code 6 votes vote down vote up
private Widget createPanel() {
	
	VerticalLayoutContainer container = new VerticalLayoutContainer();
	container.setScrollMode(ScrollMode.AUTO);
	container.setSize("450px", "160px");
			
	Label bboxLabel = new Label("Bbox (" + UIMessages.INSTANCE.lowerLeftXField() + ", " + UIMessages.INSTANCE.lowerLeftYField() + 
			", " + UIMessages.INSTANCE.upperRightXField() + ", " + UIMessages.INSTANCE.upperRightYField() + ")");
	bboxLabel.getElement().getStyle().setFontWeight(FontWeight.BOLD);		
	container.add(bboxLabel);
	bboxField = new TextField();
	bboxField.setEmptyText(UIMessages.INSTANCE.bboxFieldCustomExtent());		
	bboxField.setWidth("450px");
	container.add(bboxField);	
	return container;
}
 
Example 16
Project: appinventor-extensions   File: SimpleNonVisibleComponentsPanel.java   View source code 6 votes vote down vote up
/**
 * Creates new component design panel for non-visible components.
 */
public SimpleNonVisibleComponentsPanel() {
  // Initialize UI
  VerticalPanel panel = new VerticalPanel();
  panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

  heading = new Label("");
  heading.setStyleName("ya-NonVisibleComponentsHeader");
  panel.add(heading);

  componentsPanel = new FlowPanel();
  componentsPanel.setStyleName("ode-SimpleUiDesignerNonVisibleComponents");
  panel.add(componentsPanel);

  initWidget(panel);
}
 
Example 17
Project: sig-seguimiento-vehiculos   File: CreateEmptyLayerTab.java   View source code 6 votes vote down vote up
public VerticalPanel getEmptyPanel() {
	VerticalPanel geoDataContainer = new VerticalPanel();
	geoDataContainer.setSpacing(5);
	geoDataContainer.setWidth("280px");
	geoDataContainer.setSpacing(5);
	geoDataContainer.add(new Label(UIMessages.INSTANCE
			.createEmptyLayerToolText()));

	createAttributes = new CheckBox();
	createAttributes.setBoxLabel(UIMessages.INSTANCE
			.celtAddAttributesLabel());
	createAttributes.setValue(false);

	geoDataContainer.add(createAttributes);
	return geoDataContainer;
}
 
Example 18
Project: calendar-component   File: SimpleDayCell.java   View source code 6 votes vote down vote up
public SimpleDayCell(VCalendar calendar, int row, int cell) {
    this.calendar = calendar;
    this.row = row;
    this.cell = cell;
    setStylePrimaryName("v-calendar-month-day");
    caption = new Label();
    caption.setStyleName("v-calendar-day-number");
    caption.addMouseDownHandler(this);
    caption.addMouseUpHandler(this);
    add(caption);

    bottomspacer = new HTML();
    bottomspacer.setStyleName("v-calendar-bottom-spacer-empty");
    bottomspacer.setWidth(3 + "em");
    add(bottomspacer);
}
 
Example 19
Project: empiria.player   File: ItemViewCarrier.java   View source code 5 votes vote down vote up
public ItemViewCarrier(String err) {
    errorView = new FlowPanel();
    errorView.setStyleName("qp-item-error");

    Label errorLabel = new Label(err);
    errorLabel.setStyleName("qp-item-error-text");
    errorView.add(errorLabel);
}
 
Example 20
Project: appinventor-extensions   File: ReportList.java   View source code 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 21
Project: empiria.player   File: SourceListViewItemContentFactory.java   View source code 5 votes vote down vote up
public IsWidget createSourceListContentWidget(SourcelistItemType type, String content, InlineBodyGeneratorSocket inlineBodyGeneratorSocket) {
    switch (type) {
        case IMAGE:
            return new Image(content);
        case TEXT:
            return new Label(content);
        case COMPLEX_TEXT:
            Node node = getNode(content);
            return inlineBodyGeneratorSocket.generateInlineBody(node);
    }

    return new Widget();
}
 
Example 22
Project: empiria.player   File: ItemController.java   View source code 5 votes vote down vote up
protected Widget createTitleWidget(String index, String text) {
    Panel titlePanel = new FlowPanel();
    titlePanel.setStyleName(styleNames.QP_ITEM_TITLE());
    Label indexLabel = new Label(index + ". ");
    indexLabel.setStyleName(styleNames.QP_ITEM_TITLE_INDEX());
    Label textLabel = new Label(text);
    textLabel.setStyleName(styleNames.QP_ITEM_TITLE_TEXT());
    titlePanel.add(indexLabel);
    titlePanel.add(textLabel);
    return titlePanel;
}
 
Example 23
Project: DocIT   File: DepartmentPanel.java   View source code 5 votes vote down vote up
private boolean validate() {
	resetFaultMessages();
	
	boolean valid = true;
	
	if (name.getText() == null || name.getText().length() == 0) {
		lNameFault.setText("*");
		faultMessages.add(new Label("Enter a valid name, please."));
		valid = false;
	}
	return valid;
}
 
Example 24
Project: DocIT   File: EmployeePanel.java   View source code 5 votes vote down vote up
private boolean validate() {
	resetFaultMessages();
	
	boolean valid = true;
	
	if (name.getText() == null || name.getText().length() == 0) {
		lNameFault.setText("*");
		faultMessages.add(new Label("Enter a valid name, please."));
		valid = false;
	}
	if (address.getText() == null || address.getText().length() == 0) {
		lAddressFault.setText("*");
		faultMessages.add(new Label("Enter a valid address, please."));
		valid = false;
	}
	if (total.getText() == null || total.getText().length() == 0) {
		lSalaryFault.setText("*");
		faultMessages.add(new Label("Enter a valid salary, please."));
		valid = false;
	} else {
		try {
			Double.parseDouble(total.getText());
		} catch (NumberFormatException e) {
			lSalaryFault.setText("*");
			faultMessages.add(new Label("Enter a valid salary, please."));
			valid = false;
		}
	}
	if (parent.getSelectedIndex() == 0) {
		lParentFault.setText("*");
		faultMessages.add(new Label("Select a valid parent department, please."));
		valid = false;
	}

	return valid;
}
 
Example 25
Project: appinventor-extensions   File: GalleryGuiFactory.java   View source code 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.setUrl(GalleryApp.DEFAULTGALLERYIMAGE);
    }
  });
  String url = gallery.getCloudImageURL(app.getGalleryAppId());
  image.setUrl(url);

  if(gallery.getSystemEnvironment() != null &&
      gallery.getSystemEnvironment().toString().equals("Development")){
    final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(String newUrl) {
          image.setUrl(newUrl + "?" + System.currentTimeMillis());
        }
      };
    Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
  }
}
 
Example 26
Project: calendar-component   File: SimpleDayCell.java   View source code 5 votes vote down vote up
@Override
public void onMouseDown(MouseDownEvent event) {

    if (calendar.isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
        return;
    }

    Widget w = (Widget) event.getSource();
    clickedWidget = w;

    if (w instanceof MonthItemLabel) {

        // event clicks should be allowed even when read-only
        monthEventMouseDown = true;

        if (calendar.isItemMoveAllowed()
                && ((MonthItemLabel)w).getCalendarItem().isMoveable()) {
            startCalendarItemDrag(event, (MonthItemLabel) w);
        }

    } else if (w == bottomspacer) {

        if (extended) {
            setLimitedCellHeight();
        } else {
            setUnlimitedCellHeight();
        }

        reDraw(true);

    } else if (w instanceof Label) {
        labelMouseDown = true;

    } else if (w == this && !extended) {

        MonthGrid grid = getMonthGrid();
        if (grid.isEnabled() && calendar.isRangeSelectAllowed()) {
            grid.setSelectionStart(this);
            grid.setSelectionEnd(this);
        }
    }

    event.stopPropagation();
    event.preventDefault();
}
 
Example 27
Project: appinventor-extensions   File: CopyYoungAndroidProjectCommand.java   View source code 5 votes vote down vote up
private Widget createPreviousCheckpointsTable(List<Project> checkpointProjects) {
  Grid table = new Grid(1 + checkpointProjects.size(), 3);
  table.addStyleName("ode-ProjectTable");

  // Set the widgets for the header row.
  table.getRowFormatter().setStyleName(0, "ode-ProjectHeaderRow");
  table.setWidget(0, 0, new Label(MESSAGES.projectNameHeader()));
  table.setWidget(0, 1, new Label(MESSAGES.projectDateCreatedHeader()));
  table.setWidget(0, 2, new Label(MESSAGES.projectDateModifiedHeader()));

  // Set the widgets for the rows representing previous checkpoints
  DateTimeFormat dateTimeFormat = DateTimeFormat.getMediumDateTimeFormat();
  int row = 1;
  for (Project checkpointProject : checkpointProjects) {
    table.getRowFormatter().setStyleName(row, "ode-ProjectRowUnHighlighted");
    Label nameLabel = new Label(checkpointProject.getProjectName());
    table.setWidget(row, 0, nameLabel);

    Date dateCreated = new Date(checkpointProject.getDateCreated());
    table.setWidget(row, 1, new Label(dateTimeFormat.format(dateCreated)));

    Date dateModified = new Date(checkpointProject.getDateModified());
    table.setWidget(row, 2, new Label(dateTimeFormat.format(dateModified)));
    row++;
  }

  return table;
}
 
Example 28
Project: EasyML   File: PropertyTable.java   View source code 5 votes vote down vote up
public PropertyTable(int rows, int cols) {
	super();

	grid = new Grid(rows, cols);
	vp = new VerticalPanel();
	this.setAlwaysShowScrollBars(false);
	this.setSize("100%", "80%");
	vp.setBorderWidth(0);
	vp.add(grid);
	this.add(vp);
	properties = new HashMap<Property, Label>();
}
 
Example 29
Project: EasyML   File: PropertyTable.java   View source code 5 votes vote down vote up
public void addProperty(Property p, int row) {
	grid.setWidget(row, 0, new Label(p.getName()));

	Label box = new Label();
	box.setText(p.getValue());
	grid.setWidget(row, 1, box);
	box.setStyleName("propetybox");
	properties.put(p, box);
}
 
Example 30
Project: EasyML   File: JobDescPopupPanel.java   View source code 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 31
Project: appinventor-extensions   File: ColumnLayout.java   View source code 5 votes vote down vote up
@Override
public void apply(WorkAreaPanel workArea) {

  // Clear base panel
  workArea.clear();

  // Horizontal panel to hold columns
  HorizontalPanel horizontalPanel = new HorizontalPanel();
  horizontalPanel.setSize("100%", "100%");
  workArea.add(horizontalPanel);

  // Initialize columns
  for (Column column : columns) {
    horizontalPanel.add(column.columnPanel);
    workArea.getWidgetDragController().registerDropController(column);

    // Add invisible dummy widget to prevent column from collapsing when it contains no boxes
    column.columnPanel.add(new Label());

    // Add boxes from layout
    List<BoxDescriptor> boxes = column.boxes;
    for (int index = 0; index < boxes.size(); index++) {
      BoxDescriptor bd = boxes.get(index);
      Box box = workArea.createBox(bd);
      if (box != null) {
        column.insert(box, index);
        box.restoreLayoutSettings(bd);
      }
    }
  }

  workArea.getWidgetDragController().addDragHandler(changeDetector);
}
 
Example 32
Project: EasyML   File: PopupRetDirLeaf.java   View source code 5 votes vote down vote up
public PopupRetDirLeaf(String path)
{
	this.path = path;
	setName(path);
	label = new Label(getName());
	this.setWidget(label);
}
 
Example 33
Project: appinventor-extensions   File: ComponentImportWizard.java   View source code 5 votes vote down vote up
private Grid createUrlGrid() {
  TextBox urlTextBox = new TextBox();
  urlTextBox.setWidth("100%");
  Grid grid = new Grid(2, 1);
  grid.setWidget(0, 0, new Label("Url:"));
  grid.setWidget(1, 0, urlTextBox);
  return grid;
}
 
Example 34
Project: EasyML   File: SqlScriptFileConfigTable.java   View source code 5 votes vote down vote up
public void deleteRow(int row){
	this.removeRow(row);
	for( int i = row; i < this.getRowCount() - 1; ++ i ){
		Label label = (Label)this.getWidget(i,0);
		label.setText(name + " " + i);
	}
	active();
}
 
Example 35
Project: appinventor-extensions   File: PropertiesPanel.java   View source code 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 36
Project: EasyML   File: Pagination.java   View source code 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 37
Project: unitimes   File: InstructorsTable.java   View source code 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 38
Project: unitimes   File: RoomGroupsTable.java   View source code 5 votes vote down vote up
protected Widget getCell(final GroupInterface group, final RoomGroupsColumn column, final int idx) {
	switch (column) {
	case NAME:
		return new Label(group.getLabel() == null ? "" : group.getLabel(), false);
	case ABBREVIATION:
		return new Label(group.getAbbreviation() == null ? "" : group.getAbbreviation(), false);
	case DEFAULT:
		if (group.isDefault())
			return new Image(RESOURCES.on());
		else
			return null;
	case DEPARTMENT:
		return new DepartmentCell(true, group.getDepartment());
	case DESCRIPTION:
		if (group.hasDescription()) {
			HTML html = new HTML(group.getDescription());
			html.setStyleName("description");
			return html;
		} else
			return null;
	case ROOMS:
		if (group.hasRooms())
			return new RoomsCell(group);
		else
			return null;
	default:
		return null;
	}
}
 
Example 39
Project: unitimes   File: RoomFeaturesTable.java   View source code 5 votes vote down vote up
protected Widget getCell(final FeatureInterface feature, final RoomFeaturesColumn column, final int idx) {
	switch (column) {
	case NAME:
		return new Label(feature.getLabel() == null ? "" : feature.getLabel(), false);
	case ABBREVIATION:
		return new Label(feature.getAbbreviation() == null ? "" : feature.getAbbreviation(), 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 DEPARTMENT:
		return new DepartmentCell(true, feature.getDepartment());
	case DESCRIPTION:
		if (feature.hasDescription()) {
			HTML html = new HTML(feature.getDescription());
			html.setStyleName("description");
			return html;
		} else
			return null;
	case ROOMS:
		if (feature.hasRooms())
			return new RoomsCell(feature);
		else
			return null;
	default:
		return null;
	}
}
 
Example 40
Project: appinventor-extensions   File: MockForm.java   View source code 5 votes vote down vote up
TitleBar() {
  title = new Label();
  title.setStylePrimaryName("ode-SimpleMockFormTitle");
  title.setHorizontalAlignment(Label.ALIGN_LEFT);

  bar = new AbsolutePanel();
  bar.add(title, 12, 4);

  initWidget(bar);

  setStylePrimaryName("ode-SimpleMockFormTitleBar");
  setSize("100%", HEIGHT + "px");
}