List of usage examples for com.google.gwt.user.client.ui AbsolutePanel add
@Override
public void add(Widget w)
From source file:cc.kune.common.client.SampleEntryPoint.java
License:GNU Affero Public License
@Override public void onModuleLoad() { // FIXME move this to sandbox!!! final SampleGinjector ginjector = GWT.create(SampleGinjector.class); ginjector.getGuiProvider();/*from www .ja v a2 s.c om*/ final GlobalShortcutRegister shortcutRegister = ginjector.getGlobalShortcutRegister(); final GuiActionDescCollection actions = new GuiActionDescCollection(); final TestAction action = new TestAction("Action 1", "Some tooltip", "oc-testico"); final TestAction action2 = new TestAction("Action 2"); final KeyStroke shortcut = Shortcut.getShortcut(false, true, false, false, Character.valueOf('C')); shortcutRegister.put(shortcut, action); final ButtonDescriptor simpleBtn = new ButtonDescriptor(action); // Same action but different text simpleBtn.putValue(Action.NAME, "Action 1 diff name"); final PushButtonDescriptor pushBtn = new PushButtonDescriptor(action2); pushBtn.setPushed(true); pushBtn.putValue(Action.NAME, "Push btn"); final ToolbarDescriptor toolbar = new ToolbarDescriptor(); final ToolbarSeparatorDescriptor tsepFill = new ToolbarSeparatorDescriptor(Type.fill, toolbar); final ToolbarSeparatorDescriptor toolbarSpace = new ToolbarSeparatorDescriptor(Type.spacer, toolbar); simpleBtn.setParent(toolbar); pushBtn.setParent(toolbar); final MenuDescriptor menu = new MenuDescriptor(action); menu.putValue(Action.NAME, "Menu"); final MenuDescriptor menu2 = new MenuDescriptor(action); menu2.putValue(Action.NAME, "Menu2"); menu.setParent(toolbar); final SubMenuDescriptor submenu = new SubMenuDescriptor("Some Submenu", "tip", "oc-testico"); submenu.setParent(menu); final MenuSeparatorDescriptor menuSep = new MenuSeparatorDescriptor(menu); final TestAction action3 = new TestAction("Action 3", "Some tooltip", "oc-testico"); final TestAction action4 = new TestAction("Action 4"); final MenuItemDescriptor menuItem = new MenuItemDescriptor(menu, action3); final MenuItemDescriptor menuItem2 = new MenuItemDescriptor(menu, action4); final MenuItemDescriptor menuItem3 = new MenuItemDescriptor(submenu, action); final MenuItemDescriptor menuItem4 = new MenuItemDescriptor(submenu, action); final IconLabelDescriptor iconLabelDescr = new IconLabelDescriptor(action); final IconLabelDescriptor iconLabelNoAct = new IconLabelDescriptor(action4); final MenuItemDescriptor menuItem5 = new MenuItemDescriptor(menu2, action); action.setShortcut(shortcut); actions.add(toolbar, simpleBtn, tsepFill, pushBtn, toolbarSpace, menu, tsepFill, menuItem, menuItem2, menuSep, menuItem2, menuItem, iconLabelDescr, submenu, menuItem3, menuItem4, menu2, iconLabelNoAct, menuItem5); final ActionFlowPanel view = new ActionFlowPanel(ginjector.getGuiProvider(), null); view.addAll(actions); final IconLabel simpleIconLabel = new IconLabel("IconLabel (no action)"); simpleIconLabel.setRightIcon("oc-testico"); simpleIconLabel.setTitle("tooltip"); final VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); panel.add(view); panel.add(simpleIconLabel); final BasicThumb thumb = new BasicThumb("http://www.truth-out.org/sites/all/themes/truth/images/logo.gif", 60, "fooo", 5, false, new ClickHandler() { @Override public void onClick(final ClickEvent event) { userMsg.show("Testing"); } }); thumb.setTooltip("kkkkkkK"); thumb.setOnOverLabel(true); final AbsolutePanel layout = new AbsolutePanel(); // final QuickTip quickTip = new QuickTip(layout); // quickTip.setInterceptTitles(true); layout.add(thumb); RootPanel.get().add(layout); RootPanel.get().add(view); }
From source file:ch.unifr.pai.twice.dragndrop.standalone.client.DragNDropStandalone.java
License:Apache License
@Override public void onModuleLoad() { // Enable multicursor support MultiCursorController c = GWT.create(MultiCursorController.class); c.start();//ww w . j a v a 2 s .c o m DockLayoutPanel mainpanel = new DockLayoutPanel(Unit.PX); final AbsolutePanel p = new AbsolutePanel(); DraggableLabel l = new DraggableLabel(); l.setText("DRAG ME"); mainpanel.add(p); RootLayoutPanel.get().add(mainpanel); p.add(l); final FocusPanel drop = new FocusPanel(); drop.setWidth("500px"); drop.setHeight("400px"); drop.getElement().getStyle().setBackgroundColor("green"); p.add(drop); p.setWidgetPosition(drop, 400, 200); // define the green focus panel to be a drop target handler DragNDrop.setDropHandler(drop, new DropTargetHandler() { @Override public void onHoverEnd(String deviceId, Widget widget, Element dragProxy, Event event) { drop.getElement().getStyle().setBackgroundColor("yellow"); } @Override public void onHover(String deviceId, Widget widget, Element dragProxy, Event event, Double intersectionPercentage, Double intersectionPercentageWithTarget) { drop.getElement().getStyle().setBackgroundColor("red"); } @Override public boolean onDrop(String deviceId, Widget widget, Element dragProxy, Event event, Double intersectionPercentage, Double intersectionPercentageWithTarget) { Window.alert("Dropped"); return false; } @Override public Priority getPriority() { return Priority.NORMAL; } }, true); // Make the label draggable DragNDrop.makeDraggable(l, DragConfiguration.withProxy(new DragNDropHandler() { @Override public void onStartDrag(String deviceId, Widget draggedWidget) { // TODO Auto-generated method stub } @Override public void onEndOfDrop(String deviceId, Widget draggedWidget, int dragProxyLeft, int dragProxyTop, Event event) { // TODO Auto-generated method stub } @Override public boolean onDrop(String deviceId, Widget draggedWidget, int dragProxyLeft, int dragProxyTop, Event event, DropTargetHandler dropTarget, boolean outOfBox) { p.setWidgetPosition(draggedWidget, dragProxyLeft - p.getAbsoluteLeft(), dragProxyTop - p.getAbsoluteTop()); return true; } })); }
From source file:cl.uai.client.toolbar.buttons.MarkingButtons.java
License:Open Source License
/** * Adds a toggle button to the toolbar/*from www . j a va2 s .c o m*/ * * @param label * @param title * @param cssStyle * @param buttonIndex */ private void addToggleButton(EmarkingToggleButton button) { button.addValueChangeHandler(handler); buttons.add(button); Label lblstat = buttonsStats.get(button.getFormat()); AbsolutePanel vpanel = new AbsolutePanel(); vpanel.add(button); vpanel.add(lblstat, 23, 0); markingButtonsPanel.add(vpanel); }
From source file:com.ait.toolkit.clientio.uploader.client.Uploader.java
License:Apache License
private FileUpload createFileUpload() { fileUpload = new FileUpload(); fileUpload.getElement().getStyle().setDisplay(Style.Display.NONE); if (fileTypes != null) { // Convert the format that the SWFUpload/Flash parameter expects to the W3C DOM standard // See: http://dev.w3.org/html5/spec/states-of-the-type-attribute.html#attr-input-accept fileUpload.getElement().setAttribute("accept", this.fileTypes.replaceAll("\\;", ",").replaceAll("\\*\\.", ".")); // TODO: Need to consider validation of this in the file queued handler as well, as the browsers don't // appear to consistently support the "accept" attribute }//from ww w . java 2s . c om final AbsolutePanel panel = this; fileUpload.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { JsArray selectedFiles = nativeGetSelectedFiles(fileUpload.getElement()); // Every time a file is selected replace the FileUpload component running in the DOM so that // the user can continue to attempt uploading the same file multiple times (otherwise the // "ChangeHandler" never fires) panel.remove(fileUpload); panel.add(createFileUpload()); addFilesToQueue(selectedFiles); } }); return fileUpload; }
From source file:com.allen_sauer.gwt.dnd.demo.client.example.insertpanel.InsertPanelExample.java
License:Apache License
public InsertPanelExample(DemoDragHandler demoDragHandler) { addStyleName(CSS_DEMO_INSERT_PANEL_EXAMPLE); int count = 0; // use the boundary panel as this composite's widget AbsolutePanel boundaryPanel = new AbsolutePanel(); boundaryPanel.setSize("100%", "100%"); setWidget(boundaryPanel);/*from w ww .ja v a 2s.c om*/ // initialize our column drag controller PickupDragController columnDragController = new PickupDragController(boundaryPanel, false); columnDragController.setBehaviorMultipleSelection(false); columnDragController.addDragHandler(demoDragHandler); // initialize our widget drag controller PickupDragController widgetDragController = new PickupDragController(boundaryPanel, false); widgetDragController.setBehaviorMultipleSelection(false); widgetDragController.addDragHandler(demoDragHandler); // initialize horizontal panel to hold our columns HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.addStyleName(CSS_DEMO_INSERT_PANEL_EXAMPLE_CONTAINER); horizontalPanel.setSpacing(SPACING); boundaryPanel.add(horizontalPanel); // initialize our column drop controller HorizontalPanelDropController columnDropController = new HorizontalPanelDropController(horizontalPanel); columnDragController.registerDropController(columnDropController); for (int col = 1; col <= COLUMNS; col++) { // initialize a vertical panel to hold the heading and a second vertical // panel VerticalPanel columnCompositePanel = new VerticalPanel(); columnCompositePanel.addStyleName(CSS_DEMO_INSERT_PANEL_EXAMPLE_COLUMN_COMPOSITE); // initialize inner vertical panel to hold individual widgets VerticalPanel verticalPanel = new VerticalPanelWithSpacer(); verticalPanel.addStyleName(CSS_DEMO_INSERT_PANEL_EXAMPLE_CONTAINER); verticalPanel.setSpacing(SPACING); horizontalPanel.add(columnCompositePanel); // initialize a widget drop controller for the current column VerticalPanelDropController widgetDropController = new VerticalPanelDropController(verticalPanel); widgetDragController.registerDropController(widgetDropController); // Put together the column pieces Label heading = new Label("Column " + col); heading.addStyleName(CSS_DEMO_INSERT_PANEL_EXAMPLE_HEADING); columnCompositePanel.add(heading); columnCompositePanel.add(verticalPanel); // make the column draggable by its heading columnDragController.makeDraggable(columnCompositePanel, heading); for (int row = 1; row <= ROWS; row++) { // initialize a widget HTML widget = new HTML("Draggable #" + ++count); widget.addStyleName(CSS_DEMO_INSERT_PANEL_EXAMPLE_WIDGET); widget.setHeight(Random.nextInt(4) + 2 + "em"); verticalPanel.add(widget); // make the widget draggable widgetDragController.makeDraggable(widget); } } }
From source file:com.arondor.common.reflection.gwt.client.view.ClassTreeView.java
License:Apache License
public ClassTreeView() { AbsolutePanel content = new AbsolutePanel(); initWidget(content); content.add(tree); }
From source file:com.arondor.common.reflection.gwt.client.view.HierarchicAccessibleClassView.java
License:Apache License
public HierarchicAccessibleClassView() { AbsolutePanel content = new AbsolutePanel(); initWidget(content); content.add(classTreeDisplay); }
From source file:com.github.a2g.core.objectmodel.MasterPanel.java
License:Apache License
public MasterPanel(int width, int height, ColorEnum back) { // create all the host panels, that we want to arrange. hostForCommandLine = new HostingPanelForHtml4(); hostForInventory = new HostingPanelForHtml4(); hostForVerbs = new HostingPanelForHtml4(); hostForScene = new HostingPanelForHtml4(); hostForDialogTree = new HostingPanelForHtml4(); hostForLoading = new HostingPanelForHtml4(); hostForTitleCard = new HostingPanelForHtml4(); // will be constructed from two vertical stacks. AbsolutePanel stackForSceneAndLoading = new AbsolutePanel(); AbsolutePanel stackForDialogTreeInvAndCommand = new AbsolutePanel(); stackForDialogTreeInvAndCommand.getElement().getStyle().setProperty("backgroundColor", back.toString()); stackForSceneAndLoading.getElement().getStyle().setProperty("backgroundColor", back.toString()); {//from ww w .java 2s . c o m HorizontalPanel verbsAndInventory = new HorizontalPanel(); verbsAndInventory.add(hostForVerbs); verbsAndInventory.add(hostForInventory); VerticalPanel commandLineAndVerbsAndInventory = new VerticalPanel(); commandLineAndVerbsAndInventory.add(hostForCommandLine); commandLineAndVerbsAndInventory.add(verbsAndInventory); stackForDialogTreeInvAndCommand.add(commandLineAndVerbsAndInventory); stackForDialogTreeInvAndCommand.add(hostForDialogTree); } { stackForSceneAndLoading.add(hostForScene); stackForSceneAndLoading.add(hostForLoading); stackForSceneAndLoading.add(hostForTitleCard); } this.add(stackForSceneAndLoading); this.add(stackForDialogTreeInvAndCommand); }
From source file:com.google.gwt.examples.GlassPanelExample.java
License:Apache License
public void onModuleLoad() { // Create a glass panel covering the entire browser document RootPanel.get().add(new Label("The browser document will be covered by a semi-transparent glass panel.")); RootPanel.get().add(new Label("Hit ESC or click anywhere on the glass panel to remove it.")); RootPanel.get().add(new GlassPanel(true), 0, 0); // Create a small AbsolutePanel AbsolutePanel absolutePanel = new AbsolutePanel(); absolutePanel.setPixelSize(100, 100); DOM.setStyleAttribute(absolutePanel.getElement(), "border", "1px solid black"); absolutePanel.add(new Label("This AbsolutePanel is covered with a semi-transparent green glass panel")); // Attach the AbsolutePanel RootPanel.get().add(absolutePanel, 50, 50); // Attach an absolute panel and style it green using this !important CSS // rule://from w w w. j av a2 s . co m // .green { background-color: green !important; } GlassPanel greenGlassPanel = new GlassPanel(false); greenGlassPanel.addStyleName("green"); absolutePanel.add(greenGlassPanel, 0, 0); }
From source file:com.google.gwt.sample.stockwatcher.client.FlexTableRowDropController.java
@Override public void onDrop(DragContext context) { super.onDrop(context); AbsolutePanel target = (AbsolutePanel) getDropTarget(); int factor = 6200000; // Thats the biggest amount / 100 int table_size = 490; // Aqui se define lo que quieres que haga la el target widget cuando le // sueltes lo que sea target.setTitle(parent.currentCity.getCity() + " " + parent.currentCity.getAmmount()); target.add(new Label(parent.currentCity.getCity() + parent.currentCity.getAmmount())); Label temp = new Label(); temp.setWidth(String.valueOf((parent.currentCity.getAmmount() * table_size) / factor) + "px"); temp.setStyleName("graphic_bars"); temp.setText(" ."); target.add(temp);/* w ww. ja v a2 s . co m*/ }