本文整理汇总了Java中javafx.beans.NamedArg类的典型用法代码示例。如果您正苦于以下问题:Java NamedArg类的具体用法?Java NamedArg怎么用?Java NamedArg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamedArg类属于javafx.beans包,在下文中一共展示了NamedArg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeChart
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* @param category
* @param selectedChart
* @param type
* @return a chart depending on the category chosen
*/
public ChartView makeChart(@NamedArg("category") SelectedCategory category,
@NamedArg("selectedChart") int selectedChart,
@NamedArg("type") ChartType type) {
switch (category) {
case RESERVATIONS:
return reservationChart(selectedChart, type);
case CLIENTS:
return clientChart(selectedChart, type);
case PURCHASES:
return purchaseChart(selectedChart, type);
case OTHERS:
return otherChart(selectedChart, type);
case NONE:
break;
}
return null;
}
示例2: DecimalTextField
import javafx.beans.NamedArg; //导入依赖的package包/类
public DecimalTextField(@NamedArg("formatPattern") String formatPattern, @NamedArg("locale") Locale locale) {
format = new DecimalFormat(formatPattern, new DecimalFormatSymbols(locale));
DecimalFilter filter = new DecimalFilter(format);
super.setTextFormatter(new TextFormatter<>(filter));
new DecimalFilter().getFormat().getDecimalFormatSymbols().getDecimalSeparator();
textProperty().addListener((observable, oldValue, newValue) -> {
if (newValue.endsWith(String.valueOf(filter.getFormat().getDecimalFormatSymbols().getDecimalSeparator()))) {
newValue = newValue.substring(0, newValue.length() - 1);
}
if (newValue.isEmpty()) {
newValue = "0";
}
try {
value.setValue(format.parse(newValue));
} catch (ParseException e) {
value.setValue(0);
}
});
}
示例3: DraggableTabLayoutExtender
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* Creates an extensible layout around the given component.
*
* @param component component that shall be wrapped
*/
public DraggableTabLayoutExtender(@NamedArg("center") Node component) {
super(component);
// offer drop areas in all directions when user is dragging a tab
draggingTabListener = (observable, oldTab, newTab) -> {
if (lastDraggingTab != newTab) {
lastDraggingTab = newTab;
if (!(getParent().getParent() instanceof SplitPane && getCenter() instanceof SplitPane) && newTab != null) {
DraggableTabFactory factory = DraggableTabFactory.getFactory();
setTop(factory.createInsertPane(this, Direction.UP));
setBottom(factory.createInsertPane(this, Direction.DOWN));
setLeft(factory.createInsertPane(this, Direction.LEFT));
setRight(factory.createInsertPane(this, Direction.RIGHT));
} else {
setTop(null);
setBottom(null);
setLeft(null);
setRight(null);
}
}
};
DraggableTab.draggingTab.addListener(draggingTabListener);
}
示例4: purchaseChart
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* @param selectedChart
* @param type
* @return return charts for the purchase category
*/
private ChartView purchaseChart(@NamedArg("selectedChart") int selectedChart, @NamedArg("type") ChartType type) {
GenericDAO<Product, Integer> dao = new GenericDAO<>(Product.class);
ArrayList<Product> products = (ArrayList<Product>) dao.findAll();
ArrayList<String> objects = new ArrayList<>();
ArrayList<Float> comparative = new ArrayList<>();
String title = null;
switch (selectedChart) {
case 0: // produit le plus vendu
products.sort((p1, p2) -> p2.getSumPurchases() - p1.getSumPurchases());
comparative.sort((o1, o2) -> (int) (o2 - o1));
title = "Produits les plus achetés";
break;
case 1: // produits les moins vendus
products.sort(Comparator.comparingInt(Product::getSumPurchases));
comparative.sort((o1, o2) -> (int) (o1 - o2));
title = "Produits les moins achetés";
break;
default:
break;
}
for (Product c : products) {
int sum = c.getSumPurchases();
objects.add(c.getName());
comparative.add((float) sum);
}
ChartView chartView = new ChartView(ChartType.PIE, objects, comparative, title, "Nom", "Nombre de ventes");
chartView.setLegendSide(Side.BOTTOM);
return chartView;
}
示例5: otherChart
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* @param selectedChart
* @param type
* @return return charts for the others category
*/
private ChartView otherChart(@NamedArg("selectedChart") int selectedChart,
@NamedArg("type") ChartType type) {
GenericDAO<Employee, Integer> dao = new GenericDAO<>(Employee.class);
ArrayList<Employee> employees = (ArrayList<Employee>) dao.findAll();
ArrayList<String> objects = new ArrayList<>();
ArrayList<Float> comparative = new ArrayList<>();
ChartView chartView = null;
switch (selectedChart) {
case 0:
employees.sort((o1, o2) -> o2.getLogs().size() - o1.getLogs().size());
for (Employee e : employees) {
objects.add(e.getFirstName() + " " + e.getLastName());
comparative.add((float) e.getLogs().size());
}
comparative.sort((o1, o2) -> (int) (o2 - o1));
chartView = new ChartView(ChartType.PIE, objects, comparative,"Employés se connectant le plus", "Nom", "Nombre de connections");
chartView.setLegendSide(Side.BOTTOM);
break;
default:
break;
}
return chartView;
}
示例6: OldFXCanvas
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* @inheritDoc
*/
public OldFXCanvas(@NamedArg("parent") Composite parent, @NamedArg("style") int style) {
super(parent, style | SWT.NO_BACKGROUND);
initFx();
hostContainer = new HostContainer();
registerEventListeners();
Display display = parent.getDisplay();
display.addFilter(SWT.Move, moveFilter);
}
示例7: CheckYnColumn
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* @param columnName
*/
public CheckYnColumn(@NamedArg("columnName") String columnName) {
super();
this.columnName = columnName;
this.setCellFactory(defaultCellFactory);
this.setCellValueFactory(defaultCellValueFactory);
}
示例8: TextAreaInputDialog
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* Creates a new TextInputDialog with the default value entered into the
* dialog {@link TextField}.
*/
public TextAreaInputDialog(@NamedArg("defaultValue") String defaultValue) {
final DialogPane dialogPane = getDialogPane();
// -- textfield
this.textField = new TextArea(defaultValue);
this.textField.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(textField, Priority.ALWAYS);
GridPane.setFillWidth(textField, true);
// -- label
label = new Label(dialogPane.getContentText());
label.setPrefWidth(Region.USE_COMPUTED_SIZE);
label.textProperty().bind(dialogPane.contentTextProperty());
this.defaultValue = defaultValue;
this.grid = new GridPane();
this.grid.setHgap(10);
this.grid.setVgap(3);
this.grid.setMaxWidth(Double.MAX_VALUE);
this.grid.setAlignment(Pos.CENTER_LEFT);
dialogPane.contentTextProperty().addListener(o -> updateGrid());
setTitle(ControlResources.getString("Dialog.confirm.title"));
dialogPane.setHeaderText(ControlResources.getString("Dialog.confirm.header"));
dialogPane.getStyleClass().add("text-input-dialog");
dialogPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
updateGrid();
setResultConverter((dialogButton) -> {
ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
return data == ButtonBar.ButtonData.OK_DONE ? textField.getText() : null;
});
}
示例9: CustomSortedList
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* Creates a new SortedList wrapped around the source list.
* The source list will be sorted using the comparator provided. If null is provided, the list
* stays unordered and is equal to the source list.
* @param source a list to wrap
* @param comparator a comparator to use or null for unordered List
*/
@SuppressWarnings("unchecked")
public CustomSortedList(@NamedArg("source") ObservableList<? extends E> source, @NamedArg("comparator") Comparator<? super E> comparator) {
super(source);
sorted = (Element<E>[]) new Element[source.size() *3/2 + 1];
size = source.size();
for (int i = 0; i < size; ++i) {
sorted[i] = new Element<E>(source.get(i), i);
}
if (comparator != null) {
setComparator(comparator);
}
}
示例10: PhoenicisFilteredList
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* Constructs a new FilteredList wrapper around the source list.
* The provided predicate will match the elements in the source list that will be visible.
* If the predicate is null, all elements will be matched and the list is equal to the source list.
* @param source the source list
* @param predicate the predicate to match the elements or null to match all elements.
*/
public PhoenicisFilteredList(@NamedArg("source") ObservableList<E> source,
@NamedArg("predicate") Predicate<? super E> predicate) {
super(source);
filtered = new int[source.size() * 3 / 2 + 1];
if (predicate != null) {
setPredicate(predicate);
} else {
for (size = 0; size < source.size(); size++) {
filtered[size] = size;
}
}
}
示例11: FXCanvas
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* @inheritDoc
* @deprecated use {@link FXCanvas2} instead
*/
@Deprecated
public FXCanvas(@NamedArg("parent") Composite parent, @NamedArg("style") int style) {
super(parent, style | SWT.NO_BACKGROUND);
initFx();
this.hostContainer = new HostContainer();
this.registerEventListeners();
Display display = parent.getDisplay();
display.addFilter(SWT.Move, this.moveFilter);
}
示例12: GenericStyledArea
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* The same as {@link #GenericStyledArea(Object, BiConsumer, Object, TextOps, Function)} except that
* this constructor can be used to create another {@code GenericStyledArea} that renders and edits the same
* {@link EditableStyledDocument} or when one wants to use a custom {@link EditableStyledDocument} implementation.
*/
public GenericStyledArea(
@NamedArg("initialParagraphStyle") PS initialParagraphStyle,
@NamedArg("applyParagraphStyle") BiConsumer<TextFlow, PS> applyParagraphStyle,
@NamedArg("initialTextStyle") S initialTextStyle,
@NamedArg("document") EditableStyledDocument<PS, SEG, S> document,
@NamedArg("segmentOps") TextOps<SEG, S> segmentOps,
@NamedArg("nodeFactory") Function<StyledSegment<SEG, S>, Node> nodeFactory) {
this(initialParagraphStyle, applyParagraphStyle, initialTextStyle, document, segmentOps, true, nodeFactory);
}
示例13: StyleClassedTextArea
import javafx.beans.NamedArg; //导入依赖的package包/类
public StyleClassedTextArea(@NamedArg("document") EditableStyledDocument<Collection<String>, String, Collection<String>> document,
@NamedArg("preserveStyle") boolean preserveStyle) {
super(Collections.<String>emptyList(),
(paragraph, styleClasses) -> paragraph.getStyleClass().addAll(styleClasses),
Collections.<String>emptyList(),
(text, styleClasses) -> text.getStyleClass().addAll(styleClasses),
document, preserveStyle
);
setStyleCodecs(
Codec.collectionCodec(Codec.STRING_CODEC),
Codec.styledTextCodec(Codec.collectionCodec(Codec.STRING_CODEC))
);
}
示例14: InlineCssTextArea
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* Creates an area that can render and edit another area's {@link EditableStyledDocument} or a developer's
* custom implementation of {@link EditableStyledDocument}.
*/
public InlineCssTextArea(@NamedArg("document") EditableStyledDocument<String, String, String> document) {
super(
"", TextFlow::setStyle,
"", TextExt::setStyle,
document,
true
);
}
示例15: CodeArea
import javafx.beans.NamedArg; //导入依赖的package包/类
/**
* Creates a text area with initial text content.
* Initial caret position is set at the beginning of text content.
*
* @param text Initial text content.
*/
public CodeArea(@NamedArg("text") String text) {
this();
appendText(text);
getUndoManager().forgetHistory();
getUndoManager().mark();
// position the caret at the beginning
selectRange(0, 0);
}