/**
* Returns the position of the upper left corner of the popover winndow
*
* @param pos
* @return
*/
public static AnchorLocation getAnchorLocation() {
ConfigIO cfg = ConfigIO.getInstance();
cfg.getScreenPositionId();
int scrPosId = cfg.getScreenPositionId();
ScreenPosition screenPos = getScreenPosition(scrPosId);
Pos pos = screenPos.getPos();
switch (pos) {
case TOP_LEFT:
return AnchorLocation.CONTENT_TOP_LEFT;
case TOP_RIGHT:
return AnchorLocation.CONTENT_TOP_RIGHT;
case BOTTOM_LEFT:
return AnchorLocation.CONTENT_BOTTOM_LEFT;
case BOTTOM_RIGHT:
return AnchorLocation.CONTENT_BOTTOM_RIGHT;
default:
return AnchorLocation.CONTENT_TOP_LEFT;
}
}
java类javafx.stage.PopupWindow.AnchorLocation的实例源码
Util.java 文件源码
项目:dracoon-dropzone
阅读 19
收藏 0
点赞 0
评论 0
ColumnFilter.java 文件源码
项目:TableFilterFX
阅读 23
收藏 0
点赞 0
评论 0
private void onFilterButtonClicked(MouseEvent event) {
if (!filterPopup.isShowing()) {
Bounds bounds = header.getBoundsInLocal();
Bounds screenBounds = header.localToScreen(bounds);
int lastColIndex = tableFilter.getTableView().getColumns().size() - 1;
int thisColIndex = tableFilter.getTableView().getColumns().indexOf(column);
double xpos;
if (thisColIndex == lastColIndex) {
filterPopup.setAnchorLocation(AnchorLocation.CONTENT_TOP_RIGHT);
Bounds boundsTable = tableFilter.getTableView().getBoundsInLocal();
Bounds screentToTable = tableFilter.getTableView().localToScreen(boundsTable);
xpos = screentToTable.getMaxX();
} else {
filterPopup.setAnchorLocation(AnchorLocation.CONTENT_TOP_LEFT);
xpos = screenBounds.getMinX();
}
// TODO hack to init with right width
filterPopup.show(header.getScene().getWindow());
filterPopup.hide();
filterPopup.show(header, xpos, screenBounds.getMaxY());
}
event.consume();
}
AppearanceCounterController.java 文件源码
项目:WhoWhatWhere
阅读 29
收藏 0
点赞 0
评论 0
private void setTooltipsAndGraphics()
{
Tooltip wwwTooltip = new Tooltip("Who What Where listens to network traffic and analyzes IP packets. Analysis includes geographical location, latency and total amount of packets sent and received from each address.");
ToolTipUtilities.setTooltipProperties(wwwTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, null);
labelWWW.setTooltip(wwwTooltip);
GUIController.setCommonGraphicOnLabeled(labelWWW, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip hotkeyTooltip = new Tooltip("The hotkey can be activated even while " + Main.appTitle + " isn't visible on the screen. "
+ "The table contents will be read out to you so you don't have to look at the screen. The text to speech voice can be configured from the Options menu.");
ToolTipUtilities.setTooltipProperties(hotkeyTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, AnchorLocation.WINDOW_TOP_RIGHT);
chkboxUseTTS.setTooltip(hotkeyTooltip);
GUIController.setCommonGraphicOnLabeled(chkboxUseTTS, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip geoIPTooltip = new Tooltip("For each IP address, gets the name of the organization that owns it and its location (country, region and city). GeoIP info isn't always accurate. Right click on any row to see more GeoIP results in the browser.");
ToolTipUtilities.setTooltipProperties(geoIPTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, null);
chkboxGetLocation.setTooltip(geoIPTooltip);
GUIController.setCommonGraphicOnLabeled(chkboxGetLocation, GUIController.CommonGraphicImages.TOOLTIP);
GUIController.setCommonGraphicOnLabeled(btnConfigCaptureHotkey, GUIController.CommonGraphicImages.HOTKEY);
GUIController.setGraphicForLabeledControl(btnStart, startWWWImageLocation, ContentDisplay.LEFT);
GUIController.setCommonGraphicOnLabeled(btnStop, GUIController.CommonGraphicImages.STOP);
GUIController.setGraphicForLabeledControl(btnExportTableToCSV, exportToCSVImageLocation, ContentDisplay.LEFT);
}
RfxAppButtonBar.java 文件源码
项目:Introspect-Framework
阅读 25
收藏 0
点赞 0
评论 0
private void showSelectTabPopUp() {
LanguageProvider languageProvider = userInterfaceContainer.get(LanguageProvider.class);
RfxUserinterfaceController userInterfaceController = userInterfaceContainer
.get(RfxUserinterfaceController.class);
ViewContainer<View> viewContainer = userInterfaceController.getViewContainer();
TreeItem<Item> rootNode = new TreeItem<>(new Item(languageProvider));
rootNode.setExpanded(true);
RfxItemTreeView itemTreeView = new RfxItemTreeView(rootNode);
for (int i = 0; i < viewContainer.getViewCount(); i++) {
View view = viewContainer.getView(i);
SelectTabItem selectTabItem = new SelectTabItem(languageProvider, viewContainer, view);
TreeItem<Item> selectTabNode = new TreeItem<>(selectTabItem);
rootNode.getChildren().add(selectTabNode);
}
;
JFXPopup popup = new JFXPopup();
popup.setPopupContent(itemTreeView);
popup.setAnchorLocation(AnchorLocation.CONTENT_TOP_RIGHT);
popup.show(tabSelectionButton);
}
HorizonChart.java 文件源码
项目:horizon
阅读 25
收藏 0
点赞 0
评论 0
public HorizonChart(final int BANDS, final Series<T> SERIES, final boolean SMOOTHED) {
series = SERIES;
scaleX = 1;
scaleY = 1;
smoothed = SMOOTHED;
referenceZero = true;
noOfBands = clamp(1, MAX_NO_OF_BANDS, BANDS);
noOfItems = SERIES.getNoOfItems();
minY = SERIES.getItems().stream().mapToDouble(Data::getY).min().getAsDouble();
maxY = SERIES.getItems().stream().mapToDouble(Data::getY).max().getAsDouble();
bandWidth = (maxY - minY) / noOfBands;
tooltip = new Tooltip();
tooltip.setAnchorLocation(AnchorLocation.CONTENT_BOTTOM_LEFT);
adjustColors();
// Create list of points
points = new ArrayList<>(noOfItems);
prepareData();
mouseListener = mouseEvent -> {
final EventType<? extends MouseEvent> TYPE = mouseEvent.getEventType();
if (MouseEvent.MOUSE_CLICKED == TYPE) {
Data<T> data = selectDataAt(mouseEvent.getX());
tooltip.setText(createTooltipText(data));
tooltip.setX(mouseEvent.getScreenX());
tooltip.setY(mouseEvent.getScreenY());
tooltip.show(getScene().getWindow());
getSeries().fireSeriesEvent(new SeriesEvent(getSeries(), data, SeriesEventType.SELECT_DATA));
} else if (MouseEvent.MOUSE_MOVED == TYPE) {
tooltip.hide();
} else if (MouseEvent.MOUSE_EXITED == TYPE) {
tooltip.hide();
}
};
seriesListener = seriesEvent -> redraw();
initGraphics();
registerListeners();
}
ToolTipUtilities.java 文件源码
项目:WhoWhatWhere
阅读 21
收藏 0
点赞 0
评论 0
/**Any parameter can be null to keep its default value
*/
public static void setTooltipProperties(Tooltip tooltip, Boolean wrap, Double maxWidth, Double fontSize, AnchorLocation anchorLocation)
{
if (wrap != null)
tooltip.setWrapText(wrap);
if (maxWidth != null)
tooltip.setMaxWidth(maxWidth);
if (fontSize != null)
tooltip.setFont(new Font(fontSize));
if (anchorLocation != null)
tooltip.setAnchorLocation(anchorLocation);
}
WatchdogController.java 文件源码
项目:WhoWhatWhere
阅读 23
收藏 0
点赞 0
评论 0
private void setGraphics()
{
GUIController.setCommonGraphicOnLabeled(labelTableHeader, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip headerTooltip = new Tooltip("Watchdog inspects network traffic and issues a user-customized notification when a packet matches the conditions specified in a rule.");
ToolTipUtilities.setTooltipProperties(headerTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, null);
labelTableHeader.setTooltip(headerTooltip);
GUIController.setCommonGraphicOnLabeled(labelRuleList, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip ruleListTooltip = new Tooltip("The rules are checked in the order that they appear. If a packet matches a rule, the remaining rules will not be checked.");
ToolTipUtilities.setTooltipProperties(ruleListTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, null);
labelRuleList.setTooltip(ruleListTooltip);
GUIController.setCommonGraphicOnLabeled(labelCooldownSeconds, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip cooldownTooltip = new Tooltip("In order to avoid getting flooded with messages, matches that occur during a cooldown period will be ignored and not issue a notification.\nMinimal cooldown period is "
+ WatchdogUI.minCooldownValue + " seconds.");
ToolTipUtilities.setTooltipProperties(cooldownTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, AnchorLocation.WINDOW_TOP_RIGHT);
labelCooldownSeconds.setTooltip(cooldownTooltip);
GUIController.setCommonGraphicOnLabeled(btnAddRow, GUIController.CommonGraphicImages.ADD);
GUIController.setCommonGraphicOnLabeled(btnEditRow, GUIController.CommonGraphicImages.EDIT);
GUIController.setCommonGraphicOnLabeled(btnRemoveRow, GUIController.CommonGraphicImages.REMOVE);
GUIController.setCommonGraphicOnLabeled(btnMoveUp, GUIController.CommonGraphicImages.UP);
GUIController.setCommonGraphicOnLabeled(btnMoveDown, GUIController.CommonGraphicImages.DOWN);
GUIController.setCommonGraphicOnLabeled(btnSaveRuleList, GUIController.CommonGraphicImages.SAVE);
GUIController.setCommonGraphicOnLabeled(menubtnLoadRuleList, GUIController.CommonGraphicImages.LOAD);
GUIController.setCommonGraphicOnLabeled(btnConfigureHotkey, GUIController.CommonGraphicImages.HOTKEY);
GUIController.setCommonGraphicOnLabeled(btnStop, GUIController.CommonGraphicImages.STOP);
GUIController.setGraphicForLabeledControl(btnStart, startWatchdogImageLocation, ContentDisplay.LEFT);
btnStart.setGraphicTextGap(6);
}
VisualTraceController.java 文件源码
项目:WhoWhatWhere
阅读 21
收藏 0
点赞 0
评论 0
private void setColumnHeaderTooltip(TableColumn<TraceLineInfo, ?> column, String headerText, String tooltipText)
{
Label label = new Label(headerText);
GUIController.setCommonGraphicOnLabeled(label, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip tooltip = new Tooltip(tooltipText);
ToolTipUtilities.setTooltipProperties(tooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, AnchorLocation.CONTENT_TOP_LEFT);
label.setTooltip(tooltip);
label.setMaxWidth(Double.MAX_VALUE); //so the entire header width gives the tooltip
column.setGraphic(label);
column.setText("");
}
VisualTraceController.java 文件源码
项目:WhoWhatWhere
阅读 20
收藏 0
点赞 0
评论 0
private void setGraphics()
{
GUIController.setNumberTextFieldValidationUI(numFieldPingTimeout, numFieldStopTracingAfter);
GUIController.setGraphicForLabeledControl(btnTrace, traceIconLocation, ContentDisplay.LEFT);
GUIController.setCommonGraphicOnLabeled(btnAbort, GUIController.CommonGraphicImages.CANCEL);
GUIController.setCommonGraphicOnLabeled(labelVisualTrace, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip visualTraceTooltip = new Tooltip("Trace the route from your computer to another host on the internet and see it visually on a map.");
ToolTipUtilities.setTooltipProperties(visualTraceTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, null);
labelVisualTrace.setTooltip(visualTraceTooltip);
GUIController.setCommonGraphicOnLabeled(labelPingTimeout, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip pingTimeoutTooltip = new Tooltip("The ping timeout (in milliseconds) for each of the 3 pings for every hop. Default value is 3000.");
ToolTipUtilities.setTooltipProperties(pingTimeoutTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, AnchorLocation.WINDOW_TOP_LEFT);
labelPingTimeout.setTooltip(pingTimeoutTooltip);
GUIController.setCommonGraphicOnLabeled(chkResolveHostnames, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip resolveHostnamesTooltip = new Tooltip("Try to resolve each IP's hostname. This might slow down the trace.");
ToolTipUtilities.setTooltipProperties(resolveHostnamesTooltip, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, AnchorLocation.WINDOW_TOP_LEFT);
chkResolveHostnames.setTooltip(resolveHostnamesTooltip);
GUIController.setCommonGraphicOnLabeled(labelConsecutiveTimeouts, GUIController.CommonGraphicImages.TOOLTIP);
Tooltip timeouts = new Tooltip("A few timeouts in a row usually mean that the final destination was reached but it ignores trace requests. In order to avoid excessive waiting when this happens, it's recommended to set this value to about 5.");
ToolTipUtilities.setTooltipProperties(timeouts, true, GUIController.defaultTooltipMaxWidth, GUIController.defaultFontSize, AnchorLocation.WINDOW_TOP_LEFT);
labelConsecutiveTimeouts.setTooltip(timeouts);
}
GUIUtil.java 文件源码
项目:StreamSis
阅读 34
收藏 0
点赞 0
评论 0
/**
* Sets {@link Tooltip} for a {@link Node} which nicely shows {@link ImageView} inside.
*
* @param nodeToHaveTooltip
* The Node for installing Tooltip.
*
* @param imageView
* The ImageView to show inside Tooltip.
*/
public static void setImageViewTooltip(Node nodeToHaveTooltip,
ImageView imageView) {
// Add shadow to ImageView so the actual image will be clearly distinguishable from
// tooltip's background.
DropShadow shadow = new DropShadow(BlurType.ONE_PASS_BOX, Color.GREY, 5.0, 1.0, 0.0, 0.0);
imageView.setEffect(shadow);
// TODO: If image is big and StreamSis window is close to the edge, Tooltip is hiding right
// after it is shown. Need to find workaround.
Tooltip fullPreviewTP = new Tooltip();
fullPreviewTP.setGraphic(imageView);
fullPreviewTP.setAnchorLocation(AnchorLocation.WINDOW_BOTTOM_LEFT);
// fullPreviewTP.setStyle("-fx-effect: dropshadow(three-pass-box, black, 10,0.5,0,0);");
Tooltip.install(nodeToHaveTooltip, fullPreviewTP);
}