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

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.SimplePanel. 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: errai-spring-boot-sample   File: App.java   View source code 6 votes vote down vote up
@AfterInitialization
public void afterInitialization() {
    authenticationServiceCaller.call(new RemoteCallback<User>() {
        @Override
        public void callback(User user) {
            Label userLabel = new Label(
                    "User logged in: username=" + user.getIdentifier() + ", roles=" + user.getRoles());
            RootPanel.get().add(userLabel);
            SimplePanel panel = new SimplePanel();
            Anchor logoutLink = new Anchor("Spring Security Logout URL", GWT.getHostPageBaseURL() + "logout");
            panel.add(logoutLink);
            RootPanel.get().add(panel);
            initBtns();
        }
    }).getUser();
}
 
Example 2
Project: EasyML   File: SaveDatasetPanel.java   View source code 6 votes vote down vote up
@Override
protected void init(){
	grid = new DescribeGrid(labarr, "data");
	verticalPanel.add(grid);
	grid.addStyleName("bda-descgrid-savedata");
	savebtn.setStyleName("bda-descgrid-savedata-submitbtn");
	SimplePanel simPanel = new SimplePanel();
	simPanel.add( savebtn );
	simPanel.setStyleName("bda-descgrid-savedata-simpanel");
	verticalPanel.add(simPanel);
	savebtn.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			dbController.submitSaveDataset2DB(panel,SaveDatasetPanel.this, dataset,grid);
		}
	});
}
 
Example 3
Project: appinventor-extensions   File: MockBall.java   View source code 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 4
Project: WebConsole   File: SliderComponent.java   View source code 6 votes vote down vote up
public Thumb() {
	visibleThumb = new SimplePanel();
	Element visibleElem = visibleThumb.getElement();
	Element touchElem = getElement();
	
	visibleThumb.setStylePrimaryName(THUMB_CLASS_NAME);
	
	BrowserUtils.setStyleAttributeAllBrowsers(visibleElem, "boxSizing", "border-box");
	BrowserUtils.setStyleAttributeAllBrowsers(touchElem, "boxSizing", "border-box");

	this.setWidget(visibleThumb);
	
	if (!isPassive)
	{
		visibleThumb.addStyleName(INTERACTIVE_CLASS_NAME);
	}
}
 
Example 5
Project: cuba   File: EscKeyDownHandler.java   View source code 6 votes vote down vote up
@Override
public void onKeyDown(KeyDownEvent keyDownEvent) {

    if (keyDownEvent.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {

        SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class);

        if (panel != null) {
            WidgetUtil.focus(panel.getParent().getElement());

            // prevent further bubbling of the event as it has only
            // navigational purpose if thrown at this depth. A subsequent
            // press of ESC is not stopped, so ESC abort actions of the
            // application should work as soon as the focus is in
            // "navigational mode" on a grid-cell
            keyDownEvent.preventDefault();
            keyDownEvent.stopPropagation();
        }
    }
}
 
Example 6
Project: cuba   File: ComponentRenderer.java   View source code 6 votes vote down vote up
@Override
public void render(RendererCellReference rendererCellReference, final ComponentConnector componentConnector,
                   final SimplePanel panel) {
    if (componentConnector != null) {

        // render chart widgets deferred so measurements are correct. Do not render
        // normal component widgets deferred as it causes some flicker when rerendering the grid
        if (componentConnector.getClass().getName().equals("com.vaadin.addon.charts.shared.ChartConnector")) {
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    panel.setWidget(componentConnector.getWidget());
                }
            });
        } else {
            panel.setWidget(componentConnector.getWidget());
        }
    } else {
        panel.clear();
    }
}
 
Example 7
Project: cuba   File: CubaWidgetsTreeWidget.java   View source code 6 votes vote down vote up
public void setNodeWidget(Widget nodeWidget) {
    this.nodeWidget = nodeWidget;

    addStyleName(CLASSNAME);

    nodeCaptionDiv = DOM.createDiv();
    nodeCaptionDiv.setPropertyString("className", CLASSNAME + "-caption");

    Element wrapper = DOM.createDiv();
    nodeCaptionSpan = DOM.createSpan();
    DOM.appendChild(getElement(), nodeCaptionDiv);
    DOM.appendChild(nodeCaptionDiv, wrapper);
    DOM.appendChild(wrapper, nodeCaptionSpan);

    if (BrowserInfo.get().isOpera()) {
        /*
         * Focus the caption div of the node to get keyboard navigation
         * to work without scrolling up or down when focusing a node.
         */
        nodeCaptionDiv.setTabIndex(-1);
    }

    FlowPanel nodeContent = new FlowPanel();
    nodeContent.setStylePrimaryName(CLASSNAME + "-content");
    setWidget(nodeContent);

    nodeWidgetRoot = new SimplePanel();
    nodeWidgetRoot.setStylePrimaryName(CLASSNAME + "-widget");
    nodeWidgetRoot.setWidget(nodeWidget);
    nodeContent.add(nodeWidgetRoot);

    childNodeContainer = new FlowPanel();
    childNodeContainer.setStyleName(CLASSNAME + "-children");
    nodeContent.add(childNodeContainer);
}
 
Example 8
Project: che   File: NotificationPopup.java   View source code 6 votes vote down vote up
/**
 * Create icon wrapper that contains an icon.
 *
 * @return {@link SimplePanel} as icon wrapper
 */
private SimplePanel createIconWidget() {
  SimplePanel iconWrapper = new SimplePanel();
  iconWrapper.setStyleName(resources.notificationCss().notificationPopupIconWrapper());
  iconWrapper.ensureDebugId(ICON_DBG_ID + notification.getId());
  return iconWrapper;
}
 
Example 9
Project: che   File: NotificationContainerItem.java   View source code 6 votes vote down vote up
/**
 * Create close icon widget that contains an close notification icon.
 *
 * @return {@link SimplePanel} as close icon wrapper
 */
private SimplePanel createCloseWidget() {
  SimplePanel closeWrapper = new SimplePanel();
  SVGImage closeImage = new SVGImage(resources.closeIcon());
  closeImage.addClickHandler(
      new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          delegate.onClose(notification);
        }
      });
  closeWrapper.add(closeImage);
  closeWrapper.setStyleName(resources.notificationCss().notificationCloseButtonWrapper());
  closeImage.ensureDebugId(CLOSE_ICON_DBG_ID + notification.getId());
  return closeWrapper;
}
 
Example 10
Project: componentrenderer   File: ComponentRenderer.java   View source code 6 votes vote down vote up
@Override
public void render(RendererCellReference rendererCellReference, final ComponentConnector componentConnector,
                   final SimplePanel panel)
{
    if (componentConnector != null) {

        // render chart widgets deferred so measurements are correct. Do not render
        // normal component widgets deferred as it causes some flicker when rerendering the grid
        if (componentConnector.getClass().getName().equals("com.vaadin.addon.charts.shared.ChartConnector")) {
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    panel.setWidget(componentConnector.getWidget());
                }
            });
        } else {
            panel.setWidget(componentConnector.getWidget());
        }
    } else {
        panel.clear();
    }
}
 
Example 11
Project: riscoss-corporate   File: RolePropertyPage.java   View source code 6 votes vote down vote up
public RolePropertyPage() {
	HorizontalPanel toolbar = new HorizontalPanel();
	toolbar.add( new Button( "Add User", new ClickHandler() {
		@Override
		public void onClick( ClickEvent event ) {
			onNewUserClicked();
		}
	} ) );
	
	userList = new UserList("");
	
	DockPanel dock = new DockPanel();
	dock.add( toolbar,DockPanel.NORTH );
	dock.add( userList, DockPanel.CENTER );
	
	tabPanel.add( new SimplePanel(), "Role Properties" );
	tabPanel.add( dock, "Users" );
	
	panel.setWidget( tabPanel );
}
 
Example 12
Project: riscoss-corporate   File: ComparisonPanel.java   View source code 6 votes vote down vote up
protected void generateLegend(int i, String ras) {
	String c = "col" + i;
	HTMLPanel html = new HTMLPanel("<span id='" + c + "'></span>");
	SimplePanel p = new SimplePanel();
	p.setSize("20px", "20px");
	p.getElement().getStyle().setBackgroundColor(colorsArray[i]);
	p.setStyleName("colorBox");
	HorizontalPanel hp = new HorizontalPanel();
	hp.setStyleName("margin-bottom");
	hp.add(p);
	String htmlString = "<b>" + ras + "</b>";
	HTMLPanel htm = new HTMLPanel( htmlString );
	hp.add(htm);
	html.add(hp, c);
	legend.add(html);
}
 
Example 13
Project: riscoss-corporate   File: ComparisonPanel.java   View source code 6 votes vote down vote up
protected Widget generateIndicatorWidget(JSONObject v) {
	VerticalPanel panel = new VerticalPanel();
	GaugeImage img = new GaugeImage();
	img.setEvidence( v.get( "p" ).isString().stringValue(), v.get( "m" ).isString().stringValue() );
	SimplePanel pp = new SimplePanel();
	pp.setWidget(img);
	pp.setStyleName("contentResultsTable");
	panel.add(pp);
	panel.add( new HTML( 
			"Exposure: <font color='red'>" + 
					v.get( "e" ).isObject().get( "e" ).isNumber().doubleValue() +
			"</font>") );
	panel.setStyleName("headerTable");
	panel.setHeight("100%");
	return panel;
}
 
Example 14
Project: firefly   File: DummyInventoryUI.java   View source code 6 votes vote down vote up
public Widget makeUI() {
    final SimplePanel panel = new SimplePanel();
    GwtUtil.setStyle(panel, "lineHeight", "100px");

    UserServices.App.getInstance().getMissionConfig("planck", new BaseCallback() {
        @Override
        public void doSuccess(Object result) {
            MissionTag dt = (MissionTag) result;
            List<ImageSetTag> iltag = dt.getImagesetList();
            if (iltag.size() > 0) {
                FormTag ftag = iltag.get(0).getForm();
                Form form = GwtUtil.createSearchForm(ftag, null, null);
                form.setStyleName("shadow");
                panel.add(form);
            }
        }
    });

    return GwtUtil.wrap(panel, 50, 50, 50, 20);
}
 
Example 15
Project: firefly   File: LSSTCatalogSearchUI.java   View source code 6 votes vote down vote up
public Widget makeUI() {
    spacialArea= new SpacialSelectUI(new SpacialSelectUI.TabChange() {
                public void onTabChange() {
                    adjustSpacialHeight();
                }
            });
    spacialArea.setSpacialOptions(new HashSet<SpacialType>(Arrays.asList(SpacialType.Cone, SpacialType.Box)), DataSetInfo.DataTypes.CATALOGS);
    spacialArea.updateSearchMax(3600);
    mainPanel.setSize("100%", "100%");

    topArea= new DockLayoutPanel(Style.Unit.PX);
    Widget spacialAreaWrap= new SimplePanel(spacialArea);
    topArea.add(spacialAreaWrap);
    mainPanel.addNorth(topArea, spacialArea.getHeightRequired());
    DOM.getParent(topArea.getElement()).addClassName("change-height-transition");
    return mainPanel;
}
 
Example 16
Project: firefly   File: SearchPanel.java   View source code 6 votes vote down vote up
private void layout() {

        formPanel.clear();
        navPanel.clear();

        if (lists.size()==1 && lists.get(0).getWidgetCount()==1) {
            navPanel.setVisible(false);
            if (navPanel.getParent() instanceof DockPanel) {
                DockPanel dp = (DockPanel)navPanel.getParent();
                dp.remove(navPanel);
            }
        }
        else {
            for (int i = 0; i < lists.size(); i++) {
                if (i != 0) {
                    SimplePanel spacer = new SimplePanel();
                    spacer.setPixelSize(1,10);
                    navPanel.add(spacer);
                }
                LinksPanel.ULList l = lists.get(i);
                if (l != null) {
                    navPanel.add(l);
                }
            }
        }        
    }
 
Example 17
Project: firefly   File: Toolbar.java   View source code 6 votes vote down vote up
public CmdButton(String name, Widget icon, Command cmd, String label, String desc) {
    this.name = name;
    this.command = cmd;
    this.name = name;
    String htmlstr = label == null ? name : label;
    html = new HTML(htmlstr);
    if (desc != null) {
        html.setTitle(desc);
    }
    this.command = cmd;
    html.setWordWrap(false);
    if (command instanceof GeneralCommand) {
        addListeners();
        setButtonEnabled(((GeneralCommand)command).isEnabled());
    }

    GwtUtil.setStyles(iconHolderLeft, "padding", "none", "marginRight", "3px");
    GwtUtil.setStyle(html, "padding", "6px 0");
    container = GwtUtil.makeHoriPanel(null, null, iconHolderLeft, html, iconHolderRight);
    container.setCellVerticalAlignment(iconHolderLeft, VerticalPanel.ALIGN_MIDDLE);
    container.setCellVerticalAlignment(iconHolderRight, VerticalPanel.ALIGN_MIDDLE);
    setIconLeft(icon);
    setIconRight(null);
    GwtUtil.setStyle(container, "margin", "0px auto");
    initWidget(new SimplePanel(container));
}
 
Example 18
Project: firefly   File: XYPlotJSInterface.java   View source code 6 votes vote down vote up
public static void addXYPlot(JscriptRequest jspr, String div) {
    Map<String,String> paramMap= jspr.asMap();
    WidgetFactory factory= Application.getInstance().getWidgetFactory();
    TablePreview xyPrev= factory.createObserverUI(WidgetFactory.XYPLOT,paramMap);
    xyPrev.bind(FFToolEnv.getHub());

    SimplePanel panel= makeCenter();
    panel.add(xyPrev.getDisplay());
    FFToolEnv.addToPanel(div, panel, "XY Plot");

    if (xyPrev.getDisplay() instanceof RequiresResize) {
        final RequiresResize resizer= (RequiresResize)xyPrev.getDisplay();
        Window.addResizeHandler(new ResizeHandler() {
            public void onResize(ResizeEvent event) {
                resizer.onResize();
            }
        });
    }
}
 
Example 19
Project: firefly   File: MiniPlotWidget.java   View source code 6 votes vote down vote up
public Panel makeFixedSizeContainer(int width, int height, boolean decorated) {

        SimplePanel panel= new SimplePanel();
        panel.setWidget(this);
        panel.setPixelSize(width,height);

        Panel retval= panel;

        if (decorated) {
            DecoratorPanel dp= new DecoratorPanel();
            dp.setWidget(panel);
            retval= dp;
        }
        return retval;

    }
 
Example 20
Project: appinventor-extensions   File: TopToolbar.java   View source code 5 votes vote down vote up
@Override
public void execute() {
  final DialogBox db = new DialogBox(false, true);
  db.setText("About MIT App Inventor");
  db.setStyleName("ode-DialogBox");
  db.setHeight("200px");
  db.setWidth("400px");
  db.setGlassEnabled(true);
  db.setAnimationEnabled(true);
  db.center();

  VerticalPanel DialogBoxContents = new VerticalPanel();
  String html = MESSAGES.gitBuildId(GitBuildId.getDate(), GitBuildId.getVersion()) +
      "<BR/>Use Companion: " + BlocklyPanel.getCompVersion();
  Config config = Ode.getInstance().getSystemConfig();
  String releaseNotesUrl = config.getReleaseNotesUrl();
  if (!Strings.isNullOrEmpty(releaseNotesUrl)) {
    html += "<BR/><BR/>Please see <a href=\"" + releaseNotesUrl +
        "\" target=\"_blank\">release notes</a>";
  }
  String tosUrl = config.getTosUrl();
  if (!Strings.isNullOrEmpty(tosUrl)) {
    html += "<BR/><BR/><a href=\"" + tosUrl +
        "\" target=\"_blank\">" + MESSAGES.privacyTermsLink() + "</a>";
  }
  HTML message = new HTML(html);

  SimplePanel holder = new SimplePanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
      db.hide();
    }
  });
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  db.setWidget(DialogBoxContents);
  db.show();
}
 
Example 21
Project: appinventor-extensions   File: TopToolbar.java   View source code 5 votes vote down vote up
@Override
public void execute() {
  final DialogBox db = new DialogBox(false, true);
  db.setText("About The Companion");
  db.setStyleName("ode-DialogBox");
  db.setHeight("200px");
  db.setWidth("400px");
  db.setGlassEnabled(true);
  db.setAnimationEnabled(true);
  db.center();

  String downloadinfo = "";
  if (!YaVersion.COMPANION_UPDATE_URL1.equals("")) {
    String url = "http://" + Window.Location.getHost() + YaVersion.COMPANION_UPDATE_URL1;
    downloadinfo = "<br/>\n<a href=" + url + ">Download URL: " + url + "</a><br/>\n";
    downloadinfo += BlocklyPanel.getQRCode(url);
  }

  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(
      "Companion Version " + BlocklyPanel.getCompVersion() + downloadinfo
  );

  SimplePanel holder = new SimplePanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
      db.hide();
    }
  });
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  db.setWidget(DialogBoxContents);
  db.show();
}
 
Example 22
Project: appinventor-extensions   File: MockVideoPlayer.java   View source code 5 votes vote down vote up
/**
 * 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 23
Project: appinventor-extensions   File: MockWrapper.java   View source code 5 votes vote down vote up
MockWrapper(SimpleEditor editor, String type, ImageResource icon) {
  super(editor, type, icon);

  // Initialize wrapper UI
  wrapper = new SimplePanel();
  wrapper.setStylePrimaryName("ode-SimpleMockComponent");
}
 
Example 24
Project: appinventor-extensions   File: MockListView.java   View source code 5 votes vote down vote up
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 25
Project: appinventor-extensions   File: MockSlider.java   View source code 5 votes vote down vote up
/**
 * 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 26
Project: appinventor-extensions   File: MockWebViewer.java   View source code 5 votes vote down vote up
/**
 * 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 27
Project: WebConsole   File: ScreenIndicator.java   View source code 5 votes vote down vote up
public ScreenIndicator(List<Integer> screenIds) {
	super(new HorizontalPanel(), CLASS_NAME);
	HorizontalPanel container = (HorizontalPanel)getWidget();
	DOM.setIntStyleAttribute(getElement(), "zIndex", 1000 );
	DOM.setStyleAttribute(getElement(), "overflow", "hidden");
	container.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
	this.screenIds = screenIds;
	screenIndicators = new ArrayList<Widget>();
	
	if (screenIds != null) {
		width = INDICATOR_SIZE * ((screenIds.size()*2) - 1);
		setWidth(width + "px");
		setHeight(INDICATOR_SIZE + "px");
		height = INDICATOR_SIZE;
		
		// Add a simple div for each screen
		for (int i=0; i<screenIds.size(); i++) {
			int cellWidth = INDICATOR_SIZE;
			//cellWidth = i != screenIds.size()-1 ? cellWidth + INDICATOR_SPACING : cellWidth;
			Widget screenIndicator = new SimplePanel();
			screenIndicator.setWidth(INDICATOR_SIZE + "px");
			screenIndicator.setHeight(INDICATOR_SIZE + "px");
			screenIndicator.setStylePrimaryName(ITEM_CLASS_NAME);
			screenIndicators.add(screenIndicator);
			container.add(screenIndicator);
			container.setCellWidth(screenIndicator, cellWidth + "px");
			
			if (i<screenIds.size()-1) {
				// Add a spacer
				Widget spacer = new SimplePanel();
				spacer.setWidth(INDICATOR_SIZE + "px");
				spacer.setHeight(INDICATOR_SIZE + "px");
				spacer.setStylePrimaryName(SPACER_CLASS_NAME);
				container.add(spacer);
				container.setCellWidth(spacer, cellWidth + "px");
			}
		}
	}
}
 
Example 28
Project: mentor   File: Mentor.java   View source code 5 votes vote down vote up
@Override
public void onModuleLoad() {

	GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
		public void onUncaughtException(Throwable e) {
			Log.log(Level.SEVERE, e.getMessage(), e);
			MaterialToast.fireToast("Unknown error, please reload application");
		}
	});

	Theme.bundle();	// inject

   	workPanel = new SimplePanel();
   	workPanel.setSize("100%", "100%");

	ActivityMapper activityMapper = new MentorActivityMapper();
	ActivityManager activityManager = new ActivityManager(activityMapper, MentorBus.get());
	activityManager.setDisplay(workPanel);

	Element loader = Document.get().getElementById("loader");
	if (loader != null)
		loader.removeFromParent();
	
	RootPanel.get().add(workPanel, 0, 0);

       Places.handler().handleCurrentHistory();	// goes to the place represented on URL, else default place

}
 
Example 29
Project: document-management-system   File: SearchResult.java   View source code 5 votes vote down vote up
public SearchResult() {
	sp = new SimplePanel();
	searchCompactResult = new SearchCompactResult();
	searchFullResult = new SearchFullResult();
	sp.add(searchFullResult);

	status = new Status();
	status.setStyleName("okm-StatusPopup");

	initWidget(sp);
}
 
Example 30
Project: cuba   File: FocusPreservingRefreshClientRpcImpl.java   View source code 5 votes vote down vote up
@Override
public void saveFocus() {
    SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class);

    if (panel != null) {
        focus = panel.getParent().getElement();
    }
}
 
Example 31
Project: cuba   File: ComponentRenderer.java   View source code 5 votes vote down vote up
@Override
public SimplePanel createWidget() {
    final SimplePanel panel = GWT.create(SimplePanel.class);
    panel.getElement().addClassName("cr-component-cell");
    panel.sinkEvents(com.google.gwt.user.client.Event.ONCLICK);
    return panel;
}
 
Example 32
Project: x-cure-chat   File: TextBaseTranslitAndProgressBar.java   View source code 5 votes vote down vote up
/**
 * Allows to bind and unbind the progress bar from the text box base objects
 * @param bind if true then first unbinds the old object and then binds the new one
 * 			   if false then just unbinds the old object.
 * @param textObject the new text box base to bind the progress bar with or null for bind==false
 * @param maxObjectCapacity the maximum capacity of the provided text box base or 0 for bind==false
 * @param progressBarPanel the panel that will store the progress bar or null for bind==false
 * @param placeHolder the place holder that will be substituted with the progress bar or null for bind==false
 */
private static void bindProgressBar( final boolean bind, final TextBoxBase textObject,
									 final int maxObjectCapacity,
									 final VerticalPanel progressBarPanel,
									 final SimplePanel placeHolder ) {
	//First remove the old bindings if any
	if( bondedProgressBarPanel != null ) {
		bondedProgressBarPanel.remove( progressBar );
		bondedProgressBarPanel.add( bindedProgBarPlaceHolder );
		bondedProgressBarPanel = null;
		bindedProgBarPlaceHolder = null;
	}
	
	//Do new bindings
	if( bind ) {
		if( progressBarPanel != null ) {
			progressBarPanel.remove( placeHolder );
			progressBarPanel.add( progressBar );
			/*Remove the panel from the tabulation sequence*/
			progressBar.setTabIndex(-1);
		} 
		bindedProgBarPlaceHolder = placeHolder;
		bondedProgressBarPanel = progressBarPanel;
	}
	
	//Then bind the new object or finish un-binding the old one
	progressBar.bindProgressBar(bind, textObject, maxObjectCapacity);
}
 
Example 33
Project: x-cure-chat   File: SiteNavigatorElement.java   View source code 5 votes vote down vote up
/**
 * The site-navigator element is constructed with the following parameters
 * @param imageBaseName the name of the base name of the image that is related to this element
 * @param isOnLogOutDisabled if true then in case the user is logged out this section is disabled
 * @param siteBodyPanel the site's body panel that should store the widget related to this site section
 * @param siteNavigator the instance of the site navigator itself
 * @param forceUserStatus the status to be forced when the user selects this site section
 * decorations into the logged out mode
 * @throws InvocationTargetException 
 * @throws IllegalAccessException 
 * @throws IllegalArgumentException 
 */
protected SiteNavigatorElement( final String imageBaseName, final boolean isOnLogOutDisabled,
							    final SimplePanel siteBodyPanel, final SiteNavigator siteNavigator,
							    final UserStatusType forceUserStatus ) {
	//Store the reference to the site's main vertical panel
	this.siteBodyPanel = siteBodyPanel;
	//Store the reference to the site navigator
	this.siteNavigator = siteNavigator;
	//Store the other properties
	this.isOnLogOutDisabled = isOnLogOutDisabled;
	this.forceUserStatus = forceUserStatus;
	
	//Set the image urls 
	final String locale = InterfaceUtils.getCurrentLocale();
	selectedImageURL = NAVIGATION_IMAGE_URL_BASE + imageBaseName + "_" + locale + NAVIGATION_IMAGE_FILE_EXT;
	unselectedImageURL = NAVIGATION_IMAGE_URL_BASE + imageBaseName + "_" + locale + NAVIGATION_IMAGE_DISABLED_SUFFIX + NAVIGATION_IMAGE_FILE_EXT;
	
	//Set the initial image URL, style, and set the click handler
	setNavigatorImage( unselectedImageURL, CommonResourcesContainer.NAVIGATION_IMAGE_ENTRY_STYLE, isSectionAlertOn );
	anchorLink.addStyleName( CommonResourcesContainer.SITE_SECTION_LINK_STYLE );
	
	//In case of clicking on the anchor we want to set the proper
	//anchor link url because it might not have been set initially
	//due to the  site section not being selected before
	sinkEvents( Event.ONMOUSEUP | Event.ONDBLCLICK | Event.ONCONTEXTMENU );
	
	//Initialize the composite widget
	initWidget( anchorLink );
}
 
Example 34
Project: switchyard   File: ComponentView.java   View source code 5 votes vote down vote up
@Override
public Widget createWidget() {
    VerticalPanel wrapper = new VerticalPanel();
    wrapper.setStyleName("fill-layout-width"); //$NON-NLS-1$
    _mainContentPanel = new SimplePanel();
    wrapper.add(_mainContentPanel);

    return wrapper;
}
 
Example 35
Project: che   File: WorkBenchPartControllerImpl.java   View source code 5 votes vote down vote up
@Inject
public WorkBenchPartControllerImpl(
    @Assisted SplitLayoutPanel splitLayoutPanel, @Assisted SimplePanel widget) {
  this.splitLayoutPanel = splitLayoutPanel;
  this.widget = widget;

  splitLayoutPanel.setWidgetToggleDisplayAllowed(widget, true);
  splitLayoutPanel.setWidgetHidden(widget, true);
  splitLayoutPanel.forceLayout();
}
 
Example 36
Project: appformer   File: JSNativePlugin.java   View source code 5 votes vote down vote up
protected void buildElement() {
    final String content;
    final String contentUrl;
    if (hasMethod(obj,
                  "templateUrl")) {
        contentUrl = getTemplateUrlFunctionResult(obj);
        content = null;
    } else if (hasMethod(obj,
                         "template")) {
        content = getTemplateFunctionResult(obj);
        contentUrl = null;
    } else if (hasStringProperty(obj,
                                 "templateUrl")) {
        contentUrl = getTemplateUrl(obj);
        content = null;
    } else if (hasStringProperty(obj,
                                 "template")) {
        content = getTemplate(obj);
        contentUrl = null;
    } else {
        content = null;
        contentUrl = null;
    }

    element = new SimplePanel(new Label("Loading")).getElement();
    if (content != null) {
        element = new HTML(new SafeHtmlBuilder().appendHtmlConstant(content).toSafeHtml()).getElement();
    } else if (contentUrl != null) {
        runtimePluginsService.getTemplateContent(contentUrl,
                                                 new ParameterizedCommand<String>() {
                                                     @Override
                                                     public void execute(String parameter) {
                                                         element = new HTML(new SafeHtmlBuilder().appendHtmlConstant(parameter).toSafeHtml()).getElement();
                                                     }
                                                 });
    } else {
        element = null;
    }
}
 
Example 37
Project: che   File: NotificationContainerItem.java   View source code 5 votes vote down vote up
/**
 * Create message widget that contains notification message.
 *
 * @return {@link SimplePanel} as message wrapper
 */
private SimplePanel createContentWidget() {
  SimplePanel messageWrapper = new SimplePanel();
  Label messageLabel = new Label();
  messageWrapper.add(messageLabel);
  messageWrapper.setStyleName(resources.notificationCss().notificationMessageWrapper());
  messageWrapper.ensureDebugId(MESSAGE_WRAPPER_DBG_ID + notification.getId());
  return messageWrapper;
}
 
Example 38
Project: che   File: ProjectPerspectiveTest.java   View source code 5 votes vote down vote up
@Before
public void setUp() {

  when(view.getLeftPanel()).thenReturn(panel);
  when(view.getRightPanel()).thenReturn(panel);
  when(view.getBottomPanel()).thenReturn(panel);

  when(view.getSplitPanel()).thenReturn(layoutPanel);

  when(view.getNavigationPanel()).thenReturn(simplePanel);
  when(view.getInformationPanel()).thenReturn(simpleLayoutPanel);
  when(view.getToolPanel()).thenReturn(simplePanel);

  when(controllerFactory.createController(
          org.mockito.ArgumentMatchers.<SplitLayoutPanel>anyObject(),
          org.mockito.ArgumentMatchers.<SimplePanel>anyObject()))
      .thenReturn(workBenchController);

  when(partViewFactory.create(org.mockito.ArgumentMatchers.<FlowPanel>anyObject()))
      .thenReturn(partStackView);

  when(stackPresenterFactory.create(
          org.mockito.ArgumentMatchers.<PartStackView>anyObject(),
          org.mockito.ArgumentMatchers.<WorkBenchPartController>anyObject()))
      .thenReturn(partStackPresenter);

  perspective =
      new ProjectPerspective(
          view,
          editorMultiPartStackPresenter,
          stackPresenterFactory,
          partViewFactory,
          controllerFactory,
          eventBus,
          dynaProvider,
          projectExplorerPresenter,
          commandsExplorerPresenter,
          notificationManager,
          processesPanelPresenter);
}
 
Example 39
Project: che   File: AbstractPerspectiveTest.java   View source code 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  when(view.getLeftPanel()).thenReturn(panel);
  when(view.getRightPanel()).thenReturn(panel);
  when(view.getBottomPanel()).thenReturn(panel);

  when(view.getSplitPanel()).thenReturn(layoutPanel);

  when(view.getNavigationPanel()).thenReturn(simplePanel);
  when(view.getInformationPanel()).thenReturn(simpleLayoutPanel);
  when(view.getToolPanel()).thenReturn(simplePanel);

  when(controllerFactory.createController(
          org.mockito.ArgumentMatchers.<SplitLayoutPanel>anyObject(),
          org.mockito.ArgumentMatchers.<SimplePanel>anyObject()))
      .thenReturn(workBenchController);

  when(partStackViewFactory.create(org.mockito.ArgumentMatchers.<FlowPanel>anyObject()))
      .thenReturn(partStackView);

  when(stackPresenterFactory.create(
          org.mockito.ArgumentMatchers.<PartStackView>anyObject(),
          org.mockito.ArgumentMatchers.<WorkBenchPartController>anyObject()))
      .thenReturn(partStackPresenter);

  perspective =
      new DummyPerspective(
          view,
          stackPresenterFactory,
          partStackViewFactory,
          controllerFactory,
          eventBus,
          extraPartStackPresenter,
          partStackPresenter,
          dynaProvider);
}
 
Example 40
Project: componentrenderer   File: FocusPreservingRefreshClientRpcImpl.java   View source code 5 votes vote down vote up
@Override
public void saveFocus() {
    SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class);

    if (panel != null) {
        focus = panel.getParent().getElement();
    }
}