Java Code Examples for com.google.gwt.user.client.ui.Label#setStyleName()

The following examples show how to use com.google.gwt.user.client.ui.Label#setStyleName() . 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: SimpleDayCell.java    From calendar-component with Apache License 2.0 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 2
Source File: PropertiesPanel.java    From appinventor-extensions with Apache License 2.0 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 3
Source File: SimpleNonVisibleComponentsPanel.java    From appinventor-extensions with Apache License 2.0 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 4
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("×");
	iButton.setStyleName("button");
	add(iButton);
	if (chip.hasToolTip())
		setTitle(toString() + "\n" + chip.getToolTip());
	else
		setTitle(toString());
	Roles.getDocumentRole().setAriaHiddenState(getElement(), true);
}
 
Example 5
Source File: HostSelector.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {

        VerticalPanel layout = new VerticalPanel();
        layout.getElement().setId("host_selection");
        layout.getElement().setAttribute("title", Console.CONSTANTS.pleaseChoseHost());
        layout.setStyleName("fill-layout-width");
        layout.addStyleName("lhs-selector");
        layout.getElement().setAttribute("style", "padding:4px;");

        hosts = new ComboPicker();
        hosts.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(final ValueChangeEvent<String> event) {
                if (!event.getValue().isEmpty()) {
                    Scheduler.get().scheduleDeferred(
                            new Scheduler.ScheduledCommand() {
                                @Override
                                public void execute() {
                                    Console.getCircuit().dispatch(new HostSelection(hosts.getSelectedValue()));
                                }
                            }
                    );
                }
            }
        });

        Label hostLabel = new Label("Host:");
        hostLabel.setStyleName("header-label");
        layout.add(hostLabel);
        Widget hWidget = hosts.asWidget();
        hWidget.getElement().addClassName("table-picker");
        layout.add(hWidget);

        // combo box use all available space
        hWidget.getElement().getParentElement().setAttribute("width", "100%");

        return layout;
    }
 
Example 6
Source File: PropertyTable.java    From EasyML with Apache License 2.0 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 7
Source File: ServerSwitch.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Widget asWidget() {
    HorizontalPanel layout = new HorizontalPanel();
    layout.setStyleName("fill-layout-width");

    layout.add(new ContentHeaderLabel("Transaction Metrics"));

    serverSelection= new ComboBox();
    serverSelection.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {

        }
    });

    HorizontalPanel inner = new HorizontalPanel();
    inner.setStyleName("fill-layout-width");

    Label label = new Label("Server: ");
    label.setStyleName("header-label");
    inner.add(label);
    label.getElement().getParentElement().setAttribute("align", "right");

    Widget widget = serverSelection.asWidget();
    inner.add(widget);
    widget.getElement().getParentElement().setAttribute("with", "100%");

    layout.add(inner);

    return layout;
}
 
Example 8
Source File: NamedGroupRenderer.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Widget renderPlain(RenderMetaData metaData, String groupName, PlainFormView plainView) {
    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.renderPlain(metaData, groupName, plainView));
    return panel;
}
 
Example 9
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 10
Source File: DebugPanelFilterTrail.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 11
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 12
Source File: DesignToolbar.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes and assembles all commands into buttons in the toolbar.
 */
public DesignToolbar() {
  super();

  isReadOnly = Ode.getInstance().isReadOnly();

  projectNameLabel = new Label();
  projectNameLabel.setStyleName("ya-ProjectName");
  HorizontalPanel toolbar = (HorizontalPanel) getWidget();
  toolbar.insert(projectNameLabel, 0);

  // width of palette minus cellspacing/border of buttons
  toolbar.setCellWidth(projectNameLabel, "222px");

  addButton(new ToolbarItem(WIDGET_NAME_TUTORIAL_TOGGLE,
      MESSAGES.toggleTutorialButton(), new ToogleTutorialAction()));
  setButtonVisible(WIDGET_NAME_TUTORIAL_TOGGLE, false); // Don't show unless needed

  List<DropDownItem> screenItems = Lists.newArrayList();
  addDropDownButton(WIDGET_NAME_SCREENS_DROPDOWN, MESSAGES.screensButton(), screenItems);

  if (AppInventorFeatures.allowMultiScreenApplications() && !isReadOnly) {
    addButton(new ToolbarItem(WIDGET_NAME_ADDFORM, MESSAGES.addFormButton(),
        new AddFormAction()));
    addButton(new ToolbarItem(WIDGET_NAME_REMOVEFORM, MESSAGES.removeFormButton(),
        new RemoveFormAction()));
  }

  addButton(new ToolbarItem(WIDGET_NAME_SWITCH_TO_FORM_EDITOR,
      MESSAGES.switchToFormEditorButton(), new SwitchToFormEditorAction()), true);
  addButton(new ToolbarItem(WIDGET_NAME_SWITCH_TO_BLOCKS_EDITOR,
      MESSAGES.switchToBlocksEditorButton(), new SwitchToBlocksEditorAction()), true);

  // Gray out the Designer button and enable the blocks button
  toggleEditor(false);
  Ode.getInstance().getTopToolbar().updateFileMenuButtons(0);
}
 
Example 13
Source File: JobDescPopupPanel.java    From EasyML with 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 14
Source File: GwtDebugPanelFilters.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected static Label createFormLabel(String text) {
  Label label = new Label(text);
  label.setStyleName(Utils.style() + "-filterSettingsLabel");
  return label;
}
 
Example 15
Source File: VerticalBorderPanel.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Vertical Border Panel
 */
public VerticalBorderPanel() {
	leftBar = new Label();
	leftBar.setStyleName("okm-VerticalBorderPanel");
	initWidget(leftBar);
}
 
Example 16
Source File: DebugPanelFilterConfigWidget.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private Widget getTitle(DebugPanelFilter filter) {
  Label label = new Label(filter.getSettingsTitle());
  label.setStyleName(Utils.style() + "-filterSettingsTitle");
  return label;
}
 
Example 17
Source File: DebugPanelFilterConfigWidget.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private Widget getDescription(DebugPanelFilter filter) {
  Label label = new Label(filter.getDescription());
  label.setStyleName(Utils.style() + "-filterSettingsDescription");
  return label;
}
 
Example 18
Source File: GalleryPage.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method called by constructor to initialize the report section
 */
private void initReportSection() {
  final HTML reportPrompt = new HTML();
  reportPrompt.setHTML(MESSAGES.galleryReportPrompt());
  reportPrompt.addStyleName("primary-prompt");
  final TextArea reportText = new TextArea();
  reportText.addStyleName("action-textarea");
  final Button submitReport = new Button(MESSAGES.galleryReportButton());
  submitReport.addStyleName("action-button");
  final Label descriptionError = new Label();
  descriptionError.setText("Description required");
  descriptionError.setStyleName("ode-ErrorMessage");
  descriptionError.setVisible(false);
  appReportPanel.add(reportPrompt);
  appReportPanel.add(descriptionError);
  appReportPanel.add(reportText);
  appReportPanel.add(submitReport);

  final OdeAsyncCallback<Boolean> isReportdByUserCallback = new OdeAsyncCallback<Boolean>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(Boolean isAlreadyReported) {
          if(isAlreadyReported) { //already reported, cannot report again
            reportPrompt.setHTML(MESSAGES.galleryAlreadyReportedPrompt());
            reportText.setVisible(false);
            submitReport.setVisible(false);
            submitReport.setEnabled(false);
          } else {
            submitReport.addClickHandler(new ClickHandler() {
              public void onClick(ClickEvent event) {
                final OdeAsyncCallback<Long> reportClickCallback = new OdeAsyncCallback<Long>(
                    // failure message
                    MESSAGES.galleryError()) {
                      @Override
                      public void onSuccess(Long id) {
                        reportPrompt.setHTML(MESSAGES.galleryReportCompletionPrompt());
                        reportText.setVisible(false);
                        submitReport.setVisible(false);
                        submitReport.setEnabled(false);
                      }
                  };
                if (!reportText.getText().trim().isEmpty()){
                  Ode.getInstance().getGalleryService().addAppReport(app, reportText.getText(),
                    reportClickCallback);
                  descriptionError.setVisible(false);
                } else {
                  descriptionError.setVisible(true);
                }
              }
            });
          }
        }
    };
  Ode.getInstance().getGalleryService().isReportedByUser(app.getGalleryAppId(),
      isReportdByUserCallback);
}
 
Example 19
Source File: ProfileSelector.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Widget asWidget() {


        VerticalPanel layout = new VerticalPanel();
        layout.getElement().setId("profile_selection");
        layout.getElement().setAttribute("title", "Please chose a configuration profile");
        layout.setStyleName("fill-layout-width");
        layout.addStyleName("lhs-selector");
        layout.getElement().setAttribute("style","padding:4px;");

        profiles = new ComboPicker();
        profiles.addValueChangeHandler(new ValueChangeHandler<String>() {
            @Override
            public void onValueChange(final ValueChangeEvent<String> event) {

                if(event.getValue()!=null && !event.getValue().equals(""))
                {
                    Scheduler.get().scheduleDeferred(
                            new Scheduler.ScheduledCommand() {
                                @Override
                                public void execute() {
                                    Console.getEventBus().fireEvent(
                                            new ProfileSelectionEvent(event.getValue())
                                    );
                                }
                            });
                }
            }
        });

        Label profileLabel = new Label(Console.CONSTANTS.common_label_profile()+":");
        profileLabel.setStyleName("header-label");
        layout.add(profileLabel);
        Widget hWidget = profiles.asWidget();
        hWidget.getElement().addClassName("table-picker");
        layout.add(hWidget);

        // the combox box use all available space
        hWidget.getElement().getParentElement().setAttribute("width", "100%");


        return layout;
    }