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

The following examples show how to use com.google.gwt.user.client.ui.PopupPanel. 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
/**
 * Opens the additional choice dialog.
 */
protected void openAdditionalChoiceDialog() {
  popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
    public void setPosition(int offsetWidth, int offsetHeight){
      // adjust the x and y positions so that the entire panel
      // is on-screen
      int xPosition = getAbsoluteLeft();
      int yPosition = getAbsoluteTop();
      int xExtrude =
        xPosition + offsetWidth - Window.getClientWidth() - Window.getScrollLeft();
      int yExtrude =
        yPosition + offsetHeight - Window.getClientHeight() - Window.getScrollTop();
      if (xExtrude > 0) {
        xPosition -= (xExtrude + ADDITIONAL_CHOICE_ONSCREEN_PADDING);
      }
      if (yExtrude > 0) {
        yPosition -= (yExtrude + ADDITIONAL_CHOICE_ONSCREEN_PADDING);
      }
      popup.setPopupPosition(xPosition, yPosition);
    }
  });
}
 
Example 2
Source Project: hawkbit   Source File: SuggestionsSelectList.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Adds suggestions to the suggestion menu bar.
 * 
 * @param suggestions
 *            the suggestions to be added
 * @param textFieldWidget
 *            the text field which the suggestion is attached to to bring
 *            back the focus after selection
 * @param popupPanel
 *            pop-up panel where the menu bar is shown to hide it after
 *            selection
 * @param suggestionServerRpc
 *            server RPC to ask for new suggestion after a selection
 */
public void addItems(final List<SuggestTokenDto> suggestions, final VTextField textFieldWidget,
        final PopupPanel popupPanel, final TextFieldSuggestionBoxServerRpc suggestionServerRpc) {
    for (int index = 0; index < suggestions.size(); index++) {
        final SuggestTokenDto suggestToken = suggestions.get(index);
        final MenuItem mi = new MenuItem(suggestToken.getSuggestion(), true, new ScheduledCommand() {
            @Override
            public void execute() {
                final String tmpSuggestion = suggestToken.getSuggestion();
                final TokenStartEnd tokenStartEnd = tokenMap.get(tmpSuggestion);
                final String text = textFieldWidget.getValue();
                final StringBuilder builder = new StringBuilder(text);
                builder.replace(tokenStartEnd.getStart(), tokenStartEnd.getEnd() + 1, tmpSuggestion);
                textFieldWidget.setValue(builder.toString(), true);
                popupPanel.hide();
                textFieldWidget.setFocus(true);
                suggestionServerRpc.suggest(builder.toString(), textFieldWidget.getCursorPos());
            }
        });
        tokenMap.put(suggestToken.getSuggestion(),
                new TokenStartEnd(suggestToken.getStart(), suggestToken.getEnd()));
        Roles.getListitemRole().set(mi.getElement());
        WidgetUtil.sinkOnloadForImages(mi.getElement());
        addItem(mi);
    }
}
 
Example 3
Source Project: unitime   Source File: HorizontalPanelWithHint.java    License: Apache License 2.0 6 votes vote down vote up
public HorizontalPanelWithHint(Widget hint) {
	super();
	iHint = new PopupPanel();
	iHint.setWidget(hint);
	iHint.setStyleName("unitime-PopupHint");
	sinkEvents(Event.ONMOUSEOVER);
	sinkEvents(Event.ONMOUSEOUT);
	sinkEvents(Event.ONMOUSEMOVE);
	iShowHint = new Timer() {
		@Override
		public void run() {
			iHint.show();
		}
	};
	iHideHint = new Timer() {
		@Override
		public void run() {
			iHint.hide();
		}
	};
}
 
Example 4
Source Project: unitime   Source File: UniTimeTableHeader.java    License: Apache License 2.0 6 votes vote down vote up
public UniTimeTableHeader(String title, int colSpan, HorizontalAlignmentConstant align) {
	super(title, false);
	iColSpan = colSpan;
	iAlign = align;
	iTitle = title;
	
	addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			final PopupPanel popup = new PopupPanel(true);
			popup.addStyleName("unitime-Menu");
			if (!setMenu(popup)) return;
			popup.showRelativeTo((Widget)event.getSource());
			((MenuBar)popup.getWidget()).focus();
		}
	});
}
 
Example 5
Source Project: unitime   Source File: TimeGrid.java    License: Apache License 2.0 6 votes vote down vote up
public SelectionLayer() {
	setStyleName("selection-layer");
	
	iPopup = new PopupPanel();
	iPopup.setStyleName("unitime-TimeGridSelectionPopup");
	iHint = new P("content");
	iPopup.setWidget(iHint);
	
	iSelection = new SelectionPanel();
	iSelection.setVisible(false);
	add(iSelection, 0, 0);
	
	sinkEvents(Event.ONMOUSEDOWN);
	sinkEvents(Event.ONMOUSEUP);
	sinkEvents(Event.ONMOUSEMOVE);
	sinkEvents(Event.ONMOUSEOVER);
	sinkEvents(Event.ONMOUSEOUT);
}
 
Example 6
private synchronized void createPopup(final Window parent, Point2D pt, int row) {

    if (popup == null || !popup.isShowing()) {
      popup = createPane();
      popup.setModal(true);
      popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        public void setPosition(int offsetWidth, int offsetHeight) {
          int left = parent.getNative().getAbsoluteLeft() + (int) ToolBar.IMAGE_WIDTH;
          int top = parent.getNative().getAbsoluteTop() + (int) (ToolBar.IMAGE_HEIGHT * scale / ToolBar.ROWS * 3);
          popup.setPopupPosition(left, top);
          popup.requestLayout();

        }
      });
    }
  }
 
Example 7
@Test
public void testPanels() throws Exception {
  invokeAllAccessibleMethods(new AbsolutePanel() {});
  invokeAllAccessibleMethods(new CellPanel() {});
  invokeAllAccessibleMethods(new ComplexPanel() {});
  invokeAllAccessibleMethods(new DeckLayoutPanel() {});
  invokeAllAccessibleMethods(new DeckPanel() {});
  invokeAllAccessibleMethods(new DecoratorPanel() {});
  invokeAllAccessibleMethods(new DockLayoutPanel(Unit.PX) {});
  invokeAllAccessibleMethods(new DockPanel() {});
  invokeAllAccessibleMethods(new FlowPanel() {});
  invokeAllAccessibleMethods(new FocusPanel() {});
  invokeAllAccessibleMethods(new HorizontalPanel() {});
  invokeAllAccessibleMethods(new HTMLPanel("") {});
  invokeAllAccessibleMethods(new LayoutPanel() {});
  invokeAllAccessibleMethods(new PopupPanel() {});
  invokeAllAccessibleMethods(new RenderablePanel("") {});
  invokeAllAccessibleMethods(new ResizeLayoutPanel() {});
  invokeAllAccessibleMethods(new SimpleLayoutPanel() {});
  invokeAllAccessibleMethods(new SimplePanel() {});
  invokeAllAccessibleMethods(new SplitLayoutPanel() {});
  invokeAllAccessibleMethods(new StackPanel() {});
  invokeAllAccessibleMethods(new VerticalPanel() {});
}
 
Example 8
public DebugPanelFilterWidget(DebugPanelFilterModel model) {
  HorizontalPanel panel = new HorizontalPanel();
  panel.add(button = Utils.createMenuButton("Add/Edit Filter", null));
  panel.add(new DebugPanelFilterTrail(model));
  panel.setStyleName(Utils.style() + "-filters");
  initWidget(panel);

  popup = new FilterPopup(model);
  button.addClickHandler(new ClickHandler() {
    //@Override
    public void onClick(ClickEvent event) {
      popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
        //@Override
        public void setPosition(int offsetWidth, int offsetHeight) {
          popup.setPopupPosition(
              button.getAbsoluteLeft(), button.getAbsoluteTop() + button.getOffsetHeight())
          ;

        }
      });
    }
  });
}
 
Example 9
public void launchNewPropertyDialoge(String group) {

        propertyWindow = new DefaultWindow(Console.MESSAGES.createTitle("System Property"));
        propertyWindow.setWidth(480);
        propertyWindow.setHeight(360);
        propertyWindow.addCloseHandler(new CloseHandler<PopupPanel>() {
            @Override
            public void onClose(CloseEvent<PopupPanel> event) {

            }
        });

        propertyWindow.trapWidget(
                new NewPropertyWizard(this, group, true).asWidget()
        );

        propertyWindow.setGlassEnabled(true);
        propertyWindow.center();
    }
 
Example 10
Source Project: core   Source File: WebPresenter.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchConnectorDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("Connector"));
    window.setWidth(480);
    window.setHeight(400);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewConnectorWizard(this, connectors, socketsBindingList).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example 11
public void launchNewSecDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("Security Setting"));
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewSecurityPatternWizard(this, providerEntity).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example 12
public void launchNewAddrDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("Addressing Setting"));
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewAddressPatternWizard(this, providerEntity).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example 13
public void launchNewQueueDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("JMS Queue"));
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewQueueWizard(this).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example 14
public void launchNewTopicDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("JMS Topic"));
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewTopicWizard(this).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example 15
@Override
protected void finish() {
    final PopupPanel loading = Feedback.loading(
            Console.CONSTANTS.common_label_plaseWait(),
            Console.CONSTANTS.common_label_requestProcessed(), () -> {}
    );
    final Outcome<FunctionContext> outcome = new DeploymentWizardOutcome(loading, context);

    if (context.deployNew) {
        uploadAddContentAndAssign(outcome);

    } else if (context.deployExisting) {
        addAssignment(outcome);

    } else if (context.deployUnmanaged) {
        addUnmanaged(outcome);
    }
}
 
Example 16
private void showVersionInfo(String json)
{
    DefaultWindow window = new DefaultWindow("Management Model Versions");
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    TextArea textArea = new TextArea();
    textArea.setStyleName("fill-layout");
    textArea.setText(json);

    window.setWidget(textArea);

    window.setGlassEnabled(true);
    window.center();
}
 
Example 17
public void launchNewPropertyDialoge(String group) {

        propertyWindow = new DefaultWindow(Console.MESSAGES.newTitle("Host Property"));
        propertyWindow.setWidth(480);
        propertyWindow.setHeight(360);
        propertyWindow.addCloseHandler(new CloseHandler<PopupPanel>() {
            @Override
            public void onClose(CloseEvent<PopupPanel> event) {

            }
        });

        propertyWindow.trapWidget(
                new NewPropertyWizard(this, group, true).asWidget()
        );

        propertyWindow.setGlassEnabled(true);
        propertyWindow.center();
    }
 
Example 18
private void showVersionInfo(String json) {
    DefaultWindow window = new DefaultWindow("Management Model Versions");
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    TextArea textArea = new TextArea();
    textArea.setStyleName("fill-layout");
    textArea.setText(json);

    window.setWidget(textArea);

    window.setGlassEnabled(true);
    window.center();
}
 
Example 19
public void onMessage(final Message message) {
    if (!message.isTransient()) {

        // update the visible message count
        reflectMessageCount();

        final PopupPanel display = createDisplay(message);
        displayNotification(display, message);

        if (!message.isSticky()) {

            Timer hideTimer = new Timer() {
                @Override
                public void run() {
                    // hide message
                    messageDisplay.clear();
                    display.hide();
                }
            };

            hideTimer.schedule(4000);
        }

    }
}
 
Example 20
BootstrapServerDialog(final BootstrapServerSetup serverSetup) {
    connectPage = new ConnectPage(serverSetup, this);
    configurePage = new ConfigurePage(serverSetup, this);

    deck = new DeckLayoutPanel();
    deck.addStyleName("window-content"); // white background for forms
    deck.addStyleName("default-window-content");
    deck.add(connectPage);
    deck.add(configurePage);

    int width = 750;
    popupPanel = new PopupPanel(false, true);
    popupPanel.setGlassEnabled(true);
    popupPanel.setAnimationEnabled(false);
    popupPanel.setWidget(deck);
    popupPanel.setWidth(String.valueOf(width) + "px");
    popupPanel.setHeight(String.valueOf(width / DefaultWindow.GOLDEN_RATIO) + "px");
    popupPanel.setStyleName("default-window");
}
 
Example 21
Source Project: appinventor-extensions   Source File: ErrorReporter.java    License: Apache License 2.0 5 votes vote down vote up
private static void reportMessage(String message) {
  if (!Ode.isWindowClosing()) {
    POPUP.setMessageHTML(message);

    // Position the popup before showing it to prevent flashing.
    POPUP.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
      @Override
      public void setPosition(int offsetWidth, int offsetHeight) {
        POPUP.centerTopPopup();
      }
    });
  }
}
 
Example 22
Source Project: appinventor-extensions   Source File: ContextMenu.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new context menu.
 */
public ContextMenu() {
  popupPanel = new PopupPanel(true);  // autoHide
  //Enabling Glass under the popups so that clicks on the iframe (blockly) also hide the panel
  popupPanel.setGlassEnabled(true);
  popupPanel.setGlassStyleName("none"); //No style is passed (the default grays out the window)
  menuBar = new MenuBar(true);
  menuBar.setStylePrimaryName("ode-ContextMenu");
  popupPanel.add(menuBar);
}
 
Example 23
Source Project: appinventor-extensions   Source File: GalleryClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
* loadSourceFile opens the app as a new app inventor project
* @param gApp the app to open
* @return True if success, otherwise false
*/
public boolean loadSourceFile(GalleryApp gApp, String newProjectName, final PopupPanel popup) {
  final String projectName = newProjectName;
  final String sourceKey = getGallerySettings().getSourceKey(gApp.getGalleryAppId());
  final long galleryId = gApp.getGalleryAppId();

  // first check name to see if valid and unique...
  if (!TextValidators.checkNewProjectName(projectName))
    return false;  // the above function takes care of error messages
  // Callback for updating the project explorer after the project is created on the back-end
  final Ode ode = Ode.getInstance();

  final OdeAsyncCallback<UserProject> callback = new OdeAsyncCallback<UserProject>(
  // failure message
  MESSAGES.createProjectError()) {
    @Override
    public void onSuccess(UserProject projectInfo) {
      Project project = ode.getProjectManager().addProject(projectInfo);
      Ode.getInstance().openYoungAndroidProjectInDesigner(project);
      popup.hide();
    }
    @Override
    public void onFailure(Throwable caught) {
      popup.hide();
      super.onFailure(caught);
    }
  };
  // this is really what's happening here, we call server to load project
  ode.getProjectService().newProjectFromGallery(projectName, sourceKey, galleryId, callback);
  return true;
}
 
Example 24
Source Project: appinventor-extensions   Source File: RpcStatusPopup.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the LoadingPopup.
 */
public RpcStatusPopup() {
  super(/* autoHide = */ false);
  setStyleName("ode-RpcStatusMessage");
  setWidget(label);

  // Re-center the loading message when the window is resized.
  // TODO(halabelson): Replace the deprecated methods
  Window.addWindowResizeListener(new WindowResizeListener() {
    @Override
    public void onWindowResized(int width, int height) {
      positionPopup(getOffsetWidth());
    }
  });

  // Reposition the message to the top of the screen when the
  // window is scrolled
  // TODO(halabelson): get rid of the flashing on vertical scrolling
  Window.addWindowScrollListener(new WindowScrollListener() {
    @Override
    public void onWindowScrolled(int scrollLeft, int scrollTop) {
      positionPopup(getOffsetWidth());
    }
  });

  // Position the popup before showing it to prevent flashing.
  setPopupPositionAndShow(new PopupPanel.PositionCallback() {
    @Override
    public void setPosition(int offsetWidth, int offsetHeight) {
      positionPopup(offsetWidth);
    }
  });
}
 
Example 25
@Override
public void onClose(CloseEvent<PopupPanel> event) {
	debug("VComboBoxMultiselect.SP: onClose(" + event.isAutoClosed() + ")");

	if (event.isAutoClosed()) {
		this.lastAutoClosed = new Date().getTime();
	}
	
	connector.sendBlurEvent();			
}
 
Example 26
@Override
public void onClose(CloseEvent<PopupPanel> event) {
	debug("VComboBoxMultiselect.SP: onClose(" + event.isAutoClosed() + ")");

	if (event.isAutoClosed()) {
		this.lastAutoClosed = new Date().getTime();
	}
	
	connector.sendBlurEvent();			
}
 
Example 27
Source Project: unitime   Source File: CurriculaCourses.java    License: Apache License 2.0 5 votes vote down vote up
public void addBlankLine() {
	List<Widget> line = new ArrayList<Widget>();

	HorizontalPanel hp = new HorizontalPanel();
	line.add(hp);

	CurriculaCourseSelectionBox cx = new CurriculaCourseSelectionBox();
	cx.setWidth("130px");
	cx.addCourseSelectionHandler(iCourseChangedHandler);
	if (cx.getCourseFinder() instanceof HasOpenHandlers)
		((HasOpenHandlers<PopupPanel>)cx.getCourseFinder()).addOpenHandler(new OpenHandler<PopupPanel>() {
			@Override
			public void onOpen(OpenEvent<PopupPanel> event) {
				iTable.clearHover();
			}
		});
	if (!iEditable) cx.setEnabled(false);
	line.add(cx);
	
	for (int col = 0; col < iClassifications.getClassifications().size(); col++) {
		ShareTextBox ex = new ShareTextBox(col, null, null);
		if (!iEditable) ex.setReadOnly(true);
		line.add(ex);
		EnrollmentLabel note = new EnrollmentLabel(col, null, null, null, null, null, null);
		line.add(note);
	}
	
	int row = iTable.addRow("", line);
	iTable.getRowFormatter().addStyleName(row, "unitime-NoPrint");
	if (iVisibleCourses != null) iTable.getRowFormatter().setVisible(row, false);
	for (int col = 0; col < line.size(); col++)
		if (!iTable.getCellFormatter().isVisible(0, col))
			iTable.getCellFormatter().setVisible(row, col, false);
}
 
Example 28
Source Project: unitime   Source File: UniTimeTable.java    License: Apache License 2.0 5 votes vote down vote up
public UniTimeTable() {
	setCellPadding(2);
	setCellSpacing(0);
	sinkEvents(Event.ONMOUSEOVER);
	sinkEvents(Event.ONMOUSEOUT);
	sinkEvents(Event.ONCLICK);
	sinkEvents(Event.ONKEYDOWN);
	sinkEvents(Event.ONDBLCLICK);
	setStylePrimaryName("unitime-MainTable");
	iHintPanel = new PopupPanel();
	iHintPanel.setStyleName("unitime-PopupHint");
	Roles.getGridRole().set(getElement());
}
 
Example 29
Source Project: swellrt   Source File: Popup.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a popup.
 *
 * @param reference   reference element for the positioner
 * @param positioner  strategy for positioning the popup
 */
public Popup(Element reference, RelativePopupPositioner positioner) {
  this.reference = reference;
  this.positioner = positioner;
  popupPanel.addStyleName("editor-popup");
  popupPanel.setAnimationEnabled(true);
  popupPanel.addCloseHandler(new CloseHandler<PopupPanel>() {
    @Override
    public void onClose(CloseEvent<PopupPanel> event) {
      Popup.this.hide();
    }
  });
}
 
Example 30
/**
 * Default constructor.
 */
public ToolTip() {
	toolTip = (PopupPanel) UIBINDER.createAndBindUi(this);

	ApplicationResource.INSTANCE.css().ensureInjected();
	toolTip.addStyleName(ApplicationResource.INSTANCE.css().toolTip());
}