Java Code Examples for com.google.gwt.user.client.ui.SimplePanel#setStylePrimaryName()

The following examples show how to use com.google.gwt.user.client.ui.SimplePanel#setStylePrimaryName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: appinventor-extensions   File: MockBall.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new MockBall component.
 *
 * @param editor  editor of source file the component belongs to
 */
public MockBall(SimpleEditor editor) {
  super(editor, TYPE, images.ball());

  // Initialize mock ball UI
  ballWidget = new SimplePanel();
  ballWidget.setStylePrimaryName("ode-SimpleMockComponent");

  // Create an appropriately sized ball
  canvas = new GWTCanvas(diameter, diameter);
  canvas.setPixelSize(diameter, diameter);
  canvas.setBackgroundColor(GWTCanvas.TRANSPARENT);
  fillCircle();
  ballWidget.setWidget(canvas);

  initComponent(ballWidget);
}
 
Example 2
Source Project: calendar-component   File: WeekGrid.java    License: Apache License 2.0 5 votes vote down vote up
public WeekGrid(VCalendar parent, boolean format24h) {
    setCalendar(parent);
    content = new HorizontalPanel();
    timebar = new Timebar(format24h);
    content.add(timebar);

    wrapper = new SimplePanel();
    wrapper.setStylePrimaryName("v-calendar-week-wrapper");
    wrapper.add(content);

    setWidget(wrapper);
}
 
Example 3
Source Project: calendar-component   File: WeekGrid.java    License: Apache License 2.0 5 votes vote down vote up
private void setVerticalScroll(boolean isVerticalScrollEnabled) {
    if (isVerticalScrollEnabled && !(isVerticalScrollable())) {
        verticalScrollEnabled = true;
        horizontalScrollEnabled = false;
        wrapper.remove(content);

        final ScrollPanel scrollPanel = new ScrollPanel();
        scrollPanel.setStylePrimaryName("v-calendar-week-wrapper");
        scrollPanel.setWidget(content);

        scrollPanel.addScrollHandler(event -> {
            if (calendar.getScrollListener() != null) {
                int vScrollPos = scrollPanel.getVerticalScrollPosition();
                calendar.getScrollListener().scroll(vScrollPos);

                if (vScrollPos > 1) {
                    content.addStyleName("scrolled");
                } else {
                    content.removeStyleName("scrolled");
                }
            }
        });

        setWidget(scrollPanel);
        wrapper = scrollPanel;

    } else if (!isVerticalScrollEnabled && (isVerticalScrollable())) {
        verticalScrollEnabled = false;
        horizontalScrollEnabled = false;
        wrapper.remove(content);

        SimplePanel simplePanel = new SimplePanel();
        simplePanel.setStylePrimaryName("v-calendar-week-wrapper");
        simplePanel.setWidget(content);

        setWidget(simplePanel);
        wrapper = simplePanel;
    }
}
 
Example 4
/**
 * Creates a new MockVideoPlayer component.
 *
 * @param editor  editor of source file the component belongs to
 */
public MockVideoPlayer(SimpleEditor editor) {
  super(editor, TYPE, images.videoplayer());

  // Initialize mock video UI
  videoPlayerWidget = new SimplePanel();
  videoPlayerWidget.setStylePrimaryName("ode-SimpleMockComponent");
  videoPlayerWidget.setWidget(getIconImage());
  initComponent(videoPlayerWidget);
}
 
Example 5
MockWrapper(SimpleEditor editor, String type, ImageResource icon) {
  super(editor, type, icon);

  // Initialize wrapper UI
  wrapper = new SimplePanel();
  wrapper.setStylePrimaryName("ode-SimpleMockComponent");
}
 
Example 6
private void createLabelPanel() {
  panelForItem =new SimplePanel();
  panelForItem.setStylePrimaryName("listViewItemStyle");
  panelForItem.setSize(ComponentConstants.LISTVIEW_PREFERRED_WIDTH + "px",
      ComponentConstants.LISTVIEW_PREFERRED_HEIGHT + "px");
  panelForItem.add(labelInItem);
  listViewWidget.add(panelForItem);
}
 
Example 7
/**
 * Creates a new MockSlider component.
 *
 * @param editor editor of source file the component belongs to
 */
public MockSlider(SimpleEditor editor) {
  super(editor, TYPE, images.slider());

  // Initialize mock slider UI
  sliderWidget = new SimplePanel();
  sliderWidget.setStylePrimaryName("ode-SimpleMockComponent");

  sliderWidget.setWidget(getIconImage());

  initComponent(sliderWidget);
}
 
Example 8
public MockFeatureCollection(SimpleEditor editor) {
  super(editor, TYPE, images.featurecollection(), new MockFeatureCollectionLayout());

  SimplePanel panel = new SimplePanel();
  panel.setWidth("16px");
  panel.setHeight("16px");
  panel.setStylePrimaryName("ode-SimpleMockComponent");
  Image icon = new Image(images.featurecollection());
  panel.add(icon);

  initComponent(panel);
  initCollection();
  initialized = true;
}
 
Example 9
/**
 * Creates a new MockWebViewer component.
 *
 * @param editor  editor of source file the component belongs to
 */
public MockWebViewer(SimpleEditor editor) {
  super(editor, TYPE, images.webviewer());

  // Initialize mock WebViewer UI
  SimplePanel webViewerWidget = new SimplePanel();
  webViewerWidget.setStylePrimaryName("ode-SimpleMockContainer");
  // TODO(halabelson): Center vertically as well as horizontally
  webViewerWidget.addStyleDependentName("centerContents");
  webViewerWidget.setWidget(largeImage);
  initComponent(webViewerWidget);
}
 
Example 10
MockMapFeatureBase(SimpleEditor editor, String type, ImageResource icon) {
  super(editor, type, icon);
  panel = new SimplePanel();
  panel.setStylePrimaryName("ode-SimpleMockComponent");
  initComponent(panel);
  this.unsinkEvents(Event.MOUSEEVENTS);
}