Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fa0abb8af | |||
|
|
c71c1f7194 | ||
| 26b1282845 | |||
|
|
76d70c17d1 | ||
|
|
1fb15761f1 | ||
|
|
9bdcd5f035 | ||
|
|
22c1f1d0f3 | ||
| 112e4ac4c4 | |||
|
|
d7278803c0 | ||
|
|
448a00eff8 | ||
| 9e428f7a03 | |||
|
|
7de68dd86d | ||
| e163796bcb | |||
|
|
93128acef2 | ||
| e9d39e26dc | |||
|
|
183f106a85 | ||
| a33dbdeb65 | |||
|
|
96087e4dcd | ||
|
|
ba2bf5f795 | ||
| 91002037df | |||
|
|
ec7145085c |
4
NovaPoshta/.gitignore
vendored
@ -3,6 +3,7 @@ target/
|
|||||||
!.mvn/wrapper/maven-wrapper.jar
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
!**/src/main/**/target/
|
!**/src/main/**/target/
|
||||||
!**/src/test/**/target/
|
!**/src/test/**/target/
|
||||||
|
logs
|
||||||
|
|
||||||
### STS ###
|
### STS ###
|
||||||
.apt_generated
|
.apt_generated
|
||||||
@ -34,6 +35,9 @@ build/
|
|||||||
|
|
||||||
### App ###
|
### App ###
|
||||||
*.properties
|
*.properties
|
||||||
|
!application.properties
|
||||||
|
!lang*.properties
|
||||||
|
.mvn
|
||||||
mvnw
|
mvnw
|
||||||
mvnw.cmd
|
mvnw.cmd
|
||||||
*.zip
|
*.zip
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"apiKey": "[ВАШ КЛЮЧ]",
|
|
||||||
"modelName": "TrackingDocument",
|
|
||||||
"calledMethod": "getStatusDocuments",
|
|
||||||
"methodProperties": {
|
|
||||||
"Documents" : [
|
|
||||||
{
|
|
||||||
"DocumentNumber":"20400048799000",
|
|
||||||
"Phone":"380600000000"
|
|
||||||
}
|
|
||||||
,
|
|
||||||
{
|
|
||||||
"DocumentNumber":"20400048799001",
|
|
||||||
"Phone":"380600000000"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
{
|
|
||||||
"success": true,
|
|
||||||
"data": [{
|
|
||||||
"PossibilityCreateReturn" : true,
|
|
||||||
"PossibilityCreateRefusal" : true,
|
|
||||||
"PossibilityChangeEW" : true,
|
|
||||||
"PossibilityCreateRedirecting" : true,
|
|
||||||
"Number" : "20400048799000",
|
|
||||||
"Redelivery" : "0",
|
|
||||||
"RedeliverySum" : "0",
|
|
||||||
"RedeliveryNum" : "",
|
|
||||||
"RedeliveryPayer" : "Sender/Recipient",
|
|
||||||
"OwnerDocumentType" : "",
|
|
||||||
"LastCreatedOnTheBasisDocumentType" : "",
|
|
||||||
"LastCreatedOnTheBasisPayerType" : "",
|
|
||||||
"LastCreatedOnTheBasisDateTime" : "",
|
|
||||||
"LastTransactionStatusGM" : "",
|
|
||||||
"LastTransactionDateTimeGM" : "",
|
|
||||||
"LastAmountTransferGM" : "",
|
|
||||||
"DateCreated" : "18-11-2021 11:52:42",
|
|
||||||
"DocumentWeight" : "3",
|
|
||||||
"FactualWeight" : "3",
|
|
||||||
"VolumeWeight" : "0.1",
|
|
||||||
"CheckWeight" : "",
|
|
||||||
"CheckWeightMethod" : "",
|
|
||||||
"DocumentCost" : "51",
|
|
||||||
"CalculatedWeight" : "3",
|
|
||||||
"SumBeforeCheckWeight" : "",
|
|
||||||
"PayerType" : "Sender",
|
|
||||||
"RecipientFullName" : "ПІБ",
|
|
||||||
"RecipientDateTime" : "21.11.2021 13:53:47",
|
|
||||||
"ScheduledDeliveryDate" : "19.11.2021 13:53:47",
|
|
||||||
"PaymentMethod" : "Cash",
|
|
||||||
"CargoDescriptionString" : "Одяг",
|
|
||||||
"CargoType" : "Cargo",
|
|
||||||
"CitySender" : "Київ",
|
|
||||||
"CityRecipient" : "Київ",
|
|
||||||
"WarehouseRecipient" : "Відділення №101 (до 15 кг), Міні-відділення: вул. Велика Васильківська, 143/2, (маг. "Фора")",
|
|
||||||
"CounterpartyType" : "PrivatePerson",
|
|
||||||
"AfterpaymentOnGoodsCost" : "0",
|
|
||||||
"ServiceType" : "WarehouseWarehouse",
|
|
||||||
"UndeliveryReasonsSubtypeDescription" : "",
|
|
||||||
"WarehouseRecipientNumber" : "101",
|
|
||||||
"LastCreatedOnTheBasisNumber" : "",
|
|
||||||
"PhoneRecipient" : "380600000000",
|
|
||||||
"RecipientFullNameEW" : "",
|
|
||||||
"WarehouseRecipientInternetAddressRef" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"MarketplacePartnerToken" : "",
|
|
||||||
"ClientBarcode" : "",
|
|
||||||
"RecipientAddress" : "м. Київ, Відділення №101 (до 15 кг), Міні-відділення, вул. Велика Васильківська, 143/2",
|
|
||||||
"CounterpartyRecipientDescription" : "Приватна особа",
|
|
||||||
"DateScan" : "0001-01-01 00:00:00",
|
|
||||||
"PaymentStatus" : "",
|
|
||||||
"PaymentStatusDate" : "",
|
|
||||||
"AmountToPay" : "",
|
|
||||||
"AmountPaid" : "",
|
|
||||||
"Status" : "",
|
|
||||||
"StatusCode" : "",
|
|
||||||
"RefEW" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"BackwardDeliverySubTypesActions" : "",
|
|
||||||
"BackwardDeliverySubTypesServices" : "",
|
|
||||||
"UndeliveryReasons" : "",
|
|
||||||
"DatePayedKeeping" : "",
|
|
||||||
"InternationalDeliveryType" : "",
|
|
||||||
"SeatsAmount" : "1",
|
|
||||||
"CardMaskedNumber" : "",
|
|
||||||
"ExpressWaybillPaymentStatus" : "PaymentNotAvailable",
|
|
||||||
"ExpressWaybillAmountToPay" : "",
|
|
||||||
"PhoneSender" : "",
|
|
||||||
"TrackingUpdateDate" : "2022-06-07 13:42:56",
|
|
||||||
"WarehouseSender" : "Отделение №178 (до 30 кг): просп. Оболонский, 35",
|
|
||||||
"DateReturnCargo" : "",
|
|
||||||
"DateMoving" : "",
|
|
||||||
"DateFirstDayStorage" : "",
|
|
||||||
"RefCityRecipient" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"RefCitySender" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"RefSettlementRecipient" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"RefSettlementSender" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"SenderAddress" : "м. Київ, Відділення №178 (до 30 кг): просп. Оболонський, 35",
|
|
||||||
"SenderFullNameEW" : "Іванов Петро Миколайович",
|
|
||||||
"AnnouncedPrice" : "50000",
|
|
||||||
"AdditionalInformationEW" : "",
|
|
||||||
"ActualDeliveryDate" : "",
|
|
||||||
"PostomatV3CellReservationNumber" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"OwnerDocumentNumber" : "",
|
|
||||||
"LastAmountReceivedCommissionGM" : "",
|
|
||||||
"DeliveryTimeframe" : "",
|
|
||||||
"CreatedOnTheBasis" : "",
|
|
||||||
"UndeliveryReasonsDate" : "",
|
|
||||||
"RecipientWarehouseTypeRef" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"WarehouseRecipientRef" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"CategoryOfWarehouse" : "Branch",
|
|
||||||
"WarehouseRecipientAddress" : "Киев, Героев Днепра, 53",
|
|
||||||
"WarehouseSenderInternetAddressRef" : "00000000-0000-0000-0000-000000000000",
|
|
||||||
"WarehouseSenderAddress" : "Киев, Оболонский, 35",
|
|
||||||
"CounterpartySenderType" : "PrivatePerson",
|
|
||||||
"AviaDelivery" : "",
|
|
||||||
"BarcodeRedBox" : "",
|
|
||||||
"CargoReturnRefusal" : "false",
|
|
||||||
"DaysStorageCargo" : "",
|
|
||||||
"Packaging" : null,
|
|
||||||
"PartialReturnGoods" : null,
|
|
||||||
"SecurePayment" : "false",
|
|
||||||
"PossibilityChangeCash2Card" : true,
|
|
||||||
"PossibilityChangeDeliveryIntervals" : true,
|
|
||||||
"PossibilityTermExtensio" : true,
|
|
||||||
"StorageAmount" : "",
|
|
||||||
"StoragePrice" : "",
|
|
||||||
"FreeShipping" : "",
|
|
||||||
"LoyaltyCardRecipient" : ""
|
|
||||||
}],
|
|
||||||
"errors": [],
|
|
||||||
"warnings": [],
|
|
||||||
"info": [],
|
|
||||||
"messageCodes": [],
|
|
||||||
"errorCodes": [],
|
|
||||||
"warningCodes": [],
|
|
||||||
"infoCodes": []
|
|
||||||
}
|
|
||||||
@ -1,204 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013, ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples.actions;
|
|
||||||
|
|
||||||
import javafx.beans.property.BooleanProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Control;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.image.Image;
|
|
||||||
import javafx.scene.image.ImageView;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.action.Action;
|
|
||||||
import org.controlsfx.control.action.ActionCheck;
|
|
||||||
import org.controlsfx.control.action.ActionGroup;
|
|
||||||
import org.controlsfx.control.action.ActionUtils;
|
|
||||||
import org.controlsfx.control.action.ActionUtils.ActionTextBehavior;
|
|
||||||
import org.controlsfx.samples.Utils;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import static org.controlsfx.control.action.ActionUtils.ACTION_SEPARATOR;
|
|
||||||
import static org.controlsfx.control.action.ActionUtils.ACTION_SPAN;
|
|
||||||
|
|
||||||
public class HelloActionGroup extends ControlsFXSample {
|
|
||||||
|
|
||||||
private static final ImageView image = new ImageView( new Image("/org/controlsfx/samples/security-low.png"));
|
|
||||||
|
|
||||||
private Collection<? extends Action> actions = Arrays.asList(
|
|
||||||
new ActionGroup("Group 1", image, new DummyAction("Action 1.1", image),
|
|
||||||
new CheckDummyAction("Action 1.2") ),
|
|
||||||
new ActionGroup("Group 2", image, new DummyAction("Action 2.1"),
|
|
||||||
ACTION_SEPARATOR,
|
|
||||||
new ActionGroup("Action 2.2", new DummyAction("Action 2.2.1"),
|
|
||||||
new CheckDummyAction("Action 2.2.2")),
|
|
||||||
new DummyAction("Action 2.3") ),
|
|
||||||
ACTION_SPAN,
|
|
||||||
ACTION_SEPARATOR,
|
|
||||||
new CheckDummyAction("Action 3", image),
|
|
||||||
new ActionGroup("Group 4", image, new DummyAction("Action 4.1", image),
|
|
||||||
new CheckDummyAction("Action 4.2"))
|
|
||||||
);
|
|
||||||
|
|
||||||
private static class DummyAction extends Action {
|
|
||||||
public DummyAction(String name, Node image) {
|
|
||||||
super(name);
|
|
||||||
setGraphic(image);
|
|
||||||
setEventHandler(ae -> String.format("Action '%s' is executed", getText()) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public DummyAction( String name ) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String toString() {
|
|
||||||
return getText();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionCheck
|
|
||||||
private static class CheckDummyAction extends Action {
|
|
||||||
public CheckDummyAction(String name, Node image) {
|
|
||||||
super(name);
|
|
||||||
setGraphic(image);
|
|
||||||
setEventHandler(ae -> String.format("Action '%s' is executed", getText()) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckDummyAction( String name ) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String toString() {
|
|
||||||
return getText();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObservableList<Action> flatten( Collection<? extends Action> actions, ObservableList<Action> dest ) {
|
|
||||||
for (Action a : actions) {
|
|
||||||
if ( a == null || a == ActionUtils.ACTION_SEPARATOR ) continue;
|
|
||||||
dest.add(a);
|
|
||||||
if ( a instanceof ActionGroup ) {
|
|
||||||
flatten( ((ActionGroup)a).getActions(), dest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getSampleName() {
|
|
||||||
return "Action Group";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE + "org/controlsfx/control/action/ActionGroup.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getSampleDescription() {
|
|
||||||
return "MenuBar, ToolBar and ContextMenu presented here are effortlessly built out of the same action tree. " +
|
|
||||||
"Action properties can be dynamically changed, triggering changes in all related controls";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// Dynamically enable/disable action
|
|
||||||
Label lblAddCrumb = new Label("Dynamically enable/disable action: ");
|
|
||||||
lblAddCrumb.getStyleClass().add("property");
|
|
||||||
grid.add(lblAddCrumb, 0, row);
|
|
||||||
final ComboBox<Action> cbActions = new ComboBox<>(flatten( actions, FXCollections.<Action>observableArrayList()));
|
|
||||||
cbActions.getSelectionModel().select(0);
|
|
||||||
grid.add(cbActions, 1, row);
|
|
||||||
Action toggleAction = new Action("Enable/Disable") {
|
|
||||||
{ setEventHandler(this::handleAction); }
|
|
||||||
|
|
||||||
private void handleAction(ActionEvent ae) {
|
|
||||||
Action action = cbActions.getSelectionModel().getSelectedItem();
|
|
||||||
if ( action != null ) {
|
|
||||||
BooleanProperty p = action.disabledProperty();
|
|
||||||
p.set(!p.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
grid.add(ActionUtils.createButton(toggleAction), 2, row++);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getPanel(final Stage stage) {
|
|
||||||
VBox root = new VBox(10);
|
|
||||||
root.setPadding(new Insets(10, 10, 10, 10));
|
|
||||||
root.setMaxHeight(Double.MAX_VALUE);
|
|
||||||
|
|
||||||
Insets topMargin = new Insets(7, 7, 0, 7);
|
|
||||||
Insets margin = new Insets(0, 7, 7, 7);
|
|
||||||
|
|
||||||
addWithMargin(root, new Label("MenuBar:"), topMargin ).setStyle("-fx-font-weight: bold;");
|
|
||||||
addWithMargin(root, ActionUtils.createMenuBar(actions), margin);
|
|
||||||
|
|
||||||
addWithMargin(root,new Label("ToolBar (with text on controls):"), topMargin).setStyle("-fx-font-weight: bold;");
|
|
||||||
addWithMargin(root, ActionUtils.createToolBar(actions, ActionTextBehavior.SHOW), margin);
|
|
||||||
|
|
||||||
addWithMargin(root,new Label("ToolBar (no text on controls):"), topMargin).setStyle("-fx-font-weight: bold;");
|
|
||||||
addWithMargin(root, ActionUtils.createToolBar(actions, ActionTextBehavior.HIDE), margin);
|
|
||||||
|
|
||||||
addWithMargin(root, new Label("ContextMenu:"), topMargin).setStyle("-fx-font-weight: bold;");
|
|
||||||
Label context = new Label("Right-click to see the context menu");
|
|
||||||
addWithMargin(root,context, margin);
|
|
||||||
context.setContextMenu(ActionUtils.createContextMenu(actions));
|
|
||||||
context.setStyle("-fx-background-color: #E0E0E0 ;-fx-border-color: black;-fx-border-style: dotted");
|
|
||||||
context.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
|
||||||
VBox.setVgrow(context, Priority.ALWAYS);
|
|
||||||
VBox.setVgrow(root, Priority.ALWAYS);
|
|
||||||
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Control addWithMargin( VBox parent, Control control, Insets insets) {
|
|
||||||
parent.getChildren().add(control);
|
|
||||||
VBox.setMargin(control, insets);
|
|
||||||
return control;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,224 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013, ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples.actions;
|
|
||||||
|
|
||||||
import javafx.beans.property.BooleanProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Control;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.image.Image;
|
|
||||||
import javafx.scene.image.ImageView;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.action.*;
|
|
||||||
import org.controlsfx.control.action.ActionUtils.ActionTextBehavior;
|
|
||||||
import org.controlsfx.samples.Utils;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import static org.controlsfx.control.action.ActionMap.action;
|
|
||||||
import static org.controlsfx.control.action.ActionMap.actions;
|
|
||||||
import static org.controlsfx.control.action.ActionUtils.ACTION_SEPARATOR;
|
|
||||||
import static org.controlsfx.control.action.ActionUtils.ACTION_SPAN;
|
|
||||||
|
|
||||||
public class HelloActionProxy extends ControlsFXSample {
|
|
||||||
|
|
||||||
private static final String imagePath = "/org/controlsfx/samples/security-low.png";
|
|
||||||
private static final ImageView image = new ImageView(new Image(imagePath));
|
|
||||||
|
|
||||||
private Collection<? extends Action> actions;
|
|
||||||
|
|
||||||
public HelloActionProxy() {
|
|
||||||
ActionMap.register(this);
|
|
||||||
actions = Arrays.asList(
|
|
||||||
new ActionGroup("Group 1", image, actions("action11","action12") ),
|
|
||||||
new ActionGroup("Group 2", image, actions("action21","---","action22", "action221","action222","action23") ),
|
|
||||||
ACTION_SPAN,
|
|
||||||
ACTION_SEPARATOR,
|
|
||||||
action("action3"),
|
|
||||||
new ActionGroup("Group 4", image, actions("action41","action42"))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionProxy(text="Action 1.1", graphic=imagePath, accelerator="ctrl+shift+T")
|
|
||||||
private void action11() {
|
|
||||||
System.out.println( "Action 1.1 is executed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionCheck
|
|
||||||
@ActionProxy(text="Action 1.2", graphic="http://icons.iconarchive.com/icons/custom-icon-design/mini-3/16/teacher-male-icon.png")
|
|
||||||
private void action12() {
|
|
||||||
System.out.println( "Action 1.2 is executed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionProxy(text="Action 2.1", graphic=imagePath, factory="org.controlsfx.samples.actions.HelloCustomActionFactory")
|
|
||||||
private void action21() {
|
|
||||||
System.out.println( "Action 2.1 is executed (and used a custom action factory)");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionProxy(text="Action 2.2", graphic=imagePath)
|
|
||||||
private void action22( ActionEvent evt ) {
|
|
||||||
System.out.println( "Action 2.2 is executed (and received an ActionEvent)");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionProxy(text="Action 2.2.1", graphic=imagePath)
|
|
||||||
private void action221( ActionEvent evt, Action action ) {
|
|
||||||
System.out.println( "Action 2.2.1 is executed (and received both an ActionEvent and an Action)");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionProxy(text="Action 2.2.2", graphic=imagePath)
|
|
||||||
private void action222() {
|
|
||||||
System.out.println( "Action 2.2.2 is executed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionProxy(text="Action 2.3", graphic=imagePath)
|
|
||||||
private void action23() {
|
|
||||||
System.out.println( "Action 2.3 is executed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionCheck
|
|
||||||
@ActionProxy(text="Action 3", graphic="font>FontAwesome|STAR")
|
|
||||||
private void action3() {
|
|
||||||
System.out.println( "Action 3 is executed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionProxy(text="Action 4.1", graphic=imagePath)
|
|
||||||
private void action41() {
|
|
||||||
System.out.println( "Action 4.1 is executed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ActionProxy(text="Action 4.2", graphic=imagePath)
|
|
||||||
private void action42() {
|
|
||||||
System.out.println( "Action 4.2 is executed");
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObservableList<Action> flatten( Collection<? extends Action> actions, ObservableList<Action> dest ) {
|
|
||||||
|
|
||||||
for (Action a : actions) {
|
|
||||||
if ( a == null || a == ActionUtils.ACTION_SEPARATOR ) continue;
|
|
||||||
dest.add(a);
|
|
||||||
if ( a instanceof ActionGroup ) {
|
|
||||||
flatten( ((ActionGroup)a).getActions(), dest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override public String getSampleName() {
|
|
||||||
return "Action Proxy";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE + "org/controlsfx/control/action/ActionProxy.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getSampleDescription() {
|
|
||||||
return "MenuBar, ToolBar and ContextMenu presented here are effortlessly built out of the same action tree. " +
|
|
||||||
"Action properties can be dynamically changed, triggering changes in all related controls";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// Dynamically enable/disable action
|
|
||||||
Label lblAddCrumb = new Label("Dynamically enable/disable action: ");
|
|
||||||
lblAddCrumb.getStyleClass().add("property");
|
|
||||||
grid.add(lblAddCrumb, 0, row);
|
|
||||||
final ComboBox<Action> cbActions = new ComboBox<>(flatten( actions, FXCollections.<Action>observableArrayList()));
|
|
||||||
cbActions.getSelectionModel().select(0);
|
|
||||||
grid.add(cbActions, 1, row);
|
|
||||||
Action toggleAction = new Action("Enable/Disable") {
|
|
||||||
{ setEventHandler(this::handleAction); }
|
|
||||||
|
|
||||||
private void handleAction(ActionEvent ae) {
|
|
||||||
Action action = cbActions.getSelectionModel().getSelectedItem();
|
|
||||||
if ( action != null ) {
|
|
||||||
BooleanProperty p = action.disabledProperty();
|
|
||||||
p.set(!p.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
grid.add(ActionUtils.createButton(toggleAction), 2, row++);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getPanel(final Stage stage) {
|
|
||||||
VBox root = new VBox(10);
|
|
||||||
root.setPadding(new Insets(10, 10, 10, 10));
|
|
||||||
root.setMaxHeight(Double.MAX_VALUE);
|
|
||||||
|
|
||||||
Insets topMargin = new Insets(7, 7, 0, 7);
|
|
||||||
Insets margin = new Insets(0, 7, 7, 7);
|
|
||||||
|
|
||||||
addWithMargin(root, new Label("MenuBar:"), topMargin ).setStyle("-fx-font-weight: bold;");
|
|
||||||
addWithMargin(root, ActionUtils.createMenuBar(actions), margin);
|
|
||||||
|
|
||||||
addWithMargin(root,new Label("ToolBar (with text on controls):"), topMargin).setStyle("-fx-font-weight: bold;");
|
|
||||||
addWithMargin(root, ActionUtils.createToolBar(actions, ActionTextBehavior.SHOW), margin);
|
|
||||||
|
|
||||||
addWithMargin(root,new Label("ToolBar (no text on controls):"), topMargin).setStyle("-fx-font-weight: bold;");
|
|
||||||
addWithMargin(root, ActionUtils.createToolBar(actions, ActionTextBehavior.HIDE), margin);
|
|
||||||
|
|
||||||
addWithMargin(root, new Label("ContextMenu:"), topMargin).setStyle("-fx-font-weight: bold;");
|
|
||||||
Label context = new Label("Right-click to see the context menu");
|
|
||||||
addWithMargin(root,context, margin);
|
|
||||||
context.setContextMenu(ActionUtils.createContextMenu(actions));
|
|
||||||
context.setStyle("-fx-background-color: #E0E0E0 ;-fx-border-color: black;-fx-border-style: dotted");
|
|
||||||
context.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
|
||||||
VBox.setVgrow(context, Priority.ALWAYS);
|
|
||||||
VBox.setVgrow(root, Priority.ALWAYS);
|
|
||||||
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Control addWithMargin( VBox parent, Control control, Insets insets) {
|
|
||||||
parent.getChildren().add(control);
|
|
||||||
VBox.setMargin(control, insets);
|
|
||||||
return control;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,208 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014, ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples.textfields;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.textfield.AutoCompletionBinding;
|
|
||||||
import org.controlsfx.control.textfield.TextFields;
|
|
||||||
import org.controlsfx.samples.Utils;
|
|
||||||
|
|
||||||
import impl.org.controlsfx.skin.AutoCompletePopup;
|
|
||||||
import impl.org.controlsfx.skin.AutoCompletePopupSkin;
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.ListCell;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.input.KeyEvent;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.paint.Color;
|
|
||||||
import javafx.scene.shape.Rectangle;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
public class HelloAutoComplete extends ControlsFXSample {
|
|
||||||
|
|
||||||
private AutoCompletionBinding<String> autoCompletionBinding;
|
|
||||||
private String[] _possibleSuggestions = {"Hey", "Hello", "Hello World", "Apple", "Cool", "Costa", "Cola", "Coca Cola"};
|
|
||||||
private Set<String> possibleSuggestions = new HashSet<>(Arrays.asList(_possibleSuggestions));
|
|
||||||
private Map<String, Color> colorSuggestions = allColorsWithName();
|
|
||||||
|
|
||||||
private TextField learningTextField;
|
|
||||||
|
|
||||||
@Override public String getSampleName() {
|
|
||||||
return "AutoComplete";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE + "org/controlsfx/control/textfield/TextFields.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getSampleDescription() {
|
|
||||||
return "AutoComplete helps a user with suggestions to type faster, "
|
|
||||||
+ "but does not limit the user from entering alternative text."
|
|
||||||
+ "\n\n"
|
|
||||||
+ "The textfields have been primed with the following words:\n"
|
|
||||||
+ "\"Hey\", \"Hello\", \"Hello World\", \"Apple\", \"Cool\", "
|
|
||||||
+ "\"Costa\", \"Cola\", \"Coca Cola\""
|
|
||||||
+ "\n\n"
|
|
||||||
+ "The 'Learning TextField' will add whatever words are typed "
|
|
||||||
+ "to the auto-complete popup, as long as you press Enter once "
|
|
||||||
+ "you've finished typing the word."
|
|
||||||
+ "\n\n"
|
|
||||||
+ "The Color TextField will suggest different colors when you type "
|
|
||||||
+ "in their name.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getPanel(final Stage stage) {
|
|
||||||
|
|
||||||
BorderPane root = new BorderPane();
|
|
||||||
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
//
|
|
||||||
// TextField with static auto-complete functionality
|
|
||||||
//
|
|
||||||
TextField textField = new TextField();
|
|
||||||
|
|
||||||
TextFields.bindAutoCompletion(
|
|
||||||
textField,
|
|
||||||
"Hey", "Hello", "Hello World", "Apple", "Cool", "Costa", "Cola", "Coca Cola");
|
|
||||||
|
|
||||||
grid.add(new Label("Auto-complete Text"), 0, 0);
|
|
||||||
grid.add(textField, 1, 0);
|
|
||||||
GridPane.setHgrow(textField, Priority.ALWAYS);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// TextField with learning auto-complete functionality
|
|
||||||
// Learn the word when user presses ENTER
|
|
||||||
//
|
|
||||||
learningTextField = new TextField();
|
|
||||||
autoCompletionBinding = TextFields.bindAutoCompletion(learningTextField, possibleSuggestions);
|
|
||||||
learningTextField.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
|
||||||
@Override
|
|
||||||
public void handle(KeyEvent ke) {
|
|
||||||
switch (ke.getCode()) {
|
|
||||||
case ENTER:
|
|
||||||
autoCompletionLearnWord(learningTextField.getText().trim());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
grid.add(new Label("Learning TextField"), 0, 1);
|
|
||||||
grid.add(learningTextField, 1, 1);
|
|
||||||
GridPane.setHgrow(learningTextField, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//
|
|
||||||
// TextField with custom cell factory
|
|
||||||
// Completes color names
|
|
||||||
//
|
|
||||||
TextField customTextField = new TextField();
|
|
||||||
AutoCompletePopup<String> colorCompletionPopup = TextFields.bindAutoCompletion(customTextField, colorSuggestions.keySet()).getAutoCompletionPopup();
|
|
||||||
colorCompletionPopup.setSkin(new AutoCompletePopupSkin<String>(colorCompletionPopup, param -> new ListCell<String>() {
|
|
||||||
@Override
|
|
||||||
public void updateItem(String item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
if (empty) {
|
|
||||||
setText(null);
|
|
||||||
setGraphic(null);
|
|
||||||
} else {
|
|
||||||
setGraphic(new Rectangle(32, 32, colorSuggestions.get(item)));
|
|
||||||
setText(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
grid.add(new Label("Color TextField with custom CellFactory"), 0, 2);
|
|
||||||
grid.add(customTextField, 1, 2);
|
|
||||||
GridPane.setHgrow(customTextField, Priority.ALWAYS);
|
|
||||||
|
|
||||||
root.setTop(grid);
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void autoCompletionLearnWord(String newWord){
|
|
||||||
possibleSuggestions.add(newWord);
|
|
||||||
|
|
||||||
// we dispose the old binding and recreate a new binding
|
|
||||||
if (autoCompletionBinding != null) {
|
|
||||||
autoCompletionBinding.dispose();
|
|
||||||
}
|
|
||||||
autoCompletionBinding = TextFields.bindAutoCompletion(learningTextField, possibleSuggestions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
// TODO Add customization example controls
|
|
||||||
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Modified from https://stackoverflow.com/a/17465261/6094756 */
|
|
||||||
private Map<String, Color> allColorsWithName() {
|
|
||||||
Map<String, Color> map = new HashMap<>();
|
|
||||||
try {
|
|
||||||
for (Field f : Color.class.getFields()) {
|
|
||||||
Object obj = f.get(null);
|
|
||||||
if (obj instanceof Color) {
|
|
||||||
map.put(f.getName(), (Color) obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
|
||||||
map.put("red", Color.RED);
|
|
||||||
map.put("green", Color.GREEN);
|
|
||||||
map.put("blue", Color.BLUE);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,241 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013, 2018 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples.checked;
|
|
||||||
|
|
||||||
import javafx.beans.binding.Bindings;
|
|
||||||
import javafx.beans.property.ReadOnlyStringProperty;
|
|
||||||
import javafx.beans.property.ReadOnlyStringWrapper;
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
|
||||||
import javafx.beans.property.StringProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ListChangeListener;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.util.StringConverter;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.CheckComboBox;
|
|
||||||
import org.controlsfx.control.IndexedCheckModel;
|
|
||||||
import org.controlsfx.samples.Utils;
|
|
||||||
|
|
||||||
public class HelloCheckComboBox extends ControlsFXSample {
|
|
||||||
|
|
||||||
private final Label checkedItemsLabel = new Label();
|
|
||||||
private CheckComboBox<String> checkComboBox;
|
|
||||||
|
|
||||||
@Override public String getSampleName() {
|
|
||||||
return "CheckComboBox";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE + "org/controlsfx/control/CheckComboBox.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getSampleDescription() {
|
|
||||||
return "A simple UI control that makes it possible to select zero or "
|
|
||||||
+ "more items within a ComboBox without the need to set a custom "
|
|
||||||
+ "cell factory or manually create boolean properties for each "
|
|
||||||
+ "row - simply use the check model property to request the "
|
|
||||||
+ "current selection state.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getPanel(Stage stage) {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
final ObservableList<String> strings = FXCollections.observableArrayList();
|
|
||||||
for (int i = 0; i <= 100; i++) {
|
|
||||||
strings.add("Item " + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// normal ComboBox
|
|
||||||
grid.add(new Label("Normal ComboBox: "), 0, row);
|
|
||||||
final ComboBox<String> comboBox = new ComboBox<>(strings);
|
|
||||||
comboBox.focusedProperty().addListener((o, ov, nv) -> {
|
|
||||||
if(nv) comboBox.show(); else comboBox.hide();
|
|
||||||
});
|
|
||||||
grid.add(comboBox, 1, row++);
|
|
||||||
|
|
||||||
// CheckComboBox
|
|
||||||
checkComboBox = new CheckComboBox<>(strings);
|
|
||||||
checkComboBox.focusedProperty().addListener((o, ov, nv) -> {
|
|
||||||
if(nv) checkComboBox.show(); else checkComboBox.hide();
|
|
||||||
});
|
|
||||||
checkComboBox.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) change -> {
|
|
||||||
updateText(checkedItemsLabel, change.getList());
|
|
||||||
|
|
||||||
while (change.next()) {
|
|
||||||
System.out.println("============================================");
|
|
||||||
System.out.println("Change: " + change);
|
|
||||||
System.out.println("Added sublist " + change.getAddedSubList());
|
|
||||||
System.out.println("Removed sublist " + change.getRemoved());
|
|
||||||
System.out.println("List " + change.getList());
|
|
||||||
System.out.println("Added " + change.wasAdded() + " Permutated " + change.wasPermutated() + " Removed " + change.wasRemoved() + " Replaced "
|
|
||||||
+ change.wasReplaced() + " Updated " + change.wasUpdated());
|
|
||||||
System.out.println("============================================");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
grid.add(new Label("CheckComboBox: "), 0, row);
|
|
||||||
grid.add(checkComboBox, 1, row++);
|
|
||||||
|
|
||||||
CheckComboBox<Person> checkComboBox2 = new CheckComboBox<>(Person.createDemoList());
|
|
||||||
checkComboBox2.setConverter(new StringConverter<Person>() {
|
|
||||||
@Override
|
|
||||||
public String toString(Person object) {
|
|
||||||
return object.getFullName();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Person fromString(String string) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
checkComboBox2.focusedProperty().addListener((o, ov, nv) -> {
|
|
||||||
if(nv) checkComboBox2.show(); else checkComboBox2.hide();
|
|
||||||
});
|
|
||||||
grid.add(new Label("CheckComboBox with data objects: "), 0, row);
|
|
||||||
grid.add(checkComboBox2, 1, row);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
Label label1 = new Label("Checked items: ");
|
|
||||||
label1.getStyleClass().add("property");
|
|
||||||
grid.add(label1, 0, 0);
|
|
||||||
grid.add(checkedItemsLabel, 1, row++);
|
|
||||||
updateText(checkedItemsLabel, null);
|
|
||||||
|
|
||||||
Label checkItem2Label = new Label("Check 'Item 2': ");
|
|
||||||
checkItem2Label.getStyleClass().add("property");
|
|
||||||
grid.add(checkItem2Label, 0, row);
|
|
||||||
final CheckBox checkItem2Btn = new CheckBox();
|
|
||||||
checkItem2Btn.setOnAction(e -> {
|
|
||||||
IndexedCheckModel<String> cm = checkComboBox.getCheckModel();
|
|
||||||
if (cm != null) {
|
|
||||||
cm.toggleCheckState(2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
grid.add(checkItem2Btn, 1, row);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateText(Label label, ObservableList<? extends String> list) {
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
if (list != null) {
|
|
||||||
for (int i = 0, max = list.size(); i < max; i++) {
|
|
||||||
sb.append(list.get(i));
|
|
||||||
if (i < max - 1) {
|
|
||||||
sb.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final String str = sb.toString();
|
|
||||||
label.setText(str.isEmpty() ? "<empty>" : str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class Person {
|
|
||||||
private StringProperty firstName = new SimpleStringProperty();
|
|
||||||
private StringProperty lastName = new SimpleStringProperty();
|
|
||||||
private ReadOnlyStringWrapper fullName = new ReadOnlyStringWrapper();
|
|
||||||
|
|
||||||
public Person(String firstName, String lastName) {
|
|
||||||
this.firstName.set(firstName);
|
|
||||||
this.lastName.set(lastName);
|
|
||||||
fullName.bind(Bindings.concat(firstName, " ", lastName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final ObservableList<Person> createDemoList() {
|
|
||||||
final ObservableList<Person> result = FXCollections.observableArrayList();
|
|
||||||
result.add(new Person("Paul", "McCartney"));
|
|
||||||
result.add(new Person("Andrew Lloyd", "Webber"));
|
|
||||||
result.add(new Person("Herb", "Alpert"));
|
|
||||||
result.add(new Person("Emilio", "Estefan"));
|
|
||||||
result.add(new Person("Bernie", "Taupin"));
|
|
||||||
result.add(new Person("Elton", "John"));
|
|
||||||
result.add(new Person("Mick", "Jagger"));
|
|
||||||
result.add(new Person("Keith", "Richerds"));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final StringProperty firstNameProperty() {
|
|
||||||
return this.firstName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final java.lang.String getFirstName() {
|
|
||||||
return this.firstNameProperty().get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void setFirstName(final String firstName) {
|
|
||||||
this.firstNameProperty().set(firstName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final StringProperty lastNameProperty() {
|
|
||||||
return this.lastName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final String getLastName() {
|
|
||||||
return this.lastNameProperty().get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void setLastName(final String lastName) {
|
|
||||||
this.lastNameProperty().set(lastName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final ReadOnlyStringProperty fullNameProperty() {
|
|
||||||
return this.fullName.getReadOnlyProperty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final String getFullName() {
|
|
||||||
return this.fullNameProperty().get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,742 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013, 2015 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples.dialogs;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javafx.application.Application;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import javafx.scene.control.Alert.AlertType;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.ButtonBar.ButtonData;
|
|
||||||
import javafx.scene.control.ButtonType;
|
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.ChoiceDialog;
|
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Dialog;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.control.TextInputDialog;
|
|
||||||
import javafx.scene.image.Image;
|
|
||||||
import javafx.scene.image.ImageView;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.HBox;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.scene.text.Font;
|
|
||||||
import javafx.stage.Modality;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.stage.StageStyle;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.dialog.CommandLinksDialog;
|
|
||||||
import org.controlsfx.dialog.CommandLinksDialog.CommandLinksButtonType;
|
|
||||||
import org.controlsfx.dialog.WizardPane;
|
|
||||||
import org.controlsfx.dialog.ExceptionDialog;
|
|
||||||
import org.controlsfx.dialog.FontSelectorDialog;
|
|
||||||
import org.controlsfx.dialog.LoginDialog;
|
|
||||||
import org.controlsfx.dialog.ProgressDialog;
|
|
||||||
import org.controlsfx.dialog.Wizard;
|
|
||||||
import org.controlsfx.dialog.Wizard.LinearFlow;
|
|
||||||
import org.controlsfx.validation.ValidationSupport;
|
|
||||||
import org.controlsfx.validation.Validator;
|
|
||||||
|
|
||||||
public class HelloDialogs extends ControlsFXSample {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleName() {
|
|
||||||
return "Dialogs";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaDocURL() {
|
|
||||||
// return Utils.JAVADOC_BASE + "org/controlsfx/dialog/Dialogs.html";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleDescription() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ComboBox<StageStyle> styleCombobox = new ComboBox<>();
|
|
||||||
private final ComboBox<Modality> modalityCombobox = new ComboBox<>();
|
|
||||||
private final CheckBox cbUseBlocking = new CheckBox();
|
|
||||||
private final CheckBox cbCloseDialogAutomatically = new CheckBox();
|
|
||||||
private final CheckBox cbShowMasthead = new CheckBox();
|
|
||||||
private final CheckBox cbSetOwner = new CheckBox();
|
|
||||||
private final CheckBox cbCustomGraphic = new CheckBox();
|
|
||||||
|
|
||||||
private Stage stage;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getPanel(Stage stage) {
|
|
||||||
this.stage = stage;
|
|
||||||
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setPadding(new Insets(10, 10, 10, 10));
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setVgap(10);
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
Label javafxDialogs = new Label("JavaFX Dialogs:");
|
|
||||||
javafxDialogs.setFont(Font.font(25));
|
|
||||||
grid.add(javafxDialogs, 0, row++, 2, 1);
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Information Dialog
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Information Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final Button Hyperlink2 = new Button("Show");
|
|
||||||
Hyperlink2.setOnAction( (ActionEvent e) -> {
|
|
||||||
|
|
||||||
Alert dlg = createAlert(AlertType.INFORMATION);
|
|
||||||
dlg.setTitle("Custom title");
|
|
||||||
String optionalMasthead = "Wouldn't this be nice?";
|
|
||||||
dlg.getDialogPane().setContentText("A collection of pre-built JavaFX dialogs?\nSeems like a great idea to me...");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
|
|
||||||
// lets get some output when events happen
|
|
||||||
dlg.setOnShowing(evt -> System.out.println(evt));
|
|
||||||
dlg.setOnShown(evt -> System.out.println(evt));
|
|
||||||
dlg.setOnHiding(evt -> System.out.println(evt));
|
|
||||||
dlg.setOnHidden(evt -> System.out.println(evt));
|
|
||||||
|
|
||||||
// dlg.setOnCloseRequest(evt -> evt.consume());
|
|
||||||
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink2a = new Button("2 x Buttons (no cancel)");
|
|
||||||
Hyperlink2a.setOnAction( (ActionEvent e) -> {
|
|
||||||
Alert dlg = createAlert(AlertType.INFORMATION);
|
|
||||||
dlg.setTitle("Custom title");
|
|
||||||
String optionalMasthead = "Wouldn't this be nice?";
|
|
||||||
dlg.getDialogPane().setContentText("A collection of pre-built JavaFX dialogs?\nSeems like a great idea to me...");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
dlg.getButtonTypes().add(ButtonType.NEXT);
|
|
||||||
|
|
||||||
// dlg.setOnCloseRequest(evt -> evt.consume());
|
|
||||||
|
|
||||||
showDialog(dlg);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
grid.add(new HBox(10, Hyperlink2, Hyperlink2a), 1, row);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Confirmation Dialog
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Confirmation Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final CheckBox cbShowCancel = new CheckBox("Show Cancel Button");
|
|
||||||
cbShowCancel.setSelected(true);
|
|
||||||
|
|
||||||
final Button Hyperlink3 = new Button("Show");
|
|
||||||
Hyperlink3.setOnAction(e -> {
|
|
||||||
Alert dlg = createAlert(AlertType.CONFIRMATION);
|
|
||||||
dlg.setTitle("You do want dialogs right?");
|
|
||||||
String optionalMasthead = "Just Checkin'";
|
|
||||||
dlg.getDialogPane().setContentText("I was a bit worried that you might not want them, so I wanted to double check.");
|
|
||||||
|
|
||||||
if (!cbShowCancel.isSelected()) {
|
|
||||||
dlg.getDialogPane().getButtonTypes().remove(ButtonType.CANCEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
grid.add(new HBox(10, Hyperlink3, cbShowCancel), 1, row);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Warning Dialog
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Warning Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final Button Hyperlink6a = new Button("Show");
|
|
||||||
Hyperlink6a.setOnAction(e -> {
|
|
||||||
Alert dlg = createAlert(AlertType.WARNING);
|
|
||||||
dlg.setTitle("I'm warning you!");
|
|
||||||
String optionalMasthead = "This is a warning";
|
|
||||||
dlg.getDialogPane().setContentText("I'm glad I didn't need to use this...");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
grid.add(new HBox(10, Hyperlink6a), 1, row);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Error Dialog
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Error Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final Button Hyperlink7a = new Button("Show");
|
|
||||||
Hyperlink7a.setOnAction(e -> {
|
|
||||||
Alert dlg = createAlert(AlertType.ERROR);
|
|
||||||
dlg.setTitle("It looks like you're making a bad decision");
|
|
||||||
String optionalMasthead = "Exception Encountered";
|
|
||||||
dlg.getDialogPane().setContentText("Better change your mind - this is really your last chance! (Even longer text that should probably wrap)");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
grid.add(new HBox(10, Hyperlink7a), 1, row);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Input Dialog (with header)
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Input Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final Button Hyperlink8 = new Button("TextField");
|
|
||||||
Hyperlink8.setOnAction(e -> {
|
|
||||||
TextInputDialog dlg = new TextInputDialog("");
|
|
||||||
dlg.setTitle("Name Check");
|
|
||||||
String optionalMasthead = "Please type in your name";
|
|
||||||
dlg.getDialogPane().setContentText("What is your name?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink9 = new Button("Initial Value Set");
|
|
||||||
Hyperlink9.setOnAction(e -> {
|
|
||||||
TextInputDialog dlg = new TextInputDialog("Jonathan");
|
|
||||||
dlg.setTitle("Name Guess");
|
|
||||||
String optionalMasthead = "Name Guess";
|
|
||||||
dlg.getDialogPane().setContentText("Pick a name?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink10 = new Button("Set Choices (< 10)");
|
|
||||||
Hyperlink10.setOnAction(e -> {
|
|
||||||
ChoiceDialog<String> dlg = new ChoiceDialog<>("Jonathan",
|
|
||||||
"Matthew", "Jonathan", "Ian", "Sue", "Hannah");
|
|
||||||
dlg.setTitle("Name Guess");
|
|
||||||
String optionalMasthead = "Name Guess";
|
|
||||||
dlg.getDialogPane().setContentText("Pick a name?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink11 = new Button("Set Choices (>= 10)");
|
|
||||||
Hyperlink11.setOnAction(e -> {
|
|
||||||
ChoiceDialog<String> dlg = new ChoiceDialog<>("Jonathan",
|
|
||||||
"Matthew", "Jonathan", "Ian", "Sue",
|
|
||||||
"Hannah", "Julia", "Denise", "Stephan",
|
|
||||||
"Sarah", "Ron", "Ingrid");
|
|
||||||
dlg.setTitle("Name Guess");
|
|
||||||
String optionalMasthead = "Name Guess";
|
|
||||||
dlg.getDialogPane().setContentText("Pick a name?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
grid.add(new HBox(10, Hyperlink8, Hyperlink9, Hyperlink10, Hyperlink11), 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------- ControlsFX-specific Dialogs
|
|
||||||
|
|
||||||
Label controlsfxDialogs = new Label("ControlsFX Dialogs:");
|
|
||||||
controlsfxDialogs.setFont(Font.font(25));
|
|
||||||
grid.add(controlsfxDialogs, 0, row++, 2, 1);
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Command links
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Pre-built dialogs: "), 0, row);
|
|
||||||
final Button Hyperlink12 = new Button("Command Links");
|
|
||||||
Hyperlink12.setOnAction(e -> {
|
|
||||||
List<CommandLinksButtonType> links = Arrays
|
|
||||||
.asList(new CommandLinksButtonType(
|
|
||||||
"Add a network that is in the range of this computer",
|
|
||||||
"This shows you a list of networks that are currently available and lets you connect to one.", false),
|
|
||||||
new CommandLinksButtonType(
|
|
||||||
"Manually create a network profile",
|
|
||||||
"This creates a new network profile or locates an existing one and saves it on your computer",
|
|
||||||
true /*default*/),
|
|
||||||
new CommandLinksButtonType("Create an ad hoc network",
|
|
||||||
"This creates a temporary network for sharing files or and Internet connection", false));
|
|
||||||
|
|
||||||
CommandLinksDialog dlg = new CommandLinksDialog(links);
|
|
||||||
dlg.setTitle("Manually connect to wireless network");
|
|
||||||
String optionalMasthead = "Manually connect to wireless network";
|
|
||||||
dlg.getDialogPane().setContentText("How do you want to add a network?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink12a = new Button("Font Selector");
|
|
||||||
Hyperlink12a.setOnAction(e -> {
|
|
||||||
FontSelectorDialog dlg = new FontSelectorDialog(null);
|
|
||||||
configureSampleDialog(dlg, "Please select a font!");
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink12b = new Button("Progress");
|
|
||||||
Hyperlink12b.setOnAction((ActionEvent e) -> {
|
|
||||||
Task<Object> worker = new Task<Object>() {
|
|
||||||
@Override
|
|
||||||
protected Object call() throws Exception {
|
|
||||||
for (int i = 0; i <= 100; i++) {
|
|
||||||
updateProgress(i, 99);
|
|
||||||
updateMessage("progress: " + i);
|
|
||||||
System.out.println("progress: " + i);
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ProgressDialog dlg = new ProgressDialog(worker);
|
|
||||||
configureSampleDialog(dlg, "");
|
|
||||||
|
|
||||||
Thread th = new Thread(worker);
|
|
||||||
th.setDaemon(true);
|
|
||||||
th.start();
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink12c = new Button("Login");
|
|
||||||
Hyperlink12c.setOnAction((ActionEvent e) -> {
|
|
||||||
LoginDialog dlg = new LoginDialog(null, null);
|
|
||||||
configureSampleDialog(dlg, "");
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink12d = new Button("Exception");
|
|
||||||
Hyperlink12d.setOnAction((ActionEvent e) -> {
|
|
||||||
ExceptionDialog dlg = new ExceptionDialog(new Exception("ControlsFX is _too_ awesome!"));
|
|
||||||
configureSampleDialog(dlg, "");
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
grid.add(new HBox(10, Hyperlink12, Hyperlink12a, Hyperlink12b, Hyperlink12c, Hyperlink12d), 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// wizards
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Wizard: "), 0, row);
|
|
||||||
final Button Hyperlink15a = new Button("Linear Wizard");
|
|
||||||
Hyperlink15a.setOnAction(e -> showLinearWizard());
|
|
||||||
|
|
||||||
final Button Hyperlink15b = new Button("Branching Wizard");
|
|
||||||
Hyperlink15b.setOnAction(e -> showBranchingWizard());
|
|
||||||
|
|
||||||
final Button Hyperlink15c = new Button("Validated Linear Wizard");
|
|
||||||
Hyperlink15c.setOnAction(e -> showValidatedLinearWizard());
|
|
||||||
|
|
||||||
grid.add(new HBox(10, Hyperlink15a, Hyperlink15b, Hyperlink15c), 1, row++);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Alert createAlert(AlertType type) {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
Alert dlg = new Alert(type, "");
|
|
||||||
dlg.initModality(modalityCombobox.getValue());
|
|
||||||
dlg.initOwner(owner);
|
|
||||||
return dlg;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void configureSampleDialog(Dialog<?> dlg, String header) {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
if (header != null && cbShowMasthead.isSelected()) {
|
|
||||||
dlg.getDialogPane().setHeaderText(header);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cbCustomGraphic.isSelected()) {
|
|
||||||
dlg.getDialogPane().setGraphic(new ImageView(new Image(getClass().getResource("/org/controlsfx/samples/controlsfx-logo.png").toExternalForm())));
|
|
||||||
}
|
|
||||||
|
|
||||||
dlg.initStyle(styleCombobox.getValue());
|
|
||||||
dlg.initOwner(owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showDialog(Dialog<?> dlg) {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
if (cbCloseDialogAutomatically.isSelected()) {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
System.out.println("Attempting to close dialog now...");
|
|
||||||
Platform.runLater(() -> dlg.close());
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
dlg.initOwner(owner);
|
|
||||||
|
|
||||||
if (cbUseBlocking.isSelected()) {
|
|
||||||
dlg.showAndWait().ifPresent(result -> System.out.println("Result is " + result));
|
|
||||||
} else {
|
|
||||||
dlg.show();
|
|
||||||
dlg.resultProperty().addListener(o -> System.out.println("Result is: " + dlg.getResult()));
|
|
||||||
System.out.println("This println is _after_ the show method - we're non-blocking!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// stage style
|
|
||||||
grid.add(createLabel("Style: ", "property"), 0, row);
|
|
||||||
styleCombobox.getItems().setAll(StageStyle.values());
|
|
||||||
styleCombobox.setValue(styleCombobox.getItems().get(0));
|
|
||||||
grid.add(styleCombobox, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// modality
|
|
||||||
grid.add(createLabel("Modality: ", "property"), 0, row);
|
|
||||||
modalityCombobox.getItems().setAll(Modality.values());
|
|
||||||
modalityCombobox.setValue(modalityCombobox.getItems().get(Modality.values().length-1));
|
|
||||||
grid.add(modalityCombobox, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// use blocking
|
|
||||||
cbUseBlocking.setSelected(true);
|
|
||||||
grid.add(createLabel("Use blocking: ", "property"), 0, row);
|
|
||||||
grid.add(cbUseBlocking, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// close dialog automatically
|
|
||||||
grid.add(createLabel("Close dialog after 2000ms: ", "property"), 0, row);
|
|
||||||
grid.add(cbCloseDialogAutomatically, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// show header
|
|
||||||
grid.add(createLabel("Show custom header text: ", "property"), 0, row);
|
|
||||||
grid.add(cbShowMasthead, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// set owner
|
|
||||||
grid.add(createLabel("Set dialog owner: ", "property"), 0, row);
|
|
||||||
grid.add(cbSetOwner, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// custom graphic
|
|
||||||
grid.add(createLabel("Use custom graphic: ", "property"), 0, row);
|
|
||||||
grid.add(cbCustomGraphic, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
// private CommandLinksButtonType buildCommandLink( String text, String comment, boolean isDefault ) {
|
|
||||||
// return new CommandLinksButtonType(text, comment, isDefault);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Application.launch(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Node createLabel(String text, String... styleclass) {
|
|
||||||
Label label = new Label(text);
|
|
||||||
|
|
||||||
if (styleclass == null || styleclass.length == 0) {
|
|
||||||
label.setFont(Font.font(13));
|
|
||||||
} else {
|
|
||||||
label.getStyleClass().addAll(styleclass);
|
|
||||||
}
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showLinearWizard() {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
// define pages to show
|
|
||||||
Wizard wizard = new Wizard(owner);
|
|
||||||
wizard.setTitle("Linear Wizard");
|
|
||||||
|
|
||||||
// --- page 1
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
GridPane page1Grid = new GridPane();
|
|
||||||
page1Grid.setVgap(10);
|
|
||||||
page1Grid.setHgap(10);
|
|
||||||
|
|
||||||
page1Grid.add(new Label("First Name:"), 0, row);
|
|
||||||
TextField txFirstName = createTextField("firstName");
|
|
||||||
// wizard.getValidationSupport().registerValidator(txFirstName, Validator.createEmptyValidator("First Name is mandatory"));
|
|
||||||
page1Grid.add(txFirstName, 1, row++);
|
|
||||||
|
|
||||||
page1Grid.add(new Label("Last Name:"), 0, row);
|
|
||||||
TextField txLastName = createTextField("lastName");
|
|
||||||
// wizard.getValidationSupport().registerValidator(txLastName, Validator.createEmptyValidator("Last Name is mandatory"));
|
|
||||||
page1Grid.add(txLastName, 1, row);
|
|
||||||
|
|
||||||
WizardPane page1 = new WizardPane();
|
|
||||||
page1.setHeaderText("Please Enter Your Details");
|
|
||||||
page1.setContent(page1Grid);
|
|
||||||
|
|
||||||
|
|
||||||
// --- page 2
|
|
||||||
final WizardPane page2 = new WizardPane() {
|
|
||||||
@Override public void onEnteringPage(Wizard wizard) {
|
|
||||||
String firstName = (String) wizard.getSettings().get("firstName");
|
|
||||||
String lastName = (String) wizard.getSettings().get("lastName");
|
|
||||||
|
|
||||||
setContentText("Welcome, " + firstName + " " + lastName + "! Let's add some newlines!\n\n\n\n\n\n\nHello World!");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
page2.setHeaderText("Thanks For Your Details!");
|
|
||||||
|
|
||||||
|
|
||||||
// --- page 3
|
|
||||||
WizardPane page3 = new WizardPane();
|
|
||||||
page3.setHeaderText("Goodbye!");
|
|
||||||
page3.setContentText("Page 3, with extra 'help' button!");
|
|
||||||
|
|
||||||
ButtonType helpDialogButton = new ButtonType("Help", ButtonData.HELP_2);
|
|
||||||
page3.getButtonTypes().add(helpDialogButton);
|
|
||||||
Button helpButton = (Button) page3.lookupButton(helpDialogButton);
|
|
||||||
helpButton.addEventFilter(ActionEvent.ACTION, actionEvent -> {
|
|
||||||
actionEvent.consume(); // stop hello.dialog from closing
|
|
||||||
System.out.println("Help clicked!");
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create wizard
|
|
||||||
wizard.setFlow(new LinearFlow(page1, page2, page3));
|
|
||||||
|
|
||||||
System.out.println("page1: " + page1);
|
|
||||||
System.out.println("page2: " + page2);
|
|
||||||
System.out.println("page3: " + page3);
|
|
||||||
|
|
||||||
// show wizard and wait for response
|
|
||||||
wizard.showAndWait().ifPresent(result -> {
|
|
||||||
if (result == ButtonType.FINISH) {
|
|
||||||
System.out.println("Wizard finished, settings: " + wizard.getSettings());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showBranchingWizard() {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
// define pages to show.
|
|
||||||
// Because page1 references page2, we need to declare page2 first.
|
|
||||||
final WizardPane page2 = new WizardPane();
|
|
||||||
page2.setContentText("Page 2");
|
|
||||||
|
|
||||||
final CheckBox checkBox = new CheckBox("Skip the second page");
|
|
||||||
checkBox.setId("skip-page-2");
|
|
||||||
VBox vbox = new VBox(10, new Label("Page 1"), checkBox);
|
|
||||||
final WizardPane page1 = new WizardPane() {
|
|
||||||
// when we exit page 1, we will check the state of the 'skip page 2'
|
|
||||||
// checkbox, and if it is true, we will remove page 2 from the pages list
|
|
||||||
@Override public void onExitingPage(Wizard wizard) {
|
|
||||||
// List<WizardPage> pages = wizard.getPages();
|
|
||||||
// if (checkBox.isSelected()) {
|
|
||||||
// pages.remove(page2);
|
|
||||||
// } else {
|
|
||||||
// if (! pages.contains(page2)) {
|
|
||||||
// pages.add(1, page2);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
page1.setContent(vbox);
|
|
||||||
|
|
||||||
final WizardPane page3 = new WizardPane();
|
|
||||||
page3.setContentText("Page 3");
|
|
||||||
|
|
||||||
// create wizard
|
|
||||||
Wizard wizard = new Wizard(owner);
|
|
||||||
wizard.setTitle("Branching Wizard");
|
|
||||||
Wizard.Flow branchingFlow = new Wizard.Flow() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<WizardPane> advance(WizardPane currentPage) {
|
|
||||||
return Optional.of(getNext(currentPage));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAdvance(WizardPane currentPage) {
|
|
||||||
return currentPage != page3;
|
|
||||||
}
|
|
||||||
|
|
||||||
private WizardPane getNext(WizardPane currentPage) {
|
|
||||||
if ( currentPage == null ) {
|
|
||||||
return page1;
|
|
||||||
} else if ( currentPage == page1) {
|
|
||||||
return checkBox.isSelected()? page3: page2;
|
|
||||||
} else {
|
|
||||||
return page3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//wizard.setFlow( new LinearWizardFlow( page1, page2, page3));
|
|
||||||
wizard.setFlow( branchingFlow);
|
|
||||||
|
|
||||||
// show wizard
|
|
||||||
wizard.showAndWait().ifPresent(result -> {
|
|
||||||
if (result == ButtonType.FINISH) {
|
|
||||||
System.out.println("Wizard finished, settings: " + wizard.getSettings());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showValidatedLinearWizard() {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
Wizard wizard = new Wizard(owner);
|
|
||||||
wizard.setTitle("Validated Linear Wizard");
|
|
||||||
|
|
||||||
// Page 1
|
|
||||||
WizardPane page1 = new WizardPane() {
|
|
||||||
ValidationSupport vs = new ValidationSupport();
|
|
||||||
{
|
|
||||||
vs.initInitialDecoration();
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
GridPane page1Grid = new GridPane();
|
|
||||||
page1Grid.setVgap(10);
|
|
||||||
page1Grid.setHgap(10);
|
|
||||||
|
|
||||||
page1Grid.add(new Label("Username:"), 0, row);
|
|
||||||
TextField txUsername = createTextField("username");
|
|
||||||
vs.registerValidator(txUsername, Validator.createEmptyValidator("EMPTY!"));
|
|
||||||
page1Grid.add(txUsername, 1, row++);
|
|
||||||
|
|
||||||
page1Grid.add(new Label("Full Name:"), 0, row);
|
|
||||||
TextField txFullName = createTextField("fullName");
|
|
||||||
page1Grid.add(txFullName, 1, row);
|
|
||||||
|
|
||||||
setContent(page1Grid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnteringPage(Wizard wizard) {
|
|
||||||
wizard.invalidProperty().unbind();
|
|
||||||
wizard.invalidProperty().bind(vs.invalidProperty());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Page 2
|
|
||||||
|
|
||||||
WizardPane page2 = new WizardPane() {
|
|
||||||
ValidationSupport vs = new ValidationSupport();
|
|
||||||
{
|
|
||||||
vs.initInitialDecoration();
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
GridPane page2Grid = new GridPane();
|
|
||||||
page2Grid.setVgap(10);
|
|
||||||
page2Grid.setHgap(10);
|
|
||||||
|
|
||||||
page2Grid.add(new Label("ControlsFX is:"), 0, row);
|
|
||||||
ComboBox<String> cbControlsFX = createComboBox("controlsfx");
|
|
||||||
cbControlsFX.setItems(FXCollections.observableArrayList("Cool", "Great"));
|
|
||||||
vs.registerValidator(cbControlsFX, Validator.createEmptyValidator("EMPTY!"));
|
|
||||||
page2Grid.add(cbControlsFX, 1, row++);
|
|
||||||
|
|
||||||
page2Grid.add(new Label("Where have you heard of it?:"), 0, row);
|
|
||||||
TextField txWhere = createTextField("where");
|
|
||||||
vs.registerValidator(txWhere, Validator.createEmptyValidator("EMPTY!"));
|
|
||||||
page2Grid.add(txWhere, 1, row++);
|
|
||||||
|
|
||||||
page2Grid.add(new Label("Free text:"), 0, row);
|
|
||||||
TextField txFreeText = createTextField("freetext");
|
|
||||||
page2Grid.add(txFreeText, 1, row);
|
|
||||||
|
|
||||||
setContent(page2Grid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnteringPage(Wizard wizard) {
|
|
||||||
wizard.invalidProperty().unbind();
|
|
||||||
wizard.invalidProperty().bind(vs.invalidProperty());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create wizard
|
|
||||||
wizard.setFlow(new LinearFlow(page1, page2));
|
|
||||||
|
|
||||||
// show wizard and wait for response
|
|
||||||
wizard.showAndWait().ifPresent(result -> {
|
|
||||||
if (result == ButtonType.FINISH) {
|
|
||||||
System.out.println("Wizard finished, settings: " + wizard.getSettings());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextField createTextField(String id) {
|
|
||||||
TextField textField = new TextField();
|
|
||||||
textField.setId(id);
|
|
||||||
GridPane.setHgrow(textField, Priority.ALWAYS);
|
|
||||||
return textField;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ComboBox<String> createComboBox(String id) {
|
|
||||||
ComboBox<String> comboBox = new ComboBox<>();
|
|
||||||
comboBox.setId(id);
|
|
||||||
GridPane.setHgrow(comboBox, Priority.ALWAYS);
|
|
||||||
return comboBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,170 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013, 2014 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples;
|
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.ContentDisplay;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.ScrollPane;
|
|
||||||
import javafx.scene.control.Tab;
|
|
||||||
import javafx.scene.control.TabPane;
|
|
||||||
import javafx.scene.control.ToolBar;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.scene.paint.Color;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.GridCell;
|
|
||||||
import org.controlsfx.control.GridView;
|
|
||||||
import org.controlsfx.glyphfont.FontAwesome;
|
|
||||||
import org.controlsfx.glyphfont.Glyph;
|
|
||||||
import org.controlsfx.glyphfont.GlyphFont;
|
|
||||||
import org.controlsfx.glyphfont.GlyphFontRegistry;
|
|
||||||
|
|
||||||
public class HelloGlyphFont extends ControlsFXSample {
|
|
||||||
|
|
||||||
static {
|
|
||||||
// Register a custom default font
|
|
||||||
GlyphFontRegistry.register("icomoon", HelloGlyphFont.class.getResourceAsStream("icomoon.ttf") , 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private GlyphFont fontAwesome = GlyphFontRegistry.font("FontAwesome");
|
|
||||||
private GlyphFont icoMoon = GlyphFontRegistry.font("icomoon");
|
|
||||||
|
|
||||||
// private static char FAW_TRASH = '\uf014';
|
|
||||||
private static char FAW_GEAR = '\uf013';
|
|
||||||
// private static char FAW_STAR = '\uf005';
|
|
||||||
|
|
||||||
private static char IM_BOLD = '\ue027';
|
|
||||||
private static char IM_UNDERSCORED = '\ue02b';
|
|
||||||
private static char IM_ITALIC = '\ue13e';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleName() {
|
|
||||||
return "Glyph Font";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE + "org/controlsfx/glyphfont/GlyphFont.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getPanel(final Stage stage) {
|
|
||||||
|
|
||||||
VBox root = new VBox(10);
|
|
||||||
|
|
||||||
root.setPadding(new Insets(10, 10, 10, 10));
|
|
||||||
root.setMaxHeight(Double.MAX_VALUE);
|
|
||||||
Label title = new Label("Using FontAwesome(CDN)");
|
|
||||||
root.getChildren().add(title);
|
|
||||||
ToolBar toolbar = new ToolBar(
|
|
||||||
|
|
||||||
// There are many ways how you can define a Glyph:
|
|
||||||
|
|
||||||
new Button("", new Glyph("FontAwesome", "TRASH_ALT")), // Use the Glyph-class with a icon name
|
|
||||||
new Button("", new Glyph("FontAwesome", FontAwesome.Glyph.STAR)), // Use the Glyph-class with a known enum value
|
|
||||||
new Button("", Glyph.create("FontAwesome|BUG")), // Use the static Glyph-class create protocol
|
|
||||||
new Button("", fontAwesome.create("REBEL")), // Use the font-instance with a name
|
|
||||||
new Button("", fontAwesome.create(FontAwesome.Glyph.SMILE_ALT)), // Use the font-instance with a enum
|
|
||||||
new Button("", fontAwesome.create(FAW_GEAR).color(Color.RED)) // Use the font-instance with a unicode char
|
|
||||||
);
|
|
||||||
root.getChildren().add(toolbar);
|
|
||||||
title = new Label("Using IcoMoon (Local)");
|
|
||||||
root.getChildren().add(title);
|
|
||||||
|
|
||||||
Glyph effectGlyph = icoMoon.create(IM_UNDERSCORED)
|
|
||||||
.color(Color.BLUE)
|
|
||||||
.size(48)
|
|
||||||
.useHoverEffect();
|
|
||||||
|
|
||||||
Glyph effectGlyph2 = icoMoon.create(IM_UNDERSCORED)
|
|
||||||
.color(Color.BLUE)
|
|
||||||
.size(48)
|
|
||||||
.useGradientEffect().useHoverEffect();
|
|
||||||
|
|
||||||
toolbar = new ToolBar(
|
|
||||||
|
|
||||||
// Since we have a custom font without named characters,
|
|
||||||
// we have to use unicode character codes for the icons:
|
|
||||||
|
|
||||||
new Button("", icoMoon.create(IM_BOLD).size(16)),
|
|
||||||
new Button("", icoMoon.create(IM_UNDERSCORED).color(Color.GREEN).size(32)),
|
|
||||||
new Button("", icoMoon.create(IM_ITALIC).size(48)),
|
|
||||||
new Button("", effectGlyph),
|
|
||||||
new Button("", effectGlyph2));
|
|
||||||
root.getChildren().add(toolbar);
|
|
||||||
|
|
||||||
GridPane fontDemo = new GridPane();
|
|
||||||
fontDemo.setHgap(5);
|
|
||||||
fontDemo.setVgap(5);
|
|
||||||
int maxColumns = 10;
|
|
||||||
int col = 0;
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
for ( FontAwesome.Glyph glyph: FontAwesome.Glyph.values() ){
|
|
||||||
Color randomColor = new Color( Math.random(), Math.random(), Math.random(), 1);
|
|
||||||
Glyph graphic = Glyph.create( "FontAwesome|" + glyph.name()).sizeFactor(2).color(randomColor).useGradientEffect();
|
|
||||||
Button button = new Button(glyph.name(), graphic);
|
|
||||||
button.setContentDisplay(ContentDisplay.TOP);
|
|
||||||
button.setMaxWidth(Double.MAX_VALUE);
|
|
||||||
col = col % maxColumns + 1;
|
|
||||||
if ( col == 1 ) row++;
|
|
||||||
fontDemo.add( button, col, row);
|
|
||||||
GridPane.setFillHeight(button, true);
|
|
||||||
GridPane.setFillWidth(button, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollPane scroller = new ScrollPane(fontDemo);
|
|
||||||
scroller.setFitToWidth(true);
|
|
||||||
|
|
||||||
TabPane tabs = new TabPane();
|
|
||||||
Tab tab = new Tab("FontAwesome Glyph Demo");
|
|
||||||
tab.setContent(scroller);
|
|
||||||
tabs.getTabs().add(tab);
|
|
||||||
|
|
||||||
|
|
||||||
root.getChildren().add(tabs);
|
|
||||||
VBox.setVgrow(tabs, Priority.ALWAYS);
|
|
||||||
|
|
||||||
return root;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,124 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014, ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples;
|
|
||||||
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.geometry.Side;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.input.MouseEvent;
|
|
||||||
import javafx.scene.layout.StackPane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.HiddenSidesPane;
|
|
||||||
|
|
||||||
public class HelloHiddenSidesPane extends ControlsFXSample {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleName() {
|
|
||||||
return "Hidden Sides Pane";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE
|
|
||||||
+ "org/controlsfx/control/HiddenSidesPane.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleDescription() {
|
|
||||||
return "Hidden nodes will appear when moving the mouse cursor close to the edge of the content node. "
|
|
||||||
+ "They disappear again when the mouse cursor exits them. In this example a hidden node "
|
|
||||||
+ "can be pinned (and unpinned) by clicking on it so that it stays visible all the time.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getPanel(Stage stage) {
|
|
||||||
StackPane stackPane = new StackPane();
|
|
||||||
stackPane.setStyle("-fx-padding: 30");
|
|
||||||
|
|
||||||
HiddenSidesPane pane = new HiddenSidesPane();
|
|
||||||
|
|
||||||
Label content = new Label("Content Node");
|
|
||||||
content.setStyle("-fx-background-color: white; -fx-border-color: black;");
|
|
||||||
content.setAlignment(Pos.CENTER);
|
|
||||||
content.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
|
||||||
|
|
||||||
pane.setContent(content);
|
|
||||||
|
|
||||||
SideNode top = new SideNode("Top", Side.TOP, pane);
|
|
||||||
top.setStyle("-fx-background-color: rgba(0,255,0,.25);");
|
|
||||||
pane.setTop(top);
|
|
||||||
|
|
||||||
SideNode right = new SideNode("Right", Side.RIGHT, pane);
|
|
||||||
right.setStyle("-fx-background-color: rgba(0,0, 255,.25);");
|
|
||||||
pane.setRight(right);
|
|
||||||
|
|
||||||
SideNode bottom = new SideNode("Bottom", Side.BOTTOM, pane);
|
|
||||||
bottom.setStyle("-fx-background-color: rgba(255,255,0,.25);");
|
|
||||||
pane.setBottom(bottom);
|
|
||||||
|
|
||||||
SideNode left = new SideNode("Left", Side.LEFT, pane);
|
|
||||||
left.setStyle("-fx-background-color: rgba(255,0,0,.25);");
|
|
||||||
pane.setLeft(left);
|
|
||||||
|
|
||||||
stackPane.getChildren().add(pane);
|
|
||||||
|
|
||||||
return stackPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
class SideNode extends Label {
|
|
||||||
|
|
||||||
public SideNode(final String text, final Side side,
|
|
||||||
final HiddenSidesPane pane) {
|
|
||||||
|
|
||||||
super(text + " (Click to pin / unpin)");
|
|
||||||
|
|
||||||
setAlignment(Pos.CENTER);
|
|
||||||
setPrefSize(200, 200);
|
|
||||||
|
|
||||||
setOnMouseClicked(new EventHandler<MouseEvent>() {
|
|
||||||
@Override
|
|
||||||
public void handle(MouseEvent event) {
|
|
||||||
if (pane.getPinnedSide() != null) {
|
|
||||||
setText(text + " (unpinned)");
|
|
||||||
pane.setPinnedSide(null);
|
|
||||||
} else {
|
|
||||||
setText(text + " (pinned)");
|
|
||||||
pane.setPinnedSide(side);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,196 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2018 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples;
|
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.geometry.Side;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.scene.text.Font;
|
|
||||||
import javafx.scene.text.FontPosture;
|
|
||||||
import javafx.scene.text.FontWeight;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.ListActionView;
|
|
||||||
import org.controlsfx.control.action.Action;
|
|
||||||
import org.controlsfx.control.action.ActionUtils;
|
|
||||||
import org.controlsfx.glyphfont.FontAwesome;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HelloListActionView extends ControlsFXSample {
|
|
||||||
|
|
||||||
private ListActionView<String> view;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleName() {
|
|
||||||
return "List Action View";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getPanel(Stage stage) {
|
|
||||||
view = new ListActionView<>();
|
|
||||||
view.getItems().addAll("Dirk", "Jonathan", "Eugene","Abhinay", "Samir");
|
|
||||||
view.getActions().addAll(createActions());
|
|
||||||
|
|
||||||
GridPane pane = new GridPane();
|
|
||||||
pane.add(view, 0, 0);
|
|
||||||
pane.setAlignment(Pos.CENTER);
|
|
||||||
|
|
||||||
return pane;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getControlPanel() {
|
|
||||||
VBox root = new VBox(20);
|
|
||||||
root.setPadding(new Insets(30, 30, 30, 30));
|
|
||||||
|
|
||||||
CheckBox useCellFactory = new CheckBox("Use cell factory");
|
|
||||||
useCellFactory.setOnAction(evt -> {
|
|
||||||
if (useCellFactory.isSelected()) {
|
|
||||||
view.setCellFactory(listView -> {
|
|
||||||
ListCell<String> cell = new ListCell<String>() {
|
|
||||||
@Override
|
|
||||||
public void updateItem(String item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
|
|
||||||
if (empty) {
|
|
||||||
setText(null);
|
|
||||||
setGraphic(null);
|
|
||||||
} else {
|
|
||||||
setText(item == null ? "null" : item);
|
|
||||||
setGraphic(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
cell.setFont(Font.font("Arial", FontWeight.BOLD,
|
|
||||||
FontPosture.ITALIC, 18));
|
|
||||||
return cell;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
view.setCellFactory(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
CheckBox clearActions = new CheckBox("Clear Actions");
|
|
||||||
clearActions.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
if (newValue) {
|
|
||||||
view.getActions().clear();
|
|
||||||
} else {
|
|
||||||
view.getActions().addAll(createActions());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ComboBox<Side> sideComboBox = new ComboBox<>(FXCollections.observableArrayList(Side.values()));
|
|
||||||
sideComboBox.setTooltip(new Tooltip("The side of the ListView on which the actions should be displayed"));
|
|
||||||
|
|
||||||
sideComboBox.getSelectionModel().select(Side.LEFT);
|
|
||||||
view.sideProperty().bind(sideComboBox.getSelectionModel().selectedItemProperty());
|
|
||||||
|
|
||||||
root.getChildren().addAll(useCellFactory, clearActions, sideComboBox);
|
|
||||||
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleDescription() {
|
|
||||||
return "A control used to let the user select multiple values from a "
|
|
||||||
+ "list of available values. Selected values are moved into a "
|
|
||||||
+ "second list that is showing the current selection. Items can "
|
|
||||||
+ "be moved by double clicking on them or by first selecting "
|
|
||||||
+ "them and then pressing one of the buttons in the center.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE
|
|
||||||
+ "org/controlsfx/control/ListActionView.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObservableList<Action> createActions() {
|
|
||||||
ListActionView.ListAction<String> moveUp = new ListActionView.ListAction<String>(
|
|
||||||
new FontAwesome().create(FontAwesome.Glyph.ANGLE_UP)) {
|
|
||||||
@Override
|
|
||||||
public void initialize(ListView<String> listView) {
|
|
||||||
setEventHandler(e -> moveSelectedItemsUp(listView));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ListActionView.ListAction<String> moveDown = new ListActionView.ListAction<String>(new FontAwesome().create(FontAwesome.Glyph.ANGLE_DOWN)) {
|
|
||||||
@Override
|
|
||||||
public void initialize(ListView<String> listView) {
|
|
||||||
setEventHandler(e -> moveSelectedItemsDown(listView));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return FXCollections.observableArrayList(moveUp, ActionUtils.ACTION_SEPARATOR, moveDown);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void moveSelectedItemsUp(ListView<String> listView) {
|
|
||||||
final MultipleSelectionModel<String> selectionModel = listView.getSelectionModel();
|
|
||||||
final ObservableList<Integer> selectedIndices = selectionModel.getSelectedIndices();
|
|
||||||
final ObservableList<String> items = listView.getItems();
|
|
||||||
for (final Integer selectedIndex : selectedIndices) {
|
|
||||||
if (selectedIndex > 0) {
|
|
||||||
if (selectedIndices.contains(selectedIndex - 1)) continue;
|
|
||||||
final String item = items.get(selectedIndex);
|
|
||||||
final String itemToBeReplaced = items.get(selectedIndex - 1);
|
|
||||||
items.set(selectedIndex - 1, item);
|
|
||||||
items.set(selectedIndex, itemToBeReplaced);
|
|
||||||
selectionModel.clearSelection(selectedIndex);
|
|
||||||
selectionModel.select(selectedIndex - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void moveSelectedItemsDown(ListView<String> listView) {
|
|
||||||
final ObservableList<String> items = listView.getItems();
|
|
||||||
final MultipleSelectionModel<String> selectionModel = listView.getSelectionModel();
|
|
||||||
final List<Integer> selectedIndices = selectionModel.getSelectedIndices();
|
|
||||||
int lastIndex = items.size() - 1;
|
|
||||||
// Last selected item is to be replaced first
|
|
||||||
for (int index = selectedIndices.size() - 1; index >= 0; index--) {
|
|
||||||
final Integer selectedIndex = selectedIndices.get(index);
|
|
||||||
if (selectedIndex < lastIndex) {
|
|
||||||
if (selectedIndices.contains(selectedIndex + 1)) continue;
|
|
||||||
final String item = items.get(selectedIndex);
|
|
||||||
final String itemToBeReplaced = items.get(selectedIndex + 1);
|
|
||||||
items.set(selectedIndex + 1, item);
|
|
||||||
items.set(selectedIndex, itemToBeReplaced);
|
|
||||||
selectionModel.clearSelection(selectedIndex);
|
|
||||||
selectionModel.select(selectedIndex + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,156 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014 - 2016 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples;
|
|
||||||
|
|
||||||
import javafx.application.Application;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.geometry.Side;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.MasterDetailPane;
|
|
||||||
|
|
||||||
public class HelloMasterDetailPane extends ControlsFXSample {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE
|
|
||||||
+ "org/controlsfx/control/MasterDetailPane.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getControlStylesheetURL() {
|
|
||||||
return "/org/controlsfx/control/masterdetailpane.css";
|
|
||||||
}
|
|
||||||
|
|
||||||
private MasterDetailPane masterDetailPane;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getPanel(Stage stage) {
|
|
||||||
masterDetailPane = new MasterDetailPane(Side.BOTTOM);
|
|
||||||
masterDetailPane.setShowDetailNode(true);
|
|
||||||
|
|
||||||
return masterDetailPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// show details
|
|
||||||
Label lblShowDetail = new Label("Show details: ");
|
|
||||||
lblShowDetail.getStyleClass().add("property");
|
|
||||||
grid.add(lblShowDetail, 0, row);
|
|
||||||
CheckBox chkShowDetails = new CheckBox();
|
|
||||||
grid.add(chkShowDetails, 1, row++);
|
|
||||||
chkShowDetails.selectedProperty().bindBidirectional(masterDetailPane.showDetailNodeProperty());
|
|
||||||
|
|
||||||
|
|
||||||
// animated
|
|
||||||
Label lblAnimated = new Label("Animated: ");
|
|
||||||
lblAnimated.getStyleClass().add("property");
|
|
||||||
grid.add(lblAnimated, 0, row);
|
|
||||||
CheckBox chkAnimated = new CheckBox();
|
|
||||||
grid.add(chkAnimated, 1, row++);
|
|
||||||
chkAnimated.selectedProperty().bindBidirectional(masterDetailPane.animatedProperty());
|
|
||||||
|
|
||||||
|
|
||||||
// side
|
|
||||||
Label lblSide = new Label("Side: ");
|
|
||||||
lblSide.getStyleClass().add("property");
|
|
||||||
grid.add(lblSide, 0, row);
|
|
||||||
ComboBox<Side> positionBox = new ComboBox<>();
|
|
||||||
positionBox.getItems().addAll(Side.values());
|
|
||||||
grid.add(positionBox, 1, row++);
|
|
||||||
positionBox.setValue(masterDetailPane.getDetailSide());
|
|
||||||
masterDetailPane.detailSideProperty().bind(positionBox.valueProperty());
|
|
||||||
|
|
||||||
// detail node
|
|
||||||
Label lblDetailNode = new Label("Detail Node: ");
|
|
||||||
lblDetailNode.getStyleClass().add("property");
|
|
||||||
grid.add(lblDetailNode, 0, row);
|
|
||||||
ComboBox<DetailType> detailNodeBox = new ComboBox<>();
|
|
||||||
detailNodeBox.getItems().addAll(DetailType.values());
|
|
||||||
grid.add(detailNodeBox, 1, row++);
|
|
||||||
detailNodeBox.valueProperty().addListener(it -> {
|
|
||||||
switch (detailNodeBox.getValue()) {
|
|
||||||
case LABEL:
|
|
||||||
final Label label = new Label("Detail");
|
|
||||||
label.setMaxWidth(Double.MAX_VALUE);
|
|
||||||
label.setAlignment(Pos.CENTER);
|
|
||||||
label.setStyle("-fx-background-color: lightcoral;");
|
|
||||||
masterDetailPane.setDetailNode(label);
|
|
||||||
break;
|
|
||||||
case NONE:
|
|
||||||
masterDetailPane.setDetailNode(null);
|
|
||||||
break;
|
|
||||||
case LIST_VIEW:
|
|
||||||
final ListView<String> listView = new ListView<>();
|
|
||||||
listView.getItems().addAll("Katja", "Dirk", "Philip", "Jule", "Armin");
|
|
||||||
listView.setPrefSize(150,150);
|
|
||||||
masterDetailPane.setDetailNode(listView);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// reset position
|
|
||||||
Button resetButton = new Button("Reset Divider");
|
|
||||||
resetButton.setOnAction(evt -> masterDetailPane.resetDividerPosition());
|
|
||||||
grid.add(resetButton, 1, row++);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum DetailType {
|
|
||||||
NONE,
|
|
||||||
LABEL,
|
|
||||||
LIST_VIEW
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleDescription() {
|
|
||||||
return "A control used to display a master node and a detail node. The detail can be shown / hidden at the top, the bottom, to the left or to the right.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Application.launch(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleName() {
|
|
||||||
return "Master Detail Pane";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,258 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014, 2015 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.Month;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import javafx.beans.value.ObservableValue;
|
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.concurrent.Service;
|
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import javafx.concurrent.WorkerStateEvent;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.PropertySheet;
|
|
||||||
import org.controlsfx.control.PropertySheet.Item;
|
|
||||||
import org.controlsfx.control.PropertySheet.Mode;
|
|
||||||
import org.controlsfx.control.SegmentedButton;
|
|
||||||
import org.controlsfx.control.action.Action;
|
|
||||||
import org.controlsfx.control.action.ActionUtils;
|
|
||||||
import org.controlsfx.property.BeanProperty;
|
|
||||||
import org.controlsfx.property.BeanPropertyUtils;
|
|
||||||
import org.controlsfx.samples.propertysheet.CustomPropertyDescriptor;
|
|
||||||
import org.controlsfx.samples.propertysheet.SampleBean;
|
|
||||||
|
|
||||||
public class HelloPropertySheet extends ControlsFXSample {
|
|
||||||
|
|
||||||
private static Map<String, Object> customDataMap = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
customDataMap.put("1. Name#First Name", "Jonathan");
|
|
||||||
customDataMap.put("1. Name#Last Name", "Giles");
|
|
||||||
customDataMap.put("1. Name#Birthday", LocalDate.of(1985, Month.JANUARY, 12));
|
|
||||||
customDataMap.put("2. Billing Address#Address 1", "");
|
|
||||||
customDataMap.put("2. Billing Address#Address 2", "");
|
|
||||||
customDataMap.put("2. Billing Address#City", "");
|
|
||||||
customDataMap.put("2. Billing Address#State", "");
|
|
||||||
customDataMap.put("2. Billing Address#Zip", "");
|
|
||||||
customDataMap.put("3. Phone#Home", "123-123-1234");
|
|
||||||
customDataMap.put("3. Phone#Mobile", "234-234-2345");
|
|
||||||
customDataMap.put("3. Phone#Work", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
private PropertySheet propertySheet = new PropertySheet();
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleName() {
|
|
||||||
return "Property Sheet";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleDescription() {
|
|
||||||
return "The PropertySheet control is useful when you want to present a number"
|
|
||||||
+ " of properties to a user for them to edit.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE + "org/controlsfx/control/PropertySheet.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getControlStylesheetURL() {
|
|
||||||
return "/org/controlsfx/control/propertysheet.css";
|
|
||||||
}
|
|
||||||
|
|
||||||
class CustomPropertyItem implements Item {
|
|
||||||
|
|
||||||
private String key;
|
|
||||||
private String category, name;
|
|
||||||
|
|
||||||
public CustomPropertyItem(String key) {
|
|
||||||
this.key = key;
|
|
||||||
String[] skey = key.split("#");
|
|
||||||
category = skey[0];
|
|
||||||
name = skey[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?> getType() {
|
|
||||||
return customDataMap.get(key).getClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCategory() {
|
|
||||||
return category;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getValue() {
|
|
||||||
return customDataMap.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValue(Object value) {
|
|
||||||
customDataMap.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<ObservableValue<? extends Object>> getObservableValue() {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class ActionShowInPropertySheet extends Action {
|
|
||||||
|
|
||||||
private Object bean;
|
|
||||||
|
|
||||||
public ActionShowInPropertySheet(String title, Object bean) {
|
|
||||||
super(title);
|
|
||||||
setEventHandler(this::handleAction);
|
|
||||||
this.bean = bean;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObservableList<Item> getCustomModelProperties() {
|
|
||||||
ObservableList<Item> list = FXCollections.observableArrayList();
|
|
||||||
for (String key : customDataMap.keySet()) {
|
|
||||||
list.add(new CustomPropertyItem(key));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleAction(ActionEvent ae) {
|
|
||||||
|
|
||||||
// retrieving bean properties may take some time
|
|
||||||
// so we have to put it on separate thread to keep UI responsive
|
|
||||||
Service<?> service = new Service<ObservableList<Item>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Task<ObservableList<Item>> createTask() {
|
|
||||||
return new Task<ObservableList<Item>>() {
|
|
||||||
@Override
|
|
||||||
protected ObservableList<Item> call() throws Exception {
|
|
||||||
return bean == null ? getCustomModelProperties() : BeanPropertyUtils.getProperties(bean);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
service.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void handle(WorkerStateEvent e) {
|
|
||||||
if (bean instanceof SampleBean) {
|
|
||||||
for (Item i : (ObservableList<Item>) e.getSource().getValue()) {
|
|
||||||
if (i instanceof BeanProperty && ((BeanProperty) i).getPropertyDescriptor() instanceof CustomPropertyDescriptor) {
|
|
||||||
BeanProperty bi = (BeanProperty) i;
|
|
||||||
bi.setEditable(((CustomPropertyDescriptor) bi.getPropertyDescriptor()).isEditable());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
propertySheet.getItems().setAll((ObservableList<Item>) e.getSource().getValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
service.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getPanel(Stage stage) {
|
|
||||||
return propertySheet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getControlPanel() {
|
|
||||||
VBox infoPane = new VBox(10);
|
|
||||||
|
|
||||||
Button button = new Button("Title");
|
|
||||||
TextField textField = new TextField();
|
|
||||||
SampleBean sampleBean = new SampleBean();
|
|
||||||
|
|
||||||
SegmentedButton segmentedButton = ActionUtils.createSegmentedButton(
|
|
||||||
new ActionShowInPropertySheet("Bean: Button", button),
|
|
||||||
new ActionShowInPropertySheet("Bean: TextField", textField),
|
|
||||||
new ActionShowInPropertySheet("Custom Model", null),
|
|
||||||
new ActionShowInPropertySheet("Custom BeanInfo", sampleBean)
|
|
||||||
);
|
|
||||||
segmentedButton.getStyleClass().add(SegmentedButton.STYLE_CLASS_DARK);
|
|
||||||
segmentedButton.getButtons().get(0).fire();
|
|
||||||
|
|
||||||
CheckBox toolbarModeVisible = new CheckBox("Show Mode Buttons");
|
|
||||||
toolbarModeVisible.selectedProperty().bindBidirectional(propertySheet.modeSwitcherVisibleProperty());
|
|
||||||
|
|
||||||
CheckBox toolbarSearchVisible = new CheckBox("Show Search Field");
|
|
||||||
toolbarSearchVisible.selectedProperty().bindBidirectional(propertySheet.searchBoxVisibleProperty());
|
|
||||||
|
|
||||||
infoPane.getChildren().add(toolbarModeVisible);
|
|
||||||
infoPane.getChildren().add(toolbarSearchVisible);
|
|
||||||
infoPane.getChildren().add(segmentedButton);
|
|
||||||
infoPane.getChildren().add(button);
|
|
||||||
infoPane.getChildren().add(textField);
|
|
||||||
|
|
||||||
return infoPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ActionModeChange extends Action {
|
|
||||||
|
|
||||||
public ActionModeChange(String title, Mode mode) {
|
|
||||||
super(title);
|
|
||||||
setEventHandler(ae -> propertySheet.modeProperty().set(mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,234 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014, 2019 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import javafx.beans.InvalidationListener;
|
|
||||||
import javafx.beans.Observable;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.ChoiceBox;
|
|
||||||
import javafx.scene.control.ColorPicker;
|
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Control;
|
|
||||||
import javafx.scene.control.DatePicker;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.ListCell;
|
|
||||||
import javafx.scene.control.ListView;
|
|
||||||
import javafx.scene.control.ScrollPane;
|
|
||||||
import javafx.scene.control.Slider;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.control.ToggleButton;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.paint.Color;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.util.Callback;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.validation.ValidationResult;
|
|
||||||
import org.controlsfx.validation.ValidationSupport;
|
|
||||||
import org.controlsfx.validation.Validator;
|
|
||||||
import org.controlsfx.validation.decoration.CompoundValidationDecoration;
|
|
||||||
import org.controlsfx.validation.decoration.GraphicValidationDecoration;
|
|
||||||
import org.controlsfx.validation.decoration.StyleClassValidationDecoration;
|
|
||||||
import org.controlsfx.validation.decoration.ValidationDecoration;
|
|
||||||
|
|
||||||
public class HelloValidation extends ControlsFXSample {
|
|
||||||
|
|
||||||
private TextField textField = new TextField();
|
|
||||||
private ValidationSupport validationSupport = new ValidationSupport();
|
|
||||||
|
|
||||||
@Override public String getSampleName() {
|
|
||||||
return "Component Validation";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE + "org/controlsfx/validation/ValidationSupport.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getSampleDescription() {
|
|
||||||
return "Component Validation";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getPanel(final Stage stage) {
|
|
||||||
GridPane root = new GridPane();
|
|
||||||
root.setVgap(10);
|
|
||||||
root.setHgap(10);
|
|
||||||
root.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
root.sceneProperty().addListener(new InvalidationListener() {
|
|
||||||
@Override public void invalidated(Observable o) {
|
|
||||||
if (root.getScene() != null) {
|
|
||||||
root.getScene().getStylesheets().add(HelloDecorator.class.getResource("validation.css").toExternalForm());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// text field
|
|
||||||
validationSupport.registerValidator(textField, Validator.createEmptyValidator("Text is required"));
|
|
||||||
|
|
||||||
root.add(new Label("TextField"), 0, row);
|
|
||||||
root.add(textField, 1, row);
|
|
||||||
GridPane.setHgrow(textField, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//combobox
|
|
||||||
row++;
|
|
||||||
ComboBox<String> combobox = new ComboBox<String>();
|
|
||||||
combobox.getItems().addAll("Item A", "Item B", "Item C");
|
|
||||||
validationSupport.registerValidator(combobox, (Control c, String newValue) ->
|
|
||||||
ValidationResult.fromErrorIf(combobox, "ComboBox Selection required", newValue == null || newValue.isEmpty())
|
|
||||||
.addInfoIf(combobox, "Item A is the first item", "Item A".equals(newValue))
|
|
||||||
.addInfoIf(combobox, "Item B is the second item", "Item B".equals(newValue))
|
|
||||||
.addInfoIf(combobox, "Item C is the third item", "Item C".equals(newValue))
|
|
||||||
);
|
|
||||||
|
|
||||||
root.add(new Label("ComboBox"), 0, row);
|
|
||||||
root.add(combobox, 1, row);
|
|
||||||
GridPane.setHgrow(combobox, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//choicebox
|
|
||||||
row++;
|
|
||||||
ChoiceBox<String> choiceBox = new ChoiceBox<String>();
|
|
||||||
choiceBox.getItems().addAll("Item A", "Item B", "Item C");
|
|
||||||
validationSupport.registerValidator(choiceBox, Validator.createEmptyValidator("ChoiceBox Selection required"));
|
|
||||||
|
|
||||||
root.add(new Label("ChoiceBox"), 0, row);
|
|
||||||
root.add(choiceBox, 1, row);
|
|
||||||
GridPane.setHgrow(choiceBox, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//checkbox
|
|
||||||
row++;
|
|
||||||
CheckBox checkBox = new CheckBox();
|
|
||||||
validationSupport.registerValidator(checkBox, (Control c, Boolean newValue) ->
|
|
||||||
ValidationResult.fromErrorIf(c, "Checkbox should be checked", !newValue));
|
|
||||||
|
|
||||||
root.add(new Label("CheckBox"), 0, row);
|
|
||||||
root.add(checkBox, 1, row);
|
|
||||||
GridPane.setHgrow(checkBox, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//slider
|
|
||||||
row++;
|
|
||||||
Slider slider = new Slider(-50d, 50d, -10d);
|
|
||||||
slider.setShowTickLabels(true);
|
|
||||||
validationSupport.registerValidator(slider, (Control c, Double newValue) ->
|
|
||||||
ValidationResult.fromErrorIf(slider, "Slider value should be > 0", newValue <= 0));
|
|
||||||
|
|
||||||
root.add(new Label("Slider"), 0, row);
|
|
||||||
root.add(slider, 1, row);
|
|
||||||
GridPane.setHgrow(slider, Priority.ALWAYS);
|
|
||||||
|
|
||||||
// color picker
|
|
||||||
row++;
|
|
||||||
ColorPicker colorPicker = new ColorPicker(Color.RED);
|
|
||||||
validationSupport.registerValidator(colorPicker,
|
|
||||||
Validator.createEqualsValidator("Color should be WHITE or BLACK", Arrays.asList(Color.WHITE, Color.BLACK)));
|
|
||||||
|
|
||||||
root.add(new Label("Color Picker"), 0, row);
|
|
||||||
root.add(colorPicker, 1, row);
|
|
||||||
GridPane.setHgrow(colorPicker, Priority.ALWAYS);
|
|
||||||
|
|
||||||
// date picker
|
|
||||||
row++;
|
|
||||||
DatePicker datePicker = new DatePicker();
|
|
||||||
validationSupport.registerValidator(datePicker, false, (Control c, LocalDate newValue) ->
|
|
||||||
ValidationResult.fromWarningIf(datePicker, "The date should be today", !LocalDate.now().equals(newValue)));
|
|
||||||
|
|
||||||
root.add(new Label("Date Picker"), 0, row);
|
|
||||||
root.add(datePicker, 1, row);
|
|
||||||
GridPane.setHgrow(datePicker, Priority.ALWAYS);
|
|
||||||
|
|
||||||
ScrollPane scrollPane = new ScrollPane(root);
|
|
||||||
return scrollPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
ValidationDecoration iconDecorator = new GraphicValidationDecoration();
|
|
||||||
ValidationDecoration cssDecorator = new StyleClassValidationDecoration();
|
|
||||||
ValidationDecoration compoundDecorator = new CompoundValidationDecoration(cssDecorator, iconDecorator);
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// --- validation decorator
|
|
||||||
Callback<ListView<ValidationDecoration>, ListCell<ValidationDecoration>> cellFactory = listView -> new ListCell<ValidationDecoration>() {
|
|
||||||
@Override protected void updateItem(ValidationDecoration decorator, boolean empty) {
|
|
||||||
super.updateItem(decorator, empty);
|
|
||||||
|
|
||||||
if (empty) {
|
|
||||||
setText("");
|
|
||||||
} else {
|
|
||||||
if (decorator instanceof StyleClassValidationDecoration) {
|
|
||||||
setText("Style Class Validation Decorator");
|
|
||||||
} else if (decorator instanceof GraphicValidationDecoration) {
|
|
||||||
setText("Graphic Validation Decorator");
|
|
||||||
} else if (decorator instanceof CompoundValidationDecoration) {
|
|
||||||
setText("Compound Validation Decorator");
|
|
||||||
} else {
|
|
||||||
setText("Unknown decorator type!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ComboBox<ValidationDecoration> decoratorBox = new ComboBox<>();
|
|
||||||
decoratorBox.getItems().addAll(iconDecorator, cssDecorator, compoundDecorator);
|
|
||||||
decoratorBox.setCellFactory(cellFactory);
|
|
||||||
decoratorBox.setButtonCell(cellFactory.call(null));
|
|
||||||
decoratorBox.getSelectionModel().selectedItemProperty().addListener((o,old,decorator) ->
|
|
||||||
validationSupport.setValidationDecorator(decorator));
|
|
||||||
decoratorBox.getSelectionModel().select(0);
|
|
||||||
|
|
||||||
Label validationDecoratorLabel = new Label("Validation Decorator: ");
|
|
||||||
validationDecoratorLabel.getStyleClass().add("property");
|
|
||||||
grid.add(validationDecoratorLabel, 0, row);
|
|
||||||
grid.add(decoratorBox, 1, row);
|
|
||||||
GridPane.setHgrow(decoratorBox, Priority.ALWAYS);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
ToggleButton btnToggleRequired = new ToggleButton("Toggle TextField required status");
|
|
||||||
btnToggleRequired.setSelected(ValidationSupport.isRequired(textField));
|
|
||||||
btnToggleRequired.setOnAction(e -> {
|
|
||||||
ValidationSupport.setRequired(textField, btnToggleRequired.isSelected());
|
|
||||||
});
|
|
||||||
grid.add(btnToggleRequired, 1, row, 1, 1);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<AnchorPane fx:id="root" prefHeight="300.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/17.0.2-ea"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="das.tools.np.gui.controllers.EditPhonesController">
|
|
||||||
<HBox alignment="CENTER" layoutX="14.0" layoutY="251.0" prefHeight="35.0" prefWidth="200.0" spacing="20.0"
|
|
||||||
AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0">
|
|
||||||
<Button fx:id="btOk" defaultButton="true" mnemonicParsing="false" prefHeight="24.0" prefWidth="88.0"
|
|
||||||
text="OK"/>
|
|
||||||
<Button fx:id="btCancel" cancelButton="true" mnemonicParsing="false" prefHeight="24.0" prefWidth="88.0"
|
|
||||||
text="Cancel"/>
|
|
||||||
</HBox>
|
|
||||||
</AnchorPane>
|
|
||||||
@ -1,742 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013, 2015 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples.dialogs;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javafx.application.Application;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import javafx.scene.control.Alert.AlertType;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.ButtonBar.ButtonData;
|
|
||||||
import javafx.scene.control.ButtonType;
|
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.ChoiceDialog;
|
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Dialog;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.control.TextInputDialog;
|
|
||||||
import javafx.scene.image.Image;
|
|
||||||
import javafx.scene.image.ImageView;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.HBox;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.scene.text.Font;
|
|
||||||
import javafx.stage.Modality;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.stage.StageStyle;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.dialog.CommandLinksDialog;
|
|
||||||
import org.controlsfx.dialog.CommandLinksDialog.CommandLinksButtonType;
|
|
||||||
import org.controlsfx.dialog.WizardPane;
|
|
||||||
import org.controlsfx.dialog.ExceptionDialog;
|
|
||||||
import org.controlsfx.dialog.FontSelectorDialog;
|
|
||||||
import org.controlsfx.dialog.LoginDialog;
|
|
||||||
import org.controlsfx.dialog.ProgressDialog;
|
|
||||||
import org.controlsfx.dialog.Wizard;
|
|
||||||
import org.controlsfx.dialog.Wizard.LinearFlow;
|
|
||||||
import org.controlsfx.validation.ValidationSupport;
|
|
||||||
import org.controlsfx.validation.Validator;
|
|
||||||
|
|
||||||
public class HelloDialogs extends ControlsFXSample {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleName() {
|
|
||||||
return "Dialogs";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaDocURL() {
|
|
||||||
// return Utils.JAVADOC_BASE + "org/controlsfx/dialog/Dialogs.html";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleDescription() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ComboBox<StageStyle> styleCombobox = new ComboBox<>();
|
|
||||||
private final ComboBox<Modality> modalityCombobox = new ComboBox<>();
|
|
||||||
private final CheckBox cbUseBlocking = new CheckBox();
|
|
||||||
private final CheckBox cbCloseDialogAutomatically = new CheckBox();
|
|
||||||
private final CheckBox cbShowMasthead = new CheckBox();
|
|
||||||
private final CheckBox cbSetOwner = new CheckBox();
|
|
||||||
private final CheckBox cbCustomGraphic = new CheckBox();
|
|
||||||
|
|
||||||
private Stage stage;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getPanel(Stage stage) {
|
|
||||||
this.stage = stage;
|
|
||||||
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setPadding(new Insets(10, 10, 10, 10));
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setVgap(10);
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
Label javafxDialogs = new Label("JavaFX Dialogs:");
|
|
||||||
javafxDialogs.setFont(Font.font(25));
|
|
||||||
grid.add(javafxDialogs, 0, row++, 2, 1);
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Information Dialog
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Information Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final Button Hyperlink2 = new Button("Show");
|
|
||||||
Hyperlink2.setOnAction( (ActionEvent e) -> {
|
|
||||||
|
|
||||||
Alert dlg = createAlert(AlertType.INFORMATION);
|
|
||||||
dlg.setTitle("Custom title");
|
|
||||||
String optionalMasthead = "Wouldn't this be nice?";
|
|
||||||
dlg.getDialogPane().setContentText("A collection of pre-built JavaFX dialogs?\nSeems like a great idea to me...");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
|
|
||||||
// lets get some output when events happen
|
|
||||||
dlg.setOnShowing(evt -> System.out.println(evt));
|
|
||||||
dlg.setOnShown(evt -> System.out.println(evt));
|
|
||||||
dlg.setOnHiding(evt -> System.out.println(evt));
|
|
||||||
dlg.setOnHidden(evt -> System.out.println(evt));
|
|
||||||
|
|
||||||
// dlg.setOnCloseRequest(evt -> evt.consume());
|
|
||||||
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink2a = new Button("2 x Buttons (no cancel)");
|
|
||||||
Hyperlink2a.setOnAction( (ActionEvent e) -> {
|
|
||||||
Alert dlg = createAlert(AlertType.INFORMATION);
|
|
||||||
dlg.setTitle("Custom title");
|
|
||||||
String optionalMasthead = "Wouldn't this be nice?";
|
|
||||||
dlg.getDialogPane().setContentText("A collection of pre-built JavaFX dialogs?\nSeems like a great idea to me...");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
dlg.getButtonTypes().add(ButtonType.NEXT);
|
|
||||||
|
|
||||||
// dlg.setOnCloseRequest(evt -> evt.consume());
|
|
||||||
|
|
||||||
showDialog(dlg);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
grid.add(new HBox(10, Hyperlink2, Hyperlink2a), 1, row);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Confirmation Dialog
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Confirmation Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final CheckBox cbShowCancel = new CheckBox("Show Cancel Button");
|
|
||||||
cbShowCancel.setSelected(true);
|
|
||||||
|
|
||||||
final Button Hyperlink3 = new Button("Show");
|
|
||||||
Hyperlink3.setOnAction(e -> {
|
|
||||||
Alert dlg = createAlert(AlertType.CONFIRMATION);
|
|
||||||
dlg.setTitle("You do want dialogs right?");
|
|
||||||
String optionalMasthead = "Just Checkin'";
|
|
||||||
dlg.getDialogPane().setContentText("I was a bit worried that you might not want them, so I wanted to double check.");
|
|
||||||
|
|
||||||
if (!cbShowCancel.isSelected()) {
|
|
||||||
dlg.getDialogPane().getButtonTypes().remove(ButtonType.CANCEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
grid.add(new HBox(10, Hyperlink3, cbShowCancel), 1, row);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Warning Dialog
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Warning Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final Button Hyperlink6a = new Button("Show");
|
|
||||||
Hyperlink6a.setOnAction(e -> {
|
|
||||||
Alert dlg = createAlert(AlertType.WARNING);
|
|
||||||
dlg.setTitle("I'm warning you!");
|
|
||||||
String optionalMasthead = "This is a warning";
|
|
||||||
dlg.getDialogPane().setContentText("I'm glad I didn't need to use this...");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
grid.add(new HBox(10, Hyperlink6a), 1, row);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Error Dialog
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Error Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final Button Hyperlink7a = new Button("Show");
|
|
||||||
Hyperlink7a.setOnAction(e -> {
|
|
||||||
Alert dlg = createAlert(AlertType.ERROR);
|
|
||||||
dlg.setTitle("It looks like you're making a bad decision");
|
|
||||||
String optionalMasthead = "Exception Encountered";
|
|
||||||
dlg.getDialogPane().setContentText("Better change your mind - this is really your last chance! (Even longer text that should probably wrap)");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
grid.add(new HBox(10, Hyperlink7a), 1, row);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Input Dialog (with header)
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Input Dialog: "), 0, row);
|
|
||||||
|
|
||||||
final Button Hyperlink8 = new Button("TextField");
|
|
||||||
Hyperlink8.setOnAction(e -> {
|
|
||||||
TextInputDialog dlg = new TextInputDialog("");
|
|
||||||
dlg.setTitle("Name Check");
|
|
||||||
String optionalMasthead = "Please type in your name";
|
|
||||||
dlg.getDialogPane().setContentText("What is your name?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink9 = new Button("Initial Value Set");
|
|
||||||
Hyperlink9.setOnAction(e -> {
|
|
||||||
TextInputDialog dlg = new TextInputDialog("Jonathan");
|
|
||||||
dlg.setTitle("Name Guess");
|
|
||||||
String optionalMasthead = "Name Guess";
|
|
||||||
dlg.getDialogPane().setContentText("Pick a name?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink10 = new Button("Set Choices (< 10)");
|
|
||||||
Hyperlink10.setOnAction(e -> {
|
|
||||||
ChoiceDialog<String> dlg = new ChoiceDialog<>("Jonathan",
|
|
||||||
"Matthew", "Jonathan", "Ian", "Sue", "Hannah");
|
|
||||||
dlg.setTitle("Name Guess");
|
|
||||||
String optionalMasthead = "Name Guess";
|
|
||||||
dlg.getDialogPane().setContentText("Pick a name?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink11 = new Button("Set Choices (>= 10)");
|
|
||||||
Hyperlink11.setOnAction(e -> {
|
|
||||||
ChoiceDialog<String> dlg = new ChoiceDialog<>("Jonathan",
|
|
||||||
"Matthew", "Jonathan", "Ian", "Sue",
|
|
||||||
"Hannah", "Julia", "Denise", "Stephan",
|
|
||||||
"Sarah", "Ron", "Ingrid");
|
|
||||||
dlg.setTitle("Name Guess");
|
|
||||||
String optionalMasthead = "Name Guess";
|
|
||||||
dlg.getDialogPane().setContentText("Pick a name?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
grid.add(new HBox(10, Hyperlink8, Hyperlink9, Hyperlink10, Hyperlink11), 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------- ControlsFX-specific Dialogs
|
|
||||||
|
|
||||||
Label controlsfxDialogs = new Label("ControlsFX Dialogs:");
|
|
||||||
controlsfxDialogs.setFont(Font.font(25));
|
|
||||||
grid.add(controlsfxDialogs, 0, row++, 2, 1);
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// Command links
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Pre-built dialogs: "), 0, row);
|
|
||||||
final Button Hyperlink12 = new Button("Command Links");
|
|
||||||
Hyperlink12.setOnAction(e -> {
|
|
||||||
List<CommandLinksButtonType> links = Arrays
|
|
||||||
.asList(new CommandLinksButtonType(
|
|
||||||
"Add a network that is in the range of this computer",
|
|
||||||
"This shows you a list of networks that are currently available and lets you connect to one.", false),
|
|
||||||
new CommandLinksButtonType(
|
|
||||||
"Manually create a network profile",
|
|
||||||
"This creates a new network profile or locates an existing one and saves it on your computer",
|
|
||||||
true /*default*/),
|
|
||||||
new CommandLinksButtonType("Create an ad hoc network",
|
|
||||||
"This creates a temporary network for sharing files or and Internet connection", false));
|
|
||||||
|
|
||||||
CommandLinksDialog dlg = new CommandLinksDialog(links);
|
|
||||||
dlg.setTitle("Manually connect to wireless network");
|
|
||||||
String optionalMasthead = "Manually connect to wireless network";
|
|
||||||
dlg.getDialogPane().setContentText("How do you want to add a network?");
|
|
||||||
configureSampleDialog(dlg, optionalMasthead);
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink12a = new Button("Font Selector");
|
|
||||||
Hyperlink12a.setOnAction(e -> {
|
|
||||||
FontSelectorDialog dlg = new FontSelectorDialog(null);
|
|
||||||
configureSampleDialog(dlg, "Please select a font!");
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink12b = new Button("Progress");
|
|
||||||
Hyperlink12b.setOnAction((ActionEvent e) -> {
|
|
||||||
Task<Object> worker = new Task<Object>() {
|
|
||||||
@Override
|
|
||||||
protected Object call() throws Exception {
|
|
||||||
for (int i = 0; i <= 100; i++) {
|
|
||||||
updateProgress(i, 99);
|
|
||||||
updateMessage("progress: " + i);
|
|
||||||
System.out.println("progress: " + i);
|
|
||||||
Thread.sleep(100);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ProgressDialog dlg = new ProgressDialog(worker);
|
|
||||||
configureSampleDialog(dlg, "");
|
|
||||||
|
|
||||||
Thread th = new Thread(worker);
|
|
||||||
th.setDaemon(true);
|
|
||||||
th.start();
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink12c = new Button("Login");
|
|
||||||
Hyperlink12c.setOnAction((ActionEvent e) -> {
|
|
||||||
LoginDialog dlg = new LoginDialog(null, null);
|
|
||||||
configureSampleDialog(dlg, "");
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button Hyperlink12d = new Button("Exception");
|
|
||||||
Hyperlink12d.setOnAction((ActionEvent e) -> {
|
|
||||||
ExceptionDialog dlg = new ExceptionDialog(new Exception("ControlsFX is _too_ awesome!"));
|
|
||||||
configureSampleDialog(dlg, "");
|
|
||||||
showDialog(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
grid.add(new HBox(10, Hyperlink12, Hyperlink12a, Hyperlink12b, Hyperlink12c, Hyperlink12d), 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************************************
|
|
||||||
// wizards
|
|
||||||
// *******************************************************************
|
|
||||||
|
|
||||||
grid.add(createLabel("Wizard: "), 0, row);
|
|
||||||
final Button Hyperlink15a = new Button("Linear Wizard");
|
|
||||||
Hyperlink15a.setOnAction(e -> showLinearWizard());
|
|
||||||
|
|
||||||
final Button Hyperlink15b = new Button("Branching Wizard");
|
|
||||||
Hyperlink15b.setOnAction(e -> showBranchingWizard());
|
|
||||||
|
|
||||||
final Button Hyperlink15c = new Button("Validated Linear Wizard");
|
|
||||||
Hyperlink15c.setOnAction(e -> showValidatedLinearWizard());
|
|
||||||
|
|
||||||
grid.add(new HBox(10, Hyperlink15a, Hyperlink15b, Hyperlink15c), 1, row++);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Alert createAlert(AlertType type) {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
Alert dlg = new Alert(type, "");
|
|
||||||
dlg.initModality(modalityCombobox.getValue());
|
|
||||||
dlg.initOwner(owner);
|
|
||||||
return dlg;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void configureSampleDialog(Dialog<?> dlg, String header) {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
if (header != null && cbShowMasthead.isSelected()) {
|
|
||||||
dlg.getDialogPane().setHeaderText(header);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cbCustomGraphic.isSelected()) {
|
|
||||||
dlg.getDialogPane().setGraphic(new ImageView(new Image(getClass().getResource("/org/controlsfx/samples/controlsfx-logo.png").toExternalForm())));
|
|
||||||
}
|
|
||||||
|
|
||||||
dlg.initStyle(styleCombobox.getValue());
|
|
||||||
dlg.initOwner(owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showDialog(Dialog<?> dlg) {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
if (cbCloseDialogAutomatically.isSelected()) {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
System.out.println("Attempting to close dialog now...");
|
|
||||||
Platform.runLater(() -> dlg.close());
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
dlg.initOwner(owner);
|
|
||||||
|
|
||||||
if (cbUseBlocking.isSelected()) {
|
|
||||||
dlg.showAndWait().ifPresent(result -> System.out.println("Result is " + result));
|
|
||||||
} else {
|
|
||||||
dlg.show();
|
|
||||||
dlg.resultProperty().addListener(o -> System.out.println("Result is: " + dlg.getResult()));
|
|
||||||
System.out.println("This println is _after_ the show method - we're non-blocking!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// stage style
|
|
||||||
grid.add(createLabel("Style: ", "property"), 0, row);
|
|
||||||
styleCombobox.getItems().setAll(StageStyle.values());
|
|
||||||
styleCombobox.setValue(styleCombobox.getItems().get(0));
|
|
||||||
grid.add(styleCombobox, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// modality
|
|
||||||
grid.add(createLabel("Modality: ", "property"), 0, row);
|
|
||||||
modalityCombobox.getItems().setAll(Modality.values());
|
|
||||||
modalityCombobox.setValue(modalityCombobox.getItems().get(Modality.values().length-1));
|
|
||||||
grid.add(modalityCombobox, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// use blocking
|
|
||||||
cbUseBlocking.setSelected(true);
|
|
||||||
grid.add(createLabel("Use blocking: ", "property"), 0, row);
|
|
||||||
grid.add(cbUseBlocking, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// close dialog automatically
|
|
||||||
grid.add(createLabel("Close dialog after 2000ms: ", "property"), 0, row);
|
|
||||||
grid.add(cbCloseDialogAutomatically, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// show header
|
|
||||||
grid.add(createLabel("Show custom header text: ", "property"), 0, row);
|
|
||||||
grid.add(cbShowMasthead, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// set owner
|
|
||||||
grid.add(createLabel("Set dialog owner: ", "property"), 0, row);
|
|
||||||
grid.add(cbSetOwner, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
// custom graphic
|
|
||||||
grid.add(createLabel("Use custom graphic: ", "property"), 0, row);
|
|
||||||
grid.add(cbCustomGraphic, 1, row);
|
|
||||||
row++;
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
// private CommandLinksButtonType buildCommandLink( String text, String comment, boolean isDefault ) {
|
|
||||||
// return new CommandLinksButtonType(text, comment, isDefault);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Application.launch(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Node createLabel(String text, String... styleclass) {
|
|
||||||
Label label = new Label(text);
|
|
||||||
|
|
||||||
if (styleclass == null || styleclass.length == 0) {
|
|
||||||
label.setFont(Font.font(13));
|
|
||||||
} else {
|
|
||||||
label.getStyleClass().addAll(styleclass);
|
|
||||||
}
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showLinearWizard() {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
// define pages to show
|
|
||||||
Wizard wizard = new Wizard(owner);
|
|
||||||
wizard.setTitle("Linear Wizard");
|
|
||||||
|
|
||||||
// --- page 1
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
GridPane page1Grid = new GridPane();
|
|
||||||
page1Grid.setVgap(10);
|
|
||||||
page1Grid.setHgap(10);
|
|
||||||
|
|
||||||
page1Grid.add(new Label("First Name:"), 0, row);
|
|
||||||
TextField txFirstName = createTextField("firstName");
|
|
||||||
// wizard.getValidationSupport().registerValidator(txFirstName, Validator.createEmptyValidator("First Name is mandatory"));
|
|
||||||
page1Grid.add(txFirstName, 1, row++);
|
|
||||||
|
|
||||||
page1Grid.add(new Label("Last Name:"), 0, row);
|
|
||||||
TextField txLastName = createTextField("lastName");
|
|
||||||
// wizard.getValidationSupport().registerValidator(txLastName, Validator.createEmptyValidator("Last Name is mandatory"));
|
|
||||||
page1Grid.add(txLastName, 1, row);
|
|
||||||
|
|
||||||
WizardPane page1 = new WizardPane();
|
|
||||||
page1.setHeaderText("Please Enter Your Details");
|
|
||||||
page1.setContent(page1Grid);
|
|
||||||
|
|
||||||
|
|
||||||
// --- page 2
|
|
||||||
final WizardPane page2 = new WizardPane() {
|
|
||||||
@Override public void onEnteringPage(Wizard wizard) {
|
|
||||||
String firstName = (String) wizard.getSettings().get("firstName");
|
|
||||||
String lastName = (String) wizard.getSettings().get("lastName");
|
|
||||||
|
|
||||||
setContentText("Welcome, " + firstName + " " + lastName + "! Let's add some newlines!\n\n\n\n\n\n\nHello World!");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
page2.setHeaderText("Thanks For Your Details!");
|
|
||||||
|
|
||||||
|
|
||||||
// --- page 3
|
|
||||||
WizardPane page3 = new WizardPane();
|
|
||||||
page3.setHeaderText("Goodbye!");
|
|
||||||
page3.setContentText("Page 3, with extra 'help' button!");
|
|
||||||
|
|
||||||
ButtonType helpDialogButton = new ButtonType("Help", ButtonData.HELP_2);
|
|
||||||
page3.getButtonTypes().add(helpDialogButton);
|
|
||||||
Button helpButton = (Button) page3.lookupButton(helpDialogButton);
|
|
||||||
helpButton.addEventFilter(ActionEvent.ACTION, actionEvent -> {
|
|
||||||
actionEvent.consume(); // stop hello.dialog from closing
|
|
||||||
System.out.println("Help clicked!");
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create wizard
|
|
||||||
wizard.setFlow(new LinearFlow(page1, page2, page3));
|
|
||||||
|
|
||||||
System.out.println("page1: " + page1);
|
|
||||||
System.out.println("page2: " + page2);
|
|
||||||
System.out.println("page3: " + page3);
|
|
||||||
|
|
||||||
// show wizard and wait for response
|
|
||||||
wizard.showAndWait().ifPresent(result -> {
|
|
||||||
if (result == ButtonType.FINISH) {
|
|
||||||
System.out.println("Wizard finished, settings: " + wizard.getSettings());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showBranchingWizard() {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
// define pages to show.
|
|
||||||
// Because page1 references page2, we need to declare page2 first.
|
|
||||||
final WizardPane page2 = new WizardPane();
|
|
||||||
page2.setContentText("Page 2");
|
|
||||||
|
|
||||||
final CheckBox checkBox = new CheckBox("Skip the second page");
|
|
||||||
checkBox.setId("skip-page-2");
|
|
||||||
VBox vbox = new VBox(10, new Label("Page 1"), checkBox);
|
|
||||||
final WizardPane page1 = new WizardPane() {
|
|
||||||
// when we exit page 1, we will check the state of the 'skip page 2'
|
|
||||||
// checkbox, and if it is true, we will remove page 2 from the pages list
|
|
||||||
@Override public void onExitingPage(Wizard wizard) {
|
|
||||||
// List<WizardPage> pages = wizard.getPages();
|
|
||||||
// if (checkBox.isSelected()) {
|
|
||||||
// pages.remove(page2);
|
|
||||||
// } else {
|
|
||||||
// if (! pages.contains(page2)) {
|
|
||||||
// pages.add(1, page2);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
page1.setContent(vbox);
|
|
||||||
|
|
||||||
final WizardPane page3 = new WizardPane();
|
|
||||||
page3.setContentText("Page 3");
|
|
||||||
|
|
||||||
// create wizard
|
|
||||||
Wizard wizard = new Wizard(owner);
|
|
||||||
wizard.setTitle("Branching Wizard");
|
|
||||||
Wizard.Flow branchingFlow = new Wizard.Flow() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<WizardPane> advance(WizardPane currentPage) {
|
|
||||||
return Optional.of(getNext(currentPage));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAdvance(WizardPane currentPage) {
|
|
||||||
return currentPage != page3;
|
|
||||||
}
|
|
||||||
|
|
||||||
private WizardPane getNext(WizardPane currentPage) {
|
|
||||||
if ( currentPage == null ) {
|
|
||||||
return page1;
|
|
||||||
} else if ( currentPage == page1) {
|
|
||||||
return checkBox.isSelected()? page3: page2;
|
|
||||||
} else {
|
|
||||||
return page3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//wizard.setFlow( new LinearWizardFlow( page1, page2, page3));
|
|
||||||
wizard.setFlow( branchingFlow);
|
|
||||||
|
|
||||||
// show wizard
|
|
||||||
wizard.showAndWait().ifPresent(result -> {
|
|
||||||
if (result == ButtonType.FINISH) {
|
|
||||||
System.out.println("Wizard finished, settings: " + wizard.getSettings());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showValidatedLinearWizard() {
|
|
||||||
Window owner = cbSetOwner.isSelected() ? stage : null;
|
|
||||||
Wizard wizard = new Wizard(owner);
|
|
||||||
wizard.setTitle("Validated Linear Wizard");
|
|
||||||
|
|
||||||
// Page 1
|
|
||||||
WizardPane page1 = new WizardPane() {
|
|
||||||
ValidationSupport vs = new ValidationSupport();
|
|
||||||
{
|
|
||||||
vs.initInitialDecoration();
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
GridPane page1Grid = new GridPane();
|
|
||||||
page1Grid.setVgap(10);
|
|
||||||
page1Grid.setHgap(10);
|
|
||||||
|
|
||||||
page1Grid.add(new Label("Username:"), 0, row);
|
|
||||||
TextField txUsername = createTextField("username");
|
|
||||||
vs.registerValidator(txUsername, Validator.createEmptyValidator("EMPTY!"));
|
|
||||||
page1Grid.add(txUsername, 1, row++);
|
|
||||||
|
|
||||||
page1Grid.add(new Label("Full Name:"), 0, row);
|
|
||||||
TextField txFullName = createTextField("fullName");
|
|
||||||
page1Grid.add(txFullName, 1, row);
|
|
||||||
|
|
||||||
setContent(page1Grid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnteringPage(Wizard wizard) {
|
|
||||||
wizard.invalidProperty().unbind();
|
|
||||||
wizard.invalidProperty().bind(vs.invalidProperty());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Page 2
|
|
||||||
|
|
||||||
WizardPane page2 = new WizardPane() {
|
|
||||||
ValidationSupport vs = new ValidationSupport();
|
|
||||||
{
|
|
||||||
vs.initInitialDecoration();
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
GridPane page2Grid = new GridPane();
|
|
||||||
page2Grid.setVgap(10);
|
|
||||||
page2Grid.setHgap(10);
|
|
||||||
|
|
||||||
page2Grid.add(new Label("ControlsFX is:"), 0, row);
|
|
||||||
ComboBox<String> cbControlsFX = createComboBox("controlsfx");
|
|
||||||
cbControlsFX.setItems(FXCollections.observableArrayList("Cool", "Great"));
|
|
||||||
vs.registerValidator(cbControlsFX, Validator.createEmptyValidator("EMPTY!"));
|
|
||||||
page2Grid.add(cbControlsFX, 1, row++);
|
|
||||||
|
|
||||||
page2Grid.add(new Label("Where have you heard of it?:"), 0, row);
|
|
||||||
TextField txWhere = createTextField("where");
|
|
||||||
vs.registerValidator(txWhere, Validator.createEmptyValidator("EMPTY!"));
|
|
||||||
page2Grid.add(txWhere, 1, row++);
|
|
||||||
|
|
||||||
page2Grid.add(new Label("Free text:"), 0, row);
|
|
||||||
TextField txFreeText = createTextField("freetext");
|
|
||||||
page2Grid.add(txFreeText, 1, row);
|
|
||||||
|
|
||||||
setContent(page2Grid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnteringPage(Wizard wizard) {
|
|
||||||
wizard.invalidProperty().unbind();
|
|
||||||
wizard.invalidProperty().bind(vs.invalidProperty());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create wizard
|
|
||||||
wizard.setFlow(new LinearFlow(page1, page2));
|
|
||||||
|
|
||||||
// show wizard and wait for response
|
|
||||||
wizard.showAndWait().ifPresent(result -> {
|
|
||||||
if (result == ButtonType.FINISH) {
|
|
||||||
System.out.println("Wizard finished, settings: " + wizard.getSettings());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private TextField createTextField(String id) {
|
|
||||||
TextField textField = new TextField();
|
|
||||||
textField.setId(id);
|
|
||||||
GridPane.setHgrow(textField, Priority.ALWAYS);
|
|
||||||
return textField;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ComboBox<String> createComboBox(String id) {
|
|
||||||
ComboBox<String> comboBox = new ComboBox<>();
|
|
||||||
comboBox.setId(id);
|
|
||||||
GridPane.setHgrow(comboBox, Priority.ALWAYS);
|
|
||||||
return comboBox;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,196 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2018 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples;
|
|
||||||
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.geometry.Side;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.scene.text.Font;
|
|
||||||
import javafx.scene.text.FontPosture;
|
|
||||||
import javafx.scene.text.FontWeight;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.control.ListActionView;
|
|
||||||
import org.controlsfx.control.action.Action;
|
|
||||||
import org.controlsfx.control.action.ActionUtils;
|
|
||||||
import org.controlsfx.glyphfont.FontAwesome;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HelloListActionView extends ControlsFXSample {
|
|
||||||
|
|
||||||
private ListActionView<String> view;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleName() {
|
|
||||||
return "List Action View";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getPanel(Stage stage) {
|
|
||||||
view = new ListActionView<>();
|
|
||||||
view.getItems().addAll("Dirk", "Jonathan", "Eugene","Abhinay", "Samir");
|
|
||||||
view.getActions().addAll(createActions());
|
|
||||||
|
|
||||||
GridPane pane = new GridPane();
|
|
||||||
pane.add(view, 0, 0);
|
|
||||||
pane.setAlignment(Pos.CENTER);
|
|
||||||
|
|
||||||
return pane;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Node getControlPanel() {
|
|
||||||
VBox root = new VBox(20);
|
|
||||||
root.setPadding(new Insets(30, 30, 30, 30));
|
|
||||||
|
|
||||||
CheckBox useCellFactory = new CheckBox("Use cell factory");
|
|
||||||
useCellFactory.setOnAction(evt -> {
|
|
||||||
if (useCellFactory.isSelected()) {
|
|
||||||
view.setCellFactory(listView -> {
|
|
||||||
ListCell<String> cell = new ListCell<String>() {
|
|
||||||
@Override
|
|
||||||
public void updateItem(String item, boolean empty) {
|
|
||||||
super.updateItem(item, empty);
|
|
||||||
|
|
||||||
if (empty) {
|
|
||||||
setText(null);
|
|
||||||
setGraphic(null);
|
|
||||||
} else {
|
|
||||||
setText(item == null ? "null" : item);
|
|
||||||
setGraphic(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
cell.setFont(Font.font("Arial", FontWeight.BOLD,
|
|
||||||
FontPosture.ITALIC, 18));
|
|
||||||
return cell;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
view.setCellFactory(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
CheckBox clearActions = new CheckBox("Clear Actions");
|
|
||||||
clearActions.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
if (newValue) {
|
|
||||||
view.getActions().clear();
|
|
||||||
} else {
|
|
||||||
view.getActions().addAll(createActions());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ComboBox<Side> sideComboBox = new ComboBox<>(FXCollections.observableArrayList(Side.values()));
|
|
||||||
sideComboBox.setTooltip(new Tooltip("The side of the ListView on which the actions should be displayed"));
|
|
||||||
|
|
||||||
sideComboBox.getSelectionModel().select(Side.LEFT);
|
|
||||||
view.sideProperty().bind(sideComboBox.getSelectionModel().selectedItemProperty());
|
|
||||||
|
|
||||||
root.getChildren().addAll(useCellFactory, clearActions, sideComboBox);
|
|
||||||
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSampleDescription() {
|
|
||||||
return "A control used to let the user select multiple values from a "
|
|
||||||
+ "list of available values. Selected values are moved into a "
|
|
||||||
+ "second list that is showing the current selection. Items can "
|
|
||||||
+ "be moved by double clicking on them or by first selecting "
|
|
||||||
+ "them and then pressing one of the buttons in the center.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE
|
|
||||||
+ "org/controlsfx/control/ListActionView.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ObservableList<Action> createActions() {
|
|
||||||
ListActionView.ListAction<String> moveUp = new ListActionView.ListAction<String>(
|
|
||||||
new FontAwesome().create(FontAwesome.Glyph.ANGLE_UP)) {
|
|
||||||
@Override
|
|
||||||
public void initialize(ListView<String> listView) {
|
|
||||||
setEventHandler(e -> moveSelectedItemsUp(listView));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ListActionView.ListAction<String> moveDown = new ListActionView.ListAction<String>(new FontAwesome().create(FontAwesome.Glyph.ANGLE_DOWN)) {
|
|
||||||
@Override
|
|
||||||
public void initialize(ListView<String> listView) {
|
|
||||||
setEventHandler(e -> moveSelectedItemsDown(listView));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return FXCollections.observableArrayList(moveUp, ActionUtils.ACTION_SEPARATOR, moveDown);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void moveSelectedItemsUp(ListView<String> listView) {
|
|
||||||
final MultipleSelectionModel<String> selectionModel = listView.getSelectionModel();
|
|
||||||
final ObservableList<Integer> selectedIndices = selectionModel.getSelectedIndices();
|
|
||||||
final ObservableList<String> items = listView.getItems();
|
|
||||||
for (final Integer selectedIndex : selectedIndices) {
|
|
||||||
if (selectedIndex > 0) {
|
|
||||||
if (selectedIndices.contains(selectedIndex - 1)) continue;
|
|
||||||
final String item = items.get(selectedIndex);
|
|
||||||
final String itemToBeReplaced = items.get(selectedIndex - 1);
|
|
||||||
items.set(selectedIndex - 1, item);
|
|
||||||
items.set(selectedIndex, itemToBeReplaced);
|
|
||||||
selectionModel.clearSelection(selectedIndex);
|
|
||||||
selectionModel.select(selectedIndex - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void moveSelectedItemsDown(ListView<String> listView) {
|
|
||||||
final ObservableList<String> items = listView.getItems();
|
|
||||||
final MultipleSelectionModel<String> selectionModel = listView.getSelectionModel();
|
|
||||||
final List<Integer> selectedIndices = selectionModel.getSelectedIndices();
|
|
||||||
int lastIndex = items.size() - 1;
|
|
||||||
// Last selected item is to be replaced first
|
|
||||||
for (int index = selectedIndices.size() - 1; index >= 0; index--) {
|
|
||||||
final Integer selectedIndex = selectedIndices.get(index);
|
|
||||||
if (selectedIndex < lastIndex) {
|
|
||||||
if (selectedIndices.contains(selectedIndex + 1)) continue;
|
|
||||||
final String item = items.get(selectedIndex);
|
|
||||||
final String itemToBeReplaced = items.get(selectedIndex + 1);
|
|
||||||
items.set(selectedIndex + 1, item);
|
|
||||||
items.set(selectedIndex, itemToBeReplaced);
|
|
||||||
selectionModel.clearSelection(selectedIndex);
|
|
||||||
selectionModel.select(selectedIndex + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,234 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014, 2019 ControlsFX
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of ControlsFX, any associated website, nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package org.controlsfx.samples;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import javafx.beans.InvalidationListener;
|
|
||||||
import javafx.beans.Observable;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Node;
|
|
||||||
import javafx.scene.control.CheckBox;
|
|
||||||
import javafx.scene.control.ChoiceBox;
|
|
||||||
import javafx.scene.control.ColorPicker;
|
|
||||||
import javafx.scene.control.ComboBox;
|
|
||||||
import javafx.scene.control.Control;
|
|
||||||
import javafx.scene.control.DatePicker;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.ListCell;
|
|
||||||
import javafx.scene.control.ListView;
|
|
||||||
import javafx.scene.control.ScrollPane;
|
|
||||||
import javafx.scene.control.Slider;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.scene.control.ToggleButton;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.paint.Color;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.util.Callback;
|
|
||||||
|
|
||||||
import org.controlsfx.ControlsFXSample;
|
|
||||||
import org.controlsfx.validation.ValidationResult;
|
|
||||||
import org.controlsfx.validation.ValidationSupport;
|
|
||||||
import org.controlsfx.validation.Validator;
|
|
||||||
import org.controlsfx.validation.decoration.CompoundValidationDecoration;
|
|
||||||
import org.controlsfx.validation.decoration.GraphicValidationDecoration;
|
|
||||||
import org.controlsfx.validation.decoration.StyleClassValidationDecoration;
|
|
||||||
import org.controlsfx.validation.decoration.ValidationDecoration;
|
|
||||||
|
|
||||||
public class HelloValidation extends ControlsFXSample {
|
|
||||||
|
|
||||||
private TextField textField = new TextField();
|
|
||||||
private ValidationSupport validationSupport = new ValidationSupport();
|
|
||||||
|
|
||||||
@Override public String getSampleName() {
|
|
||||||
return "Component Validation";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getJavaDocURL() {
|
|
||||||
return Utils.JAVADOC_BASE + "org/controlsfx/validation/ValidationSupport.html";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getSampleDescription() {
|
|
||||||
return "Component Validation";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getPanel(final Stage stage) {
|
|
||||||
GridPane root = new GridPane();
|
|
||||||
root.setVgap(10);
|
|
||||||
root.setHgap(10);
|
|
||||||
root.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
root.sceneProperty().addListener(new InvalidationListener() {
|
|
||||||
@Override public void invalidated(Observable o) {
|
|
||||||
if (root.getScene() != null) {
|
|
||||||
root.getScene().getStylesheets().add(HelloDecorator.class.getResource("validation.css").toExternalForm());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// text field
|
|
||||||
validationSupport.registerValidator(textField, Validator.createEmptyValidator("Text is required"));
|
|
||||||
|
|
||||||
root.add(new Label("TextField"), 0, row);
|
|
||||||
root.add(textField, 1, row);
|
|
||||||
GridPane.setHgrow(textField, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//combobox
|
|
||||||
row++;
|
|
||||||
ComboBox<String> combobox = new ComboBox<String>();
|
|
||||||
combobox.getItems().addAll("Item A", "Item B", "Item C");
|
|
||||||
validationSupport.registerValidator(combobox, (Control c, String newValue) ->
|
|
||||||
ValidationResult.fromErrorIf(combobox, "ComboBox Selection required", newValue == null || newValue.isEmpty())
|
|
||||||
.addInfoIf(combobox, "Item A is the first item", "Item A".equals(newValue))
|
|
||||||
.addInfoIf(combobox, "Item B is the second item", "Item B".equals(newValue))
|
|
||||||
.addInfoIf(combobox, "Item C is the third item", "Item C".equals(newValue))
|
|
||||||
);
|
|
||||||
|
|
||||||
root.add(new Label("ComboBox"), 0, row);
|
|
||||||
root.add(combobox, 1, row);
|
|
||||||
GridPane.setHgrow(combobox, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//choicebox
|
|
||||||
row++;
|
|
||||||
ChoiceBox<String> choiceBox = new ChoiceBox<String>();
|
|
||||||
choiceBox.getItems().addAll("Item A", "Item B", "Item C");
|
|
||||||
validationSupport.registerValidator(choiceBox, Validator.createEmptyValidator("ChoiceBox Selection required"));
|
|
||||||
|
|
||||||
root.add(new Label("ChoiceBox"), 0, row);
|
|
||||||
root.add(choiceBox, 1, row);
|
|
||||||
GridPane.setHgrow(choiceBox, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//checkbox
|
|
||||||
row++;
|
|
||||||
CheckBox checkBox = new CheckBox();
|
|
||||||
validationSupport.registerValidator(checkBox, (Control c, Boolean newValue) ->
|
|
||||||
ValidationResult.fromErrorIf(c, "Checkbox should be checked", !newValue));
|
|
||||||
|
|
||||||
root.add(new Label("CheckBox"), 0, row);
|
|
||||||
root.add(checkBox, 1, row);
|
|
||||||
GridPane.setHgrow(checkBox, Priority.ALWAYS);
|
|
||||||
|
|
||||||
//slider
|
|
||||||
row++;
|
|
||||||
Slider slider = new Slider(-50d, 50d, -10d);
|
|
||||||
slider.setShowTickLabels(true);
|
|
||||||
validationSupport.registerValidator(slider, (Control c, Double newValue) ->
|
|
||||||
ValidationResult.fromErrorIf(slider, "Slider value should be > 0", newValue <= 0));
|
|
||||||
|
|
||||||
root.add(new Label("Slider"), 0, row);
|
|
||||||
root.add(slider, 1, row);
|
|
||||||
GridPane.setHgrow(slider, Priority.ALWAYS);
|
|
||||||
|
|
||||||
// color picker
|
|
||||||
row++;
|
|
||||||
ColorPicker colorPicker = new ColorPicker(Color.RED);
|
|
||||||
validationSupport.registerValidator(colorPicker,
|
|
||||||
Validator.createEqualsValidator("Color should be WHITE or BLACK", Arrays.asList(Color.WHITE, Color.BLACK)));
|
|
||||||
|
|
||||||
root.add(new Label("Color Picker"), 0, row);
|
|
||||||
root.add(colorPicker, 1, row);
|
|
||||||
GridPane.setHgrow(colorPicker, Priority.ALWAYS);
|
|
||||||
|
|
||||||
// date picker
|
|
||||||
row++;
|
|
||||||
DatePicker datePicker = new DatePicker();
|
|
||||||
validationSupport.registerValidator(datePicker, false, (Control c, LocalDate newValue) ->
|
|
||||||
ValidationResult.fromWarningIf(datePicker, "The date should be today", !LocalDate.now().equals(newValue)));
|
|
||||||
|
|
||||||
root.add(new Label("Date Picker"), 0, row);
|
|
||||||
root.add(datePicker, 1, row);
|
|
||||||
GridPane.setHgrow(datePicker, Priority.ALWAYS);
|
|
||||||
|
|
||||||
ScrollPane scrollPane = new ScrollPane(root);
|
|
||||||
return scrollPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public Node getControlPanel() {
|
|
||||||
GridPane grid = new GridPane();
|
|
||||||
grid.setVgap(10);
|
|
||||||
grid.setHgap(10);
|
|
||||||
grid.setPadding(new Insets(30, 30, 0, 30));
|
|
||||||
|
|
||||||
ValidationDecoration iconDecorator = new GraphicValidationDecoration();
|
|
||||||
ValidationDecoration cssDecorator = new StyleClassValidationDecoration();
|
|
||||||
ValidationDecoration compoundDecorator = new CompoundValidationDecoration(cssDecorator, iconDecorator);
|
|
||||||
|
|
||||||
int row = 0;
|
|
||||||
|
|
||||||
// --- validation decorator
|
|
||||||
Callback<ListView<ValidationDecoration>, ListCell<ValidationDecoration>> cellFactory = listView -> new ListCell<ValidationDecoration>() {
|
|
||||||
@Override protected void updateItem(ValidationDecoration decorator, boolean empty) {
|
|
||||||
super.updateItem(decorator, empty);
|
|
||||||
|
|
||||||
if (empty) {
|
|
||||||
setText("");
|
|
||||||
} else {
|
|
||||||
if (decorator instanceof StyleClassValidationDecoration) {
|
|
||||||
setText("Style Class Validation Decorator");
|
|
||||||
} else if (decorator instanceof GraphicValidationDecoration) {
|
|
||||||
setText("Graphic Validation Decorator");
|
|
||||||
} else if (decorator instanceof CompoundValidationDecoration) {
|
|
||||||
setText("Compound Validation Decorator");
|
|
||||||
} else {
|
|
||||||
setText("Unknown decorator type!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ComboBox<ValidationDecoration> decoratorBox = new ComboBox<>();
|
|
||||||
decoratorBox.getItems().addAll(iconDecorator, cssDecorator, compoundDecorator);
|
|
||||||
decoratorBox.setCellFactory(cellFactory);
|
|
||||||
decoratorBox.setButtonCell(cellFactory.call(null));
|
|
||||||
decoratorBox.getSelectionModel().selectedItemProperty().addListener((o,old,decorator) ->
|
|
||||||
validationSupport.setValidationDecorator(decorator));
|
|
||||||
decoratorBox.getSelectionModel().select(0);
|
|
||||||
|
|
||||||
Label validationDecoratorLabel = new Label("Validation Decorator: ");
|
|
||||||
validationDecoratorLabel.getStyleClass().add("property");
|
|
||||||
grid.add(validationDecoratorLabel, 0, row);
|
|
||||||
grid.add(decoratorBox, 1, row);
|
|
||||||
GridPane.setHgrow(decoratorBox, Priority.ALWAYS);
|
|
||||||
|
|
||||||
row++;
|
|
||||||
ToggleButton btnToggleRequired = new ToggleButton("Toggle TextField required status");
|
|
||||||
btnToggleRequired.setSelected(ValidationSupport.isRequired(textField));
|
|
||||||
btnToggleRequired.setOnAction(e -> {
|
|
||||||
ValidationSupport.setRequired(textField, btnToggleRequired.isSelected());
|
|
||||||
});
|
|
||||||
grid.add(btnToggleRequired, 1, row, 1, 1);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
launch(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
import org.springframework.cache.annotation.EnableCaching;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableTransactionManagement
|
|
||||||
@EnableCaching
|
|
||||||
public class ProxyBean {
|
|
||||||
@Bean
|
|
||||||
public RestTemplate restTemplate() throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
|
|
||||||
//Proxy usage example
|
|
||||||
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;
|
|
||||||
|
|
||||||
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom()
|
|
||||||
.loadTrustMaterial(null, acceptingTrustStrategy)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
|
|
||||||
HttpHost proxy = new HttpHost("192.168.88.129", 8080);
|
|
||||||
CloseableHttpClient httpClient = HttpClients.custom()
|
|
||||||
.setSSLSocketFactory(csf)
|
|
||||||
.setRoutePlanner(new DefaultProxyRoutePlanner(proxy))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
HttpComponentsClientHttpRequestFactory requestFactory =
|
|
||||||
new HttpComponentsClientHttpRequestFactory();
|
|
||||||
|
|
||||||
requestFactory.setHttpClient(httpClient);
|
|
||||||
RestTemplate restTemplate = new RestTemplate(requestFactory);
|
|
||||||
return restTemplate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
https://kostenko.org/blog/2019/06/runtime-class-loading.html
|
|
||||||
|
|
||||||
How to use custom ClassLoader to load jars in runtime
|
|
||||||
28 June 2019
|
|
||||||
|
|
||||||
To load calsses in runtime java uses ClassLoader mechanism which is based on next core principles:
|
|
||||||
|
|
||||||
delegation - by default uses parent-first delegation, - child ClassLoader will be used if parent is not able to find or load class. This behavior can be changed to child-first by overwriting ClassLoader.loadClass(...);
|
|
||||||
visibility - child ClassLoader is able to see all the classes loaded by parent but vice-versa is not true;
|
|
||||||
uniqueness - allows to load a class exactly once, which is basically achieved by delegation and ensures that child ClassLoader doesn't reload the class already loaded by parent;
|
|
||||||
The main scenarios to use custom ClassLoader is:
|
|
||||||
|
|
||||||
Class Instrumentation - modifying classes at runtime. For example, to unit testing, debugging or monitoring;
|
|
||||||
Isolation of executions - isolate several execution environments within a single process by making visible only a subset of classes for a particular thread, like it does in EE environments;
|
|
||||||
So, let's see how using of custom ClassLoader looks from source code perspective:
|
|
||||||
|
|
||||||
List<File> jars = Arrays.asList(new File("/tmp/jars").listFiles());
|
|
||||||
URL[] urls = new URL[files.size()];
|
|
||||||
for (int i = 0; i < jars.size(); i++) {
|
|
||||||
try {
|
|
||||||
urls[i] = jars.get(i).toURI().toURL();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
URLClassLoader childClassLoader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
|
|
||||||
Then load class with custom ClassLoader:
|
|
||||||
|
|
||||||
Class.forName("org.kostenko.examples.core.classloader.ClassLoaderTest", true , childClassLoader);
|
|
||||||
Note! If your loaded libraries uses some resources like properties or something else, you need to provide context class loader:
|
|
||||||
|
|
||||||
Thread.currentThread().setContextClassLoader(childClassLoader);
|
|
||||||
Also, you can use custom ClassLoaders to load services with Java Service Provider Interface(SPI)
|
|
||||||
|
|
||||||
ServiceLoader<MyProvider> serviceLoader = ServiceLoader.load(MyProvider.class, childClassLoader);
|
|
||||||
...
|
|
||||||
|
|
||||||
---
|
|
||||||
https://stackoverflow.com/questions/60764/how-to-load-jar-files-dynamically-at-runtime
|
|
||||||
|
|
||||||
The reason it's hard is security. Classloaders are meant to be immutable; you shouldn't be able to willy-nilly add classes to it at runtime. I'm actually very surprised that works with the system classloader. Here's how you do it making your own child classloader:
|
|
||||||
|
|
||||||
URLClassLoader child = new URLClassLoader(
|
|
||||||
new URL[] {myJar.toURI().toURL()},
|
|
||||||
this.getClass().getClassLoader()
|
|
||||||
);
|
|
||||||
Class classToLoad = Class.forName("com.MyClass", true, child);
|
|
||||||
Method method = classToLoad.getDeclaredMethod("myMethod");
|
|
||||||
Object instance = classToLoad.newInstance();
|
|
||||||
Object result = method.invoke(instance);
|
|
||||||
Painful, but there it is.
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
// at https://stackoverflow.com/questions/14630539/scheduling-a-job-with-spring-programmatically-with-fixedrate-set-dynamically/14632758
|
|
||||||
@Autowired
|
|
||||||
Environment env;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public MyBean myBean() {
|
|
||||||
return new MyBean();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(destroyMethod = "shutdown")
|
|
||||||
public Executor taskExecutor() {
|
|
||||||
return Executors.newScheduledThreadPool(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
|
||||||
taskRegistrar.setScheduler(taskExecutor());
|
|
||||||
taskRegistrar.addTriggerTask(
|
|
||||||
new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
myBean().getSchedule();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new Trigger() {
|
|
||||||
@Override public Date nextExecutionTime(TriggerContext triggerContext) {
|
|
||||||
Calendar nextExecutionTime = new GregorianCalendar();
|
|
||||||
Date lastActualExecutionTime = triggerContext.lastActualExecutionTime();
|
|
||||||
nextExecutionTime.setTime(lastActualExecutionTime != null ? lastActualExecutionTime : new Date());
|
|
||||||
nextExecutionTime.add(Calendar.MILLISECOND, env.getProperty("myRate", Integer.class)); //you can get the value from wherever you want
|
|
||||||
return nextExecutionTime.getTime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// also at https://www.baeldung.com/spring-scheduled-tasks
|
|
||||||
@Configuration
|
|
||||||
@EnableScheduling
|
|
||||||
public class DynamicSchedulingConfig implements SchedulingConfigurer {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TickService tickService;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Executor taskExecutor() {
|
|
||||||
return Executors.newSingleThreadScheduledExecutor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
|
||||||
taskRegistrar.setScheduler(taskExecutor());
|
|
||||||
taskRegistrar.addTriggerTask(
|
|
||||||
new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
tickService.tick();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new Trigger() {
|
|
||||||
@Override
|
|
||||||
public Date nextExecutionTime(TriggerContext context) {
|
|
||||||
Optional<Date> lastCompletionTime =
|
|
||||||
Optional.ofNullable(context.lastCompletionTime());
|
|
||||||
Instant nextExecutionTime =
|
|
||||||
lastCompletionTime.orElseGet(Date::new).toInstant()
|
|
||||||
.plusMillis(tickService.getDelay());
|
|
||||||
return Date.from(nextExecutionTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
|
|
||||||
spNumberList.getDividers().get(0).positionProperty().addListener((obs, oldVal, newVal) -> {
|
|
||||||
log.info("divider old={} new={}", oldVal, newVal);
|
|
||||||
});
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
package das.tools.np.services;
|
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class DbCreationService {
|
|
||||||
public final String SQL_GET_TABLES_COUNT = "select count(1) from sqlite_master where type = 'table' " +
|
|
||||||
"and name in('archive','properties','groups','numbers','extra_phones','number_to_phone','search_history', 'search_params')";
|
|
||||||
private final JdbcTemplate jdbcTemplate;
|
|
||||||
private final DataSource dataSource;
|
|
||||||
|
|
||||||
public DbCreationService(JdbcTemplate jdbcTemplate, DataSource dataSource) {
|
|
||||||
this.jdbcTemplate = jdbcTemplate;
|
|
||||||
this.dataSource = dataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void checkDbExistence() {
|
|
||||||
log.info("checkDbExistence started");
|
|
||||||
if (getTablesCount() < 8) {
|
|
||||||
if (log.isDebugEnabled()) log.debug("--- Creating new DB ---");
|
|
||||||
Resource resource = new ClassPathResource("sql/schema.sql");
|
|
||||||
ResourceDatabasePopulator populator = new ResourceDatabasePopulator(resource);
|
|
||||||
populator.execute(dataSource);
|
|
||||||
if (log.isDebugEnabled()) log.debug("--- DB structure created ---");
|
|
||||||
resource = new ClassPathResource("sql/data.sql");
|
|
||||||
populator = new ResourceDatabasePopulator(resource);
|
|
||||||
populator.execute(dataSource);
|
|
||||||
if (log.isDebugEnabled()) log.debug("--- Initial data inserted ---");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getTablesCount() {
|
|
||||||
Integer cnt = jdbcTemplate.queryForObject(SQL_GET_TABLES_COUNT, Integer.class);
|
|
||||||
if (cnt == null) {
|
|
||||||
throw new RuntimeException("Couldn't execute SQL");
|
|
||||||
}
|
|
||||||
return cnt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
insert into properties (prop_key, prop_value) values ('end_point', 'https://api.novaposhta.ua/v2.0/json/');
|
|
||||||
insert into properties (prop_key, prop_value) values ('phone_number', '');
|
|
||||||
insert into properties (prop_key, prop_value) values ('language', 'en');
|
|
||||||
|
|
||||||
insert into groups (id, name) values (1, 'Default');
|
|
||||||
|
|
||||||
|
|
||||||
-- TEST ONLY! ToDo: Remove IT in Prod!!!!
|
|
||||||
update properties set prop_value = '+380955580145' where prop_key = 'phone_number';
|
|
||||||
commit;
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
CREATE TABLE properties (
|
|
||||||
id INTEGER primary key AUTOINCREMENT,
|
|
||||||
prop_key varchar not null,
|
|
||||||
prop_value varchar not null,
|
|
||||||
created timestamp default CURRENT_TIMESTAMP,
|
|
||||||
updated timestamp default CURRENT_TIMESTAMP
|
|
||||||
);
|
|
||||||
CREATE INDEX properties_keys_idx ON properties (prop_key);
|
|
||||||
|
|
||||||
CREATE TABLE groups (
|
|
||||||
id INTEGER primary key AUTOINCREMENT,
|
|
||||||
name varchar not null,
|
|
||||||
created timestamp default CURRENT_TIMESTAMP
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into groups (id, name) values (1, 'Default');
|
|
||||||
|
|
||||||
CREATE TABLE numbers (
|
|
||||||
id INTEGER primary key AUTOINCREMENT,
|
|
||||||
number varchar(36),
|
|
||||||
group_id integer not null default 1,
|
|
||||||
app_status integer not null default 0,
|
|
||||||
number_type integer not null default 0,
|
|
||||||
comment varchar(127),
|
|
||||||
dateCreated varchar(36),
|
|
||||||
weight int,
|
|
||||||
cost int,
|
|
||||||
description varchar(36),
|
|
||||||
cargoType varchar(36),
|
|
||||||
status int,
|
|
||||||
seatsAmount int,
|
|
||||||
announcedPrice varchar(36),
|
|
||||||
scheduledDeliveryDate varchar(36),
|
|
||||||
recipientFullName varchar(36),
|
|
||||||
cityRecipient varchar(36),
|
|
||||||
warehouseRecipient varchar(36),
|
|
||||||
warehouseRecipientNumber varchar(36),
|
|
||||||
phoneRecipient varchar(36),
|
|
||||||
recipientAddress varchar(36),
|
|
||||||
citySender varchar(36),
|
|
||||||
phoneSender varchar(36),
|
|
||||||
warehouseSender varchar(36),
|
|
||||||
senderAddress varchar(36),
|
|
||||||
autoUpdated int(1) default 0,
|
|
||||||
json_data text,
|
|
||||||
created timestamp default CURRENT_TIMESTAMP,
|
|
||||||
updated timestamp default CURRENT_TIMESTAMP,
|
|
||||||
FOREIGN KEY (group_id) REFERENCES groups(id)
|
|
||||||
);
|
|
||||||
CREATE INDEX numbers_number_idx ON numbers(number);
|
|
||||||
CREATE INDEX numbers_cityR_idx ON numbers(cityRecipient);
|
|
||||||
CREATE INDEX numbers_cityS_idx ON numbers(citySender);
|
|
||||||
CREATE INDEX numbers_phoneR_idx ON numbers(phoneRecipient);
|
|
||||||
CREATE INDEX numbers_phoneS_idx ON numbers(phoneSender);
|
|
||||||
|
|
||||||
CREATE TABLE extra_phones (
|
|
||||||
id INTEGER primary key AUTOINCREMENT,
|
|
||||||
phone varchar(20) not null,
|
|
||||||
order_number integer not null
|
|
||||||
);
|
|
||||||
CREATE INDEX extra_phones_phone_idx ON extra_phones(phone);
|
|
||||||
|
|
||||||
CREATE TABLE number_to_phone (
|
|
||||||
id INTEGER primary key AUTOINCREMENT,
|
|
||||||
number_id INTEGER not null UNIQUE,
|
|
||||||
phone_id INTEGER not null,
|
|
||||||
CONSTRAINT number_id_fk FOREIGN KEY (number_id) REFERENCES numbers(id) ON DELETE CASCADE,
|
|
||||||
CONSTRAINT phone_id_fk FOREIGN KEY (phone_id) REFERENCES extra_phones(id) ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
CREATE INDEX number_to_phone_number_id_idx ON number_to_phone(number_id);
|
|
||||||
CREATE INDEX number_to_phone_phone_id_idx ON number_to_phone(phone_id);
|
|
||||||
|
|
||||||
CREATE TABLE search_params (
|
|
||||||
id INTEGER primary key AUTOINCREMENT,
|
|
||||||
name varchar(64) not null UNIQUE,
|
|
||||||
options TEXT not null,
|
|
||||||
order_number integer not null,
|
|
||||||
created timestamp default CURRENT_TIMESTAMP,
|
|
||||||
updated timestamp default CURRENT_TIMESTAMP
|
|
||||||
);
|
|
||||||
CREATE INDEX search_params_name_idx ON search_params(name);
|
|
||||||
|
|
||||||
CREATE TABLE search_history (
|
|
||||||
id INTEGER primary key AUTOINCREMENT,
|
|
||||||
search_text TEXT not null,
|
|
||||||
created timestamp default CURRENT_TIMESTAMP
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE archive (
|
|
||||||
id INTEGER not null,
|
|
||||||
number varchar(36),
|
|
||||||
group_id integer not null,
|
|
||||||
app_status integer not null,
|
|
||||||
number_type integer not null,
|
|
||||||
comment varchar(127),
|
|
||||||
dateCreated varchar(36),
|
|
||||||
weight int,
|
|
||||||
cost int,
|
|
||||||
description varchar(36),
|
|
||||||
cargoType varchar(36),
|
|
||||||
status int,
|
|
||||||
seatsAmount int,
|
|
||||||
announcedPrice varchar(36),
|
|
||||||
scheduledDeliveryDate varchar(36),
|
|
||||||
recipientFullName varchar(36),
|
|
||||||
cityRecipient varchar(36),
|
|
||||||
warehouseRecipient varchar(36),
|
|
||||||
warehouseRecipientNumber varchar(36),
|
|
||||||
phoneRecipient varchar(36),
|
|
||||||
recipientAddress varchar(36),
|
|
||||||
citySender varchar(36),
|
|
||||||
phoneSender varchar(36),
|
|
||||||
warehouseSender varchar(36),
|
|
||||||
senderAddress varchar(36),
|
|
||||||
json_data text,
|
|
||||||
created timestamp,
|
|
||||||
updated timestamp
|
|
||||||
);
|
|
||||||
CREATE INDEX archive_number_idx ON archive(number);
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
Код Статус
|
|
||||||
1 Відправник самостійно створив цю накладну, але ще не надав до відправки
|
|
||||||
2 Видалено
|
|
||||||
3 Номер не знайдено
|
|
||||||
4 Відправлення у місті ХХXХ. (Статус для межобластных отправлений)
|
|
||||||
41 Відправлення у місті ХХXХ. (Статус для услуг локал стандарт и локал экспресс - доставка в пределах города)
|
|
||||||
5 Відправлення прямує до міста YYYY
|
|
||||||
6 Відправлення у місті YYYY, орієнтовна доставка до ВІДДІЛЕННЯ-XXX dd-mm. Очікуйте додаткове повідомлення про прибуття
|
|
||||||
7 Прибув на відділення
|
|
||||||
8 Прибув на відділення (завантажено в Поштомат)
|
|
||||||
9 Відправлення отримано
|
|
||||||
10 Відправлення отримано %DateReceived%. Протягом доби ви одержите SMS-повідомлення про надходження грошового переказу та зможете отримати його в касі відділення «Нова пошта»
|
|
||||||
11 Відправлення отримано %DateReceived%. Грошовий переказ видано одержувачу.
|
|
||||||
12 Нова Пошта комплектує ваше відправлення
|
|
||||||
101 На шляху до одержувача
|
|
||||||
102 Відмова від отримання (Відправником створено замовлення на повернення)
|
|
||||||
103 Відмова одержувача (отримувач відмовився від відправлення)
|
|
||||||
104 Змінено адресу
|
|
||||||
105 Припинено зберігання
|
|
||||||
106 Одержано і створено ЄН зворотньої доставки
|
|
||||||
111 Невдала спроба доставки через відсутність Одержувача на адресі або зв'язку з ним
|
|
||||||
112 Дата доставки перенесена Одержувачем
|
|
||||||
@ -24,11 +24,13 @@ That it.
|
|||||||
- archiving completed/unused numbers
|
- archiving completed/unused numbers
|
||||||
- visually logging main application's events
|
- visually logging main application's events
|
||||||
### ⏬ Getting
|
### ⏬ Getting
|
||||||
You can download archive from [Releases section](https://github.com/NpTracker/releases) or clone the repository.
|
You can download archive from [Releases section](https://github.com/anrydas/NovaPoshta/releases) or clone the repository.
|
||||||
Find full application's documentation at: [Ukrainian](help/uk/help.md) and [English](help/en/help.md).
|
Find full application's documentation at: [Ukrainian](help/uk/help.md) and [English](help/en/help.md).
|
||||||
### 🚀 Launch<a id='Launch'/>
|
### 🚀 Launch<a id='Launch'/>
|
||||||
The application's distribution included run.cmd or run.sh depended on your OS. Just launch it.
|
First you need to set the `JFX_PATH` variable as full path to JavaFX in provided `run.*` script.<br/>
|
||||||
Note: run.* script need to `JAVA_HOME` environment variable. If it doesn't provided made changes into script to include full path to JRE.
|
If you haven't the JavaFX you need to install it from [https://gluonhq.com/products/javafx/](https://gluonhq.com/products/javafx/)<br/>
|
||||||
|
The application's distribution included run.cmd or run.sh depended on your OS. Just launch it.<br/>
|
||||||
|
Note: `run.*` script need to `JAVA_HOME` environment variable. If it doesn't provided made changes into script to include full path to JRE.
|
||||||
### 📜 Main Window<a id='MainWin'/>
|
### 📜 Main Window<a id='MainWin'/>
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
BIN
NovaPoshta/help/images/app_logo.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
NovaPoshta/help/images/archive_win.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
NovaPoshta/help/images/config.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
NovaPoshta/help/images/context_menu.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
NovaPoshta/help/images/custom_win.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
NovaPoshta/help/images/detailed_number.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
NovaPoshta/help/images/detailed_window.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
NovaPoshta/help/images/edit_groups.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
NovaPoshta/help/images/edit_search_options.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
NovaPoshta/help/images/list_element.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
NovaPoshta/help/images/log.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
NovaPoshta/help/images/main.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
NovaPoshta/help/images/new.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
NovaPoshta/help/images/phones.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
NovaPoshta/help/images/search.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
NovaPoshta/help/images/search1.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
NovaPoshta/help/images/tool_bar.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
NovaPoshta/help/images/view_modes_filters.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
@ -10,7 +10,7 @@
|
|||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
<app.version>1.1</app.version>
|
<app.version>1.3</app.version>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<fxweavr.version>1.3.0</fxweavr.version>
|
<fxweavr.version>1.3.0</fxweavr.version>
|
||||||
<jackson.version>2.17.0</jackson.version>
|
<jackson.version>2.17.0</jackson.version>
|
||||||
|
|||||||
@ -1 +1,2 @@
|
|||||||
start %JAVA_HOME%\bin\javaw.exe -jar NovaPoshta.jar
|
JFX_PATH=full_path_to_jfx
|
||||||
|
start %JAVA_HOME%\bin\javaw.exe -Djdk.gtk.version=2 --module-path %JFX_PATH%\lib --add-modules javafx.controls,javafx.fxml --add-exports javafx.base/com.sun.javafx.event=ALL-UNNAME -jar NovaPoshta.jar
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
${JAVA_HOME}/bin/java -jar NovaPoshta.jar &
|
JFX_PATH=/full/path/to/jfx
|
||||||
|
${JAVA_HOME}/bin/java -Djdk.gtk.version=2 --module-path ${JFX_PATH}/lib --add-modules javafx.controls,javafx.fxml --add-exports javafx.base/com.sun.javafx.event=ALL-UNNAMED -jar NovaPoshta.jar &
|
||||||
|
|||||||
15
NovaPoshta/src/main/resources/application.properties
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
spring.main.banner-mode=off
|
||||||
|
spring.application.name=Nova Poshta Tracker
|
||||||
|
|
||||||
|
logging.level.das=off
|
||||||
|
logging.file.name=logs/NP.log
|
||||||
|
logging.logback.rollingpolicy.max-history=5
|
||||||
|
logging.logback.rollingpolicy.max-file-size=10MB
|
||||||
|
|
||||||
|
driverClassName=org.sqlite.JDBC
|
||||||
|
url=jdbc:sqlite:DB/np.db
|
||||||
|
spring.jpa.database-platform=org.hibernate.community.dialect.SQLiteDialect
|
||||||
|
spring.datasource.initSQL=PRAGMA foreign_keys = ON
|
||||||
|
#spring.datasource.username=your_username
|
||||||
|
#spring.datasource.password=your_password
|
||||||
|
app.transaction.timeout.seconds=10
|
||||||
BIN
NovaPoshta/src/main/resources/images/buttons/edit_16.png
Normal file
|
After Width: | Height: | Size: 527 B |
BIN
NovaPoshta/src/main/resources/images/buttons/plus-green-16.png
Normal file
|
After Width: | Height: | Size: 767 B |
BIN
NovaPoshta/src/main/resources/images/np_app_icon.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
NovaPoshta/src/main/resources/images/number/group_24.png
Normal file
|
After Width: | Height: | Size: 485 B |
306
NovaPoshta/src/main/resources/languages/lang.properties
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
# Default Language locale file
|
||||||
|
# Application
|
||||||
|
number.type.in=Inbound
|
||||||
|
number.type.out=Outbound
|
||||||
|
number.type.undef=Undefined
|
||||||
|
number.status.new=New
|
||||||
|
number.status.error=Error
|
||||||
|
number.status.processing=Delivering
|
||||||
|
number.status.waiting=Waiting
|
||||||
|
number.status.complete=Completed
|
||||||
|
# Number item
|
||||||
|
item.tooltip.type=Cargo type: %s
|
||||||
|
item.tooltip.status=Cargo status: %s
|
||||||
|
item.tooltip.added.date=Added date
|
||||||
|
item.tooltip.created.date=Created date
|
||||||
|
item.tooltip.updated.date=Last updated date
|
||||||
|
# Number info
|
||||||
|
info.tooltip.comment=User added comment
|
||||||
|
info.tooltip.descr=Cargo description
|
||||||
|
info.label.group=Group:
|
||||||
|
info.tooltip.group=Number's group
|
||||||
|
info.label.status=Status:
|
||||||
|
info.tooltip.status=Cargo status
|
||||||
|
info.label.type=Type:
|
||||||
|
info.tooltip.type=Cargo type
|
||||||
|
info.label.cost=Cost:
|
||||||
|
info.tooltip.cost=Cost of delivery, UAH
|
||||||
|
info.label.seats=Seats:
|
||||||
|
info.tooltip.seats=Seats amount
|
||||||
|
info.label.price=Price:
|
||||||
|
info.tooltip.price=Announced Price, UAH
|
||||||
|
info.label.weight=Weight:
|
||||||
|
info.tooltip.weight=Weight, kg
|
||||||
|
info.label.created=Created:
|
||||||
|
info.tooltip.created=Date created
|
||||||
|
info.label.scheduled=Scheduled:
|
||||||
|
info.tooltip.scheduled=Scheduled Delivery Date
|
||||||
|
info.label.updated=Updated:
|
||||||
|
info.tooltip.updated=Last updated date
|
||||||
|
info.label.recipient.name=For:
|
||||||
|
info.tooltip.recipient.name=Recipient Full Name
|
||||||
|
info.label.recipient.city=in:
|
||||||
|
info.tooltip.recipient.city=Recipient's city
|
||||||
|
info.label.recipient.warehouse=at:
|
||||||
|
info.tooltip.recipient.warehouse=Recipient's warehouse
|
||||||
|
info.label.sender.name=From:
|
||||||
|
info.tooltip.sender.name=Sender Full Name
|
||||||
|
info.label.sender.phone=(%s)
|
||||||
|
info.tooltip.sender.phone=Sender phone number
|
||||||
|
info.label.sender.city=in:
|
||||||
|
info.tooltip.sender.city=Sender's city
|
||||||
|
info.label.sender.warehouse=at:
|
||||||
|
info.tooltip.sender.warehouse=Sender's Warehouse
|
||||||
|
info.tooltip.barcode=Number's Barcode
|
||||||
|
info.button.tooltip.copy=Copy to clipboard
|
||||||
|
info.button.message.copy=Copied to clipboard
|
||||||
|
info.button.tooltip.open=Open in new window
|
||||||
|
info.label.detailed=Detailed Info:
|
||||||
|
info.field.detailed.name=Field Name
|
||||||
|
info.field.detailed.value=Field Value
|
||||||
|
info.field.menu.copy.name=Copy Field Name
|
||||||
|
info.field.menu.copy.value=Copy Field value
|
||||||
|
info.field.menu.copy.kv=Copy Key and Value as K=V
|
||||||
|
info.field.menu.copy.kv1=Copy Key and Value as K->V
|
||||||
|
info.field.menu.copy.all=Copy All Rows
|
||||||
|
# Fields
|
||||||
|
number.field.id=ID
|
||||||
|
number.field.number=Number
|
||||||
|
number.field.group=Group
|
||||||
|
number.field.appStatus=Number Status
|
||||||
|
number.field.numberType=Number Type
|
||||||
|
number.field.comment=User Comment
|
||||||
|
number.field.dateCreated=Date Created
|
||||||
|
number.field.weight=Weight
|
||||||
|
number.field.cost=Cost
|
||||||
|
number.field.seatsAmount=Seats Amount
|
||||||
|
number.field.description=Description
|
||||||
|
number.field.cargoType=Type
|
||||||
|
number.field.statusCode=Status Code
|
||||||
|
number.field.announcedPrice=Announced Price
|
||||||
|
number.field.scheduledDeliveryDate=Scheduled Delivery Date
|
||||||
|
number.field.recipientFullName=Recipient Full Name
|
||||||
|
number.field.cityRecipient=Recipient's City
|
||||||
|
number.field.warehouseRecipient=Recipient's Warehouse
|
||||||
|
number.field.warehouseRecipientNumber=Recipient Warehouse's Number
|
||||||
|
number.field.phoneRecipient=Recipient's Phone
|
||||||
|
number.field.recipientAddress=Recipient's Address
|
||||||
|
number.field.citySender=Sender's City
|
||||||
|
number.field.phoneSender=Sender's Phone
|
||||||
|
number.field.warehouseSender=Sender's Warehouse
|
||||||
|
number.field.senderAddress=Sender's Address
|
||||||
|
number.field.fullData=Response Full Data
|
||||||
|
number.field.created=Created Date
|
||||||
|
number.field.updated=Last Updated Date
|
||||||
|
number.field.groupName=Group name
|
||||||
|
number.field.descr=Describe*
|
||||||
|
number.field.autoUpdated=Auto Update
|
||||||
|
# Config window
|
||||||
|
config.title=Configuration:
|
||||||
|
config.label.url=API URL:
|
||||||
|
config.label.phone=Phone:
|
||||||
|
config.label.language=Language:
|
||||||
|
config.label.maxHistory=Search history records:
|
||||||
|
config.tooltip.maxHistory=Search history maximum records: from %d to %d\nZero value means 'Do not save search history'
|
||||||
|
config.label.maxLogRecords=LOG records:
|
||||||
|
config.label.autoUpdate=Enable Auto Update
|
||||||
|
config.alert.title=Error in config
|
||||||
|
config.alert.message.wrongApiUrl=Field must contain valid NP's API endpoint value
|
||||||
|
config.alert.message.wrongPhone=Field must contain valid phone number
|
||||||
|
# Detailed Info window
|
||||||
|
detail.title=Detailed info for %s
|
||||||
|
# Add Number window
|
||||||
|
add.title=Adding new number
|
||||||
|
add.label.number=Number:
|
||||||
|
add.label.type=Type:
|
||||||
|
add.label.phone=Phone:
|
||||||
|
add.label.update=Auto Update
|
||||||
|
add.label.another=Add another
|
||||||
|
add.label.comment=Comment:
|
||||||
|
add.label.group=Group:
|
||||||
|
add.edit.comment.prompt=Comment for new Cargo Number (could be empty)
|
||||||
|
add.alert.title.error=Error
|
||||||
|
add.alert.message.WrongNumber=Wrong number
|
||||||
|
add.alert.message.NumberAlreadyAdded=Number '%s' already added
|
||||||
|
add.alert.message.WrongPhone=Wrong phone
|
||||||
|
add.tooltip.AddPhone=Add this phone into DB
|
||||||
|
add.tooltip.EditPhones=Edit all phones
|
||||||
|
add.message.PhoneAdded=The phone '%s' have been added into DB
|
||||||
|
add.message.PhoneExists=The phone '%s' already exists in DB
|
||||||
|
# Edit Phones window
|
||||||
|
edit.phones.title=Edit all pones
|
||||||
|
edit.phones.dialog.title=Editing Phones
|
||||||
|
edit.phones.newPhone=New Phone number:
|
||||||
|
edit.phones.alert.title=Wrong phone number '%s'
|
||||||
|
edit.phones.alert.message=There was a wrong phone number entered.\nPlease correct and try again.
|
||||||
|
edit.phones.confirm.title=Confirm deletion
|
||||||
|
edit.phones.confirm.header=Confirm deletion of '%s'
|
||||||
|
edit.phones.confirm.message=Are you sure to remove the phone?
|
||||||
|
edit.phones.alert.phoneUsed.title=The '%s' phone is used in number(s)
|
||||||
|
edit.phones.alert.phoneUsed.message=Phone used in number(s). So it couldn't be deleted
|
||||||
|
# Edit Search Options window
|
||||||
|
edit.options.action.moveUp=Move Up
|
||||||
|
edit.options.action.moveDn=Move Down
|
||||||
|
edit.options.action.add=Add item
|
||||||
|
edit.options.action.edit=Edit item
|
||||||
|
edit.options.action.apply=Apply changes
|
||||||
|
edit.options.action.remove=Remove item
|
||||||
|
edit.options.title=Edit all pones
|
||||||
|
edit.options.confirm.title=Confirm deletion
|
||||||
|
edit.options.confirm.header=Confirm deletion of '%s'
|
||||||
|
edit.options.confirm.message=Are you sure to remove the Search Option?
|
||||||
|
edit.options.alert.title=Wrong parameter
|
||||||
|
edit.options.alert.message=The Search Options' name couldn't be empty.\nPlease correct and try again.
|
||||||
|
edit.options.toast.message.applied=Changes have been applied
|
||||||
|
edit.options.toast.message.noChanges=There were no changes
|
||||||
|
edit.options.toast.message.removed=The option '%s' have been removed
|
||||||
|
edit.options.name.newOption=New search options
|
||||||
|
edit.options.label.name=Name:
|
||||||
|
edit.options.label.text=Search text:
|
||||||
|
# Edit Groups window
|
||||||
|
edit.groups.title=Edit all groups
|
||||||
|
edit.groups.dialog.title=Editing Groups
|
||||||
|
edit.groups.newGroup=New Group name:
|
||||||
|
edit.groups.alert.title=Group '%s' already exists
|
||||||
|
edit.groups.alert.message=Group name you have been entered already exists.\nEnter new one please.
|
||||||
|
edit.groups.confirm.title=Confirm deletion
|
||||||
|
edit.groups.confirm.header=Confirm deletion of '%s'
|
||||||
|
edit.groups.confirm.message=Are you sure to remove the Group?
|
||||||
|
edit.groups.toast.message.removed=The Group '%s' have been removed
|
||||||
|
edit.groups.alert.notEmpty.title=Group '%s' is not empty
|
||||||
|
edit.groups.alert.notEmpty.message=The Group contains %d numbers.\nNot empty group couldn't be deleted.
|
||||||
|
# Search window
|
||||||
|
search.window.title=Search
|
||||||
|
search.fields.tooltip=Selected fields:\n%s
|
||||||
|
search.fields.tooltip.selectAll=Select all fields
|
||||||
|
search.fields.tooltip.SelectNone=Clear selected fields
|
||||||
|
search.label.what=Search for:
|
||||||
|
search.edit.what.prompt=Enter search text
|
||||||
|
search.label.searchOptions=Options:
|
||||||
|
search.button=Search
|
||||||
|
search.label.options=Search options
|
||||||
|
search.button.save=Save search options
|
||||||
|
search.button.restore=Restore search options
|
||||||
|
search.label.results=Search Results
|
||||||
|
search.button.plugins.tooltip=Send numbers list to Plugin
|
||||||
|
search.button.simpleSearch=Simple search
|
||||||
|
search.button.extSearch=in Extended search
|
||||||
|
search.button.searchArchive=in Archive
|
||||||
|
search.button.sendAllItems=Send all items
|
||||||
|
search.button.sendAllItems.tooltip=Send all items to plugin (if checked) or selected items only
|
||||||
|
search.alert.input.title=Search name
|
||||||
|
search.alert.input.header=Enter new search name:
|
||||||
|
search.alert.input.content=Name:
|
||||||
|
search.alert.error.header=Error saving options
|
||||||
|
search.alert.error.message.alreadyExists=Name '%s' already exists. Please enter new one.
|
||||||
|
search.alert.select.title=Select option
|
||||||
|
search.alert.select.header=Search option name selection
|
||||||
|
search.alert.select.content=Select name:
|
||||||
|
search.alert.info.results.header=Search Results
|
||||||
|
search.alert.info.results.content=There are no results was found for your request
|
||||||
|
search.log.numbersFound=For search query '%s' found %d number(s)
|
||||||
|
search.log.numbersNotFound=For search query '%s' doesn't found any number(s)
|
||||||
|
search.log.searchMethodChanged=Search results have been cleared due to search method was changed from 'Search in Archive' to 'Regular Search'
|
||||||
|
# search options pane
|
||||||
|
options.label.group=Group
|
||||||
|
options.label.groupName=Group Name
|
||||||
|
options.label.weight=Weight
|
||||||
|
options.label.cost=Cost
|
||||||
|
options.label.price=Announced Price
|
||||||
|
options.label.seats=Seats Amount
|
||||||
|
options.label.numberStatus=Number Status
|
||||||
|
options.label.numberType=Number Type
|
||||||
|
options.label.status=Status
|
||||||
|
options.label.createDate=Create date
|
||||||
|
options.label.scheduledDate=Scheduled delivery date
|
||||||
|
# Main Menu
|
||||||
|
menu.group.number=Numbers
|
||||||
|
menu.number.add=Add number
|
||||||
|
menu.number.update=Update number
|
||||||
|
menu.number.updateUncompleted=Update Uncompleted numbers
|
||||||
|
menu.number.moveToArchive=Move to archive
|
||||||
|
menu.number.addToCustom=Add to custom view
|
||||||
|
menu.number.restoreFromArchive=Restore from archive
|
||||||
|
menu.number.exit=Exit
|
||||||
|
menu.group.moveToGroup=Move to Group
|
||||||
|
menu.group.edit=Edit
|
||||||
|
menu.edit.newGroup=New Group
|
||||||
|
menu.edit.editGroups=Edit Groups
|
||||||
|
menu.edit.editPhones=Edit Phones
|
||||||
|
menu.edit.editSearchOptions=Edit Search Options
|
||||||
|
menu.edit.search=Search
|
||||||
|
menu.edit.config=Configuration
|
||||||
|
menu.group.view=View
|
||||||
|
menu.group.viewMode=View Mode
|
||||||
|
menu.group.filterMode=Filtering Mode
|
||||||
|
menu.view.detail=Detailed view
|
||||||
|
menu.view.showLog=Show Log
|
||||||
|
menu.group.plugins=Plugins
|
||||||
|
menu.plugins.loadPlugins=Load Plugins
|
||||||
|
menu.group.windows=Windows
|
||||||
|
menu.windows.customList=Custom numbers list
|
||||||
|
menu.windows.archivedList=Archived numbers
|
||||||
|
menu.windows.cascade=Show all as cascade
|
||||||
|
menu.windows.closeAll=Close all windows
|
||||||
|
menu.group.help=Help
|
||||||
|
menu.help.about=About
|
||||||
|
menu.log.copy=Copy LOG messages
|
||||||
|
menu.log.clear=Clear LOG messages
|
||||||
|
# Main window alerts
|
||||||
|
alert.firstLaunch.title=First launch
|
||||||
|
alert.firstLaunch.header=Welcome! There is a first launch of the Application.
|
||||||
|
alert.firstLaunch.message=Please fill all necessary configuration fields.
|
||||||
|
alert.NoNumber.title=No Uncompleted numbers
|
||||||
|
alert.NoNumber.message=There is no Uncompleted numbers in list
|
||||||
|
alert.log.NoNumber.message=Auto Update: There is no Uncompleted numbers in list
|
||||||
|
alert.CouldNotExit.title=Couldn't exit
|
||||||
|
alert.CouldNotExit.message=There is an opened windows potentially with unsaved data.\nClose it and try again
|
||||||
|
alert.archive.moveTo.header.numberExists=Error moving number to archive
|
||||||
|
alert.archive.moveTo.content.numberExists=The number '%s' already exists in archive.\nRemove it first and try again.
|
||||||
|
alert.archive.restore.header.numberExists=Error restoring number from archive
|
||||||
|
alert.archive.restore.content.numberExists=The number '%s' already exists in database.\nRestoring impossible
|
||||||
|
alert.archive.restore.content.numberNotFoundInArchive=The number '%s' doesn't exist in archive
|
||||||
|
alert.archive.title.confirmDelete=Confirm deletion
|
||||||
|
alert.archive.header.confirmDelete=Are you sure to permanently remove number '%s'?\nThis is an irreversible operation, it will be impossible to restore number.
|
||||||
|
alert.log.number.movedToArchive=The number '%s' moved to archive
|
||||||
|
alert.log.number.restoredFromArchive=The number '%s' restored from archive
|
||||||
|
alert.log.gettingResponse=Error getting response:
|
||||||
|
alert.message.gettingResponse=There was error occurred while getting data from server
|
||||||
|
# Main window view modes
|
||||||
|
label.vm.tooltip=View mode
|
||||||
|
vm.numbers=Numbers
|
||||||
|
vm.groups=Groups
|
||||||
|
vm.calendarUpdate=Calendar (Update)
|
||||||
|
vm.calendarCreate=Calendar (Create)
|
||||||
|
# Main window Filtering Mode
|
||||||
|
label.fm.filter.tooltip=View filter
|
||||||
|
fm.all=All
|
||||||
|
fm.uncompleted=Uncompleted
|
||||||
|
fm.inbound=Inbound
|
||||||
|
fm.outbound=Outbound
|
||||||
|
# Add Group window
|
||||||
|
group.add.title=Adding new group
|
||||||
|
group.add.label.name=Name:
|
||||||
|
group.alert.exists.title=Group already exists
|
||||||
|
group.alert.exists.message=Group '%s' already exists
|
||||||
|
group.alert.EmptyName.title=Empty group name
|
||||||
|
group.alert.EmptyName.message=Group name couldn't be empty
|
||||||
|
group.message.newGroup=Added new group '%s'
|
||||||
|
group.message.movedToGroup=Number '%s' moved to group '%s'
|
||||||
|
group.alert.cantMove.header=Can not move number
|
||||||
|
group.alert.cantMove.message=Can not move Number '%s'\nto Group it's already in
|
||||||
|
# List window commons
|
||||||
|
lw.menu.ctx.remove=Remove
|
||||||
|
lw.menu.ctx.clear=Clear
|
||||||
|
lw.alert.title=Deletion confirmation
|
||||||
|
# Custom Number List window
|
||||||
|
cnl.title=Custom Numbers List window
|
||||||
|
cnl.label=Numbers List:
|
||||||
|
cnl.alert.message=Are you sure to remove %d custom numbers from Custom List?
|
||||||
|
# Archived Number List window
|
||||||
|
anl.title=Archived Numbers List window
|
||||||
|
anl.label=Numbers List:
|
||||||
|
anl.alert.message=Are you sure to remove %d archived numbers?
|
||||||
|
anl.alert.content=This operation couldn't be reverted!
|
||||||
|
anl.log.numberRemoved=The number '%s' have been permanently removed
|
||||||
|
anl.log.numbersCleared=There was permanently removed all archived numbers
|
||||||
306
NovaPoshta/src/main/resources/languages/lang_en.properties
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
# English Language locale file
|
||||||
|
# Application
|
||||||
|
number.type.in=Inbound
|
||||||
|
number.type.out=Outbound
|
||||||
|
number.type.undef=Undefined
|
||||||
|
number.status.new=New
|
||||||
|
number.status.error=Error
|
||||||
|
number.status.processing=Delivering
|
||||||
|
number.status.waiting=Waiting
|
||||||
|
number.status.complete=Completed
|
||||||
|
# Number item
|
||||||
|
item.tooltip.type=Cargo type: %s
|
||||||
|
item.tooltip.status=Cargo status: %s
|
||||||
|
item.tooltip.added.date=Added date
|
||||||
|
item.tooltip.created.date=Created date
|
||||||
|
item.tooltip.updated.date=Last updated date
|
||||||
|
# Number info
|
||||||
|
info.tooltip.comment=User added comment
|
||||||
|
info.tooltip.descr=Cargo description
|
||||||
|
info.label.group=Group:
|
||||||
|
info.tooltip.group=Number's group
|
||||||
|
info.label.status=Status:
|
||||||
|
info.tooltip.status=Cargo status
|
||||||
|
info.label.type=Type:
|
||||||
|
info.tooltip.type=Cargo type
|
||||||
|
info.label.cost=Cost:
|
||||||
|
info.tooltip.cost=Cost of delivery, UAH
|
||||||
|
info.label.seats=Seats:
|
||||||
|
info.tooltip.seats=Seats amount
|
||||||
|
info.label.price=Price:
|
||||||
|
info.tooltip.price=Announced Price, UAH
|
||||||
|
info.label.weight=Weight:
|
||||||
|
info.tooltip.weight=Weight, kg
|
||||||
|
info.label.created=Created:
|
||||||
|
info.tooltip.created=Date created
|
||||||
|
info.label.scheduled=Scheduled:
|
||||||
|
info.tooltip.scheduled=Scheduled Delivery Date
|
||||||
|
info.label.updated=Updated:
|
||||||
|
info.tooltip.updated=Last updated date
|
||||||
|
info.label.recipient.name=For:
|
||||||
|
info.tooltip.recipient.name=Recipient Full Name
|
||||||
|
info.label.recipient.city=in:
|
||||||
|
info.tooltip.recipient.city=Recipient's city
|
||||||
|
info.label.recipient.warehouse=at:
|
||||||
|
info.tooltip.recipient.warehouse=Recipient's warehouse
|
||||||
|
info.label.sender.name=From:
|
||||||
|
info.tooltip.sender.name=Sender Full Name
|
||||||
|
info.label.sender.phone=(%s)
|
||||||
|
info.tooltip.sender.phone=Sender phone number
|
||||||
|
info.label.sender.city=in:
|
||||||
|
info.tooltip.sender.city=Sender's city
|
||||||
|
info.label.sender.warehouse=at:
|
||||||
|
info.tooltip.sender.warehouse=Sender's Warehouse
|
||||||
|
info.tooltip.barcode=Number's Barcode
|
||||||
|
info.button.tooltip.copy=Copy to clipboard
|
||||||
|
info.button.message.copy=Copied to clipboard
|
||||||
|
info.button.tooltip.open=Open in new window
|
||||||
|
info.label.detailed=Detailed Info:
|
||||||
|
info.field.detailed.name=Field Name
|
||||||
|
info.field.detailed.value=Field Value
|
||||||
|
info.field.menu.copy.name=Copy Field Name
|
||||||
|
info.field.menu.copy.value=Copy Field value
|
||||||
|
info.field.menu.copy.kv=Copy Key and Value as K=V
|
||||||
|
info.field.menu.copy.kv1=Copy Key and Value as K->V
|
||||||
|
info.field.menu.copy.all=Copy All Rows
|
||||||
|
# Fields
|
||||||
|
number.field.id=ID
|
||||||
|
number.field.number=Number
|
||||||
|
number.field.group=Group
|
||||||
|
number.field.appStatus=Number Status
|
||||||
|
number.field.numberType=Number Type
|
||||||
|
number.field.comment=User Comment
|
||||||
|
number.field.dateCreated=Date Created
|
||||||
|
number.field.weight=Weight
|
||||||
|
number.field.cost=Cost
|
||||||
|
number.field.seatsAmount=Seats Amount
|
||||||
|
number.field.description=Description
|
||||||
|
number.field.cargoType=Type
|
||||||
|
number.field.statusCode=Status Code
|
||||||
|
number.field.announcedPrice=Announced Price
|
||||||
|
number.field.scheduledDeliveryDate=Scheduled Delivery Date
|
||||||
|
number.field.recipientFullName=Recipient Full Name
|
||||||
|
number.field.cityRecipient=Recipient's City
|
||||||
|
number.field.warehouseRecipient=Recipient's Warehouse
|
||||||
|
number.field.warehouseRecipientNumber=Recipient Warehouse's Number
|
||||||
|
number.field.phoneRecipient=Recipient's Phone
|
||||||
|
number.field.recipientAddress=Recipient's Address
|
||||||
|
number.field.citySender=Sender's City
|
||||||
|
number.field.phoneSender=Sender's Phone
|
||||||
|
number.field.warehouseSender=Sender's Warehouse
|
||||||
|
number.field.senderAddress=Sender's Address
|
||||||
|
number.field.fullData=Response Full Data
|
||||||
|
number.field.created=Created Date
|
||||||
|
number.field.updated=Last Updated Date
|
||||||
|
number.field.groupName=Group name
|
||||||
|
number.field.descr=Describe*
|
||||||
|
number.field.autoUpdated=Auto Update
|
||||||
|
# Config window
|
||||||
|
config.title=Configuration:
|
||||||
|
config.label.url=API URL:
|
||||||
|
config.label.phone=Phone:
|
||||||
|
config.label.language=Language:
|
||||||
|
config.label.maxHistory=Search history records:
|
||||||
|
config.tooltip.maxHistory=Search history maximum records: from %d to %d\nZero value means 'Do not save search history'
|
||||||
|
config.label.maxLogRecords=LOG records:
|
||||||
|
config.label.autoUpdate=Enable Auto Update
|
||||||
|
config.alert.title=Error in config
|
||||||
|
config.alert.message.wrongApiUrl=Field must contain valid NP's API endpoint value
|
||||||
|
config.alert.message.wrongPhone=Field must contain valid phone number
|
||||||
|
# Detailed Info window
|
||||||
|
detail.title=Detailed info for %s
|
||||||
|
# Add Number window
|
||||||
|
add.title=Adding new number
|
||||||
|
add.label.number=Number:
|
||||||
|
add.label.type=Type:
|
||||||
|
add.label.phone=Phone:
|
||||||
|
add.label.update=Auto Update
|
||||||
|
add.label.another=Add another
|
||||||
|
add.label.comment=Comment:
|
||||||
|
add.label.group=Group:
|
||||||
|
add.edit.comment.prompt=Comment for new Cargo Number (could be empty)
|
||||||
|
add.alert.title.error=Error
|
||||||
|
add.alert.message.WrongNumber=Wrong number
|
||||||
|
add.alert.message.NumberAlreadyAdded=Number '%s' already added
|
||||||
|
add.alert.message.WrongPhone=Wrong phone
|
||||||
|
add.tooltip.AddPhone=Add this phone into DB
|
||||||
|
add.tooltip.EditPhones=Edit all phones
|
||||||
|
add.message.PhoneAdded=The phone '%s' have been added into DB
|
||||||
|
add.message.PhoneExists=The phone '%s' already exists in DB
|
||||||
|
# Edit Phones window
|
||||||
|
edit.phones.title=Edit all pones
|
||||||
|
edit.phones.dialog.title=Editing Phones
|
||||||
|
edit.phones.newPhone=New Phone number:
|
||||||
|
edit.phones.alert.title=Wrong phone number '%s'
|
||||||
|
edit.phones.alert.message=There was a wrong phone number entered.\nPlease correct and try again.
|
||||||
|
edit.phones.confirm.title=Confirm deletion
|
||||||
|
edit.phones.confirm.header=Confirm deletion of '%s'
|
||||||
|
edit.phones.confirm.message=Are you sure to remove the phone?
|
||||||
|
edit.phones.alert.phoneUsed.title=The '%s' phone is used in number(s)
|
||||||
|
edit.phones.alert.phoneUsed.message=Phone used in number(s). So it couldn't be deleted
|
||||||
|
# Edit Search Options window
|
||||||
|
edit.options.action.moveUp=Move Up
|
||||||
|
edit.options.action.moveDn=Move Down
|
||||||
|
edit.options.action.add=Add item
|
||||||
|
edit.options.action.edit=Edit item
|
||||||
|
edit.options.action.apply=Apply changes
|
||||||
|
edit.options.action.remove=Remove item
|
||||||
|
edit.options.title=Edit all pones
|
||||||
|
edit.options.confirm.title=Confirm deletion
|
||||||
|
edit.options.confirm.header=Confirm deletion of '%s'
|
||||||
|
edit.options.confirm.message=Are you sure to remove the Search Option?
|
||||||
|
edit.options.alert.title=Wrong parameter
|
||||||
|
edit.options.alert.message=The Search Options' name couldn't be empty.\nPlease correct and try again.
|
||||||
|
edit.options.toast.message.applied=Changes have been applied
|
||||||
|
edit.options.toast.message.noChanges=There were no changes
|
||||||
|
edit.options.toast.message.removed=The option '%s' have been removed
|
||||||
|
edit.options.name.newOption=New search options
|
||||||
|
edit.options.label.name=Name:
|
||||||
|
edit.options.label.text=Search text:
|
||||||
|
# Edit Groups window
|
||||||
|
edit.groups.title=Edit all groups
|
||||||
|
edit.groups.dialog.title=Editing Groups
|
||||||
|
edit.groups.newGroup=New Group name:
|
||||||
|
edit.groups.alert.title=Group '%s' already exists
|
||||||
|
edit.groups.alert.message=Group name you have been entered already exists.\nEnter new one please.
|
||||||
|
edit.groups.confirm.title=Confirm deletion
|
||||||
|
edit.groups.confirm.header=Confirm deletion of '%s'
|
||||||
|
edit.groups.confirm.message=Are you sure to remove the Group?
|
||||||
|
edit.groups.toast.message.removed=The Group '%s' have been removed
|
||||||
|
edit.groups.alert.notEmpty.title=Group '%s' is not empty
|
||||||
|
edit.groups.alert.notEmpty.message=The Group contains %d numbers.\nNot empty group couldn't be deleted.
|
||||||
|
# Search window
|
||||||
|
search.window.title=Search
|
||||||
|
search.fields.tooltip=Selected fields:\n%s
|
||||||
|
search.fields.tooltip.selectAll=Select all fields
|
||||||
|
search.fields.tooltip.SelectNone=Clear selected fields
|
||||||
|
search.label.what=Search for:
|
||||||
|
search.edit.what.prompt=Enter search text
|
||||||
|
search.label.searchOptions=Search in:
|
||||||
|
search.button=Search
|
||||||
|
search.label.options=Search options
|
||||||
|
search.button.save=Save search options
|
||||||
|
search.button.restore=Restore search options
|
||||||
|
search.label.results=Search Results
|
||||||
|
search.button.plugins.tooltip=Send numbers list to Plugin
|
||||||
|
search.button.simpleSearch=Simple search
|
||||||
|
search.button.extSearch=in Extended search
|
||||||
|
search.button.searchArchive=in Archive
|
||||||
|
search.button.sendAllItems=Send all items
|
||||||
|
search.button.sendAllItems.tooltip=Send all items to plugin (if checked) or selected items only
|
||||||
|
search.alert.input.title=Search name
|
||||||
|
search.alert.input.header=Enter new search name:
|
||||||
|
search.alert.input.content=Name:
|
||||||
|
search.alert.error.header=Error saving options
|
||||||
|
search.alert.error.message.alreadyExists=Name '%s' already exists. Please enter new one.
|
||||||
|
search.alert.select.title=Select option
|
||||||
|
search.alert.select.header=Search option name selection
|
||||||
|
search.alert.select.content=Select name:
|
||||||
|
search.alert.info.results.header=Search Results
|
||||||
|
search.alert.info.results.content=There are no results was found for your request
|
||||||
|
search.log.numbersFound=For search query '%s' found %d number(s)
|
||||||
|
search.log.numbersNotFound=For search query '%s' doesn't found any number(s)
|
||||||
|
search.log.searchMethodChanged=Search results have been cleared due to search method was changed from 'Search in Archive' to 'Regular Search'
|
||||||
|
# search options pane
|
||||||
|
options.label.group=Group
|
||||||
|
options.label.groupName=Group Name
|
||||||
|
options.label.weight=Weight
|
||||||
|
options.label.cost=Cost
|
||||||
|
options.label.price=Announced Price
|
||||||
|
options.label.seats=Seats Amount
|
||||||
|
options.label.numberStatus=Number Status
|
||||||
|
options.label.numberType=Number Type
|
||||||
|
options.label.status=Status
|
||||||
|
options.label.createDate=Create date
|
||||||
|
options.label.scheduledDate=Scheduled delivery date
|
||||||
|
# Main Menu
|
||||||
|
menu.group.number=Numbers
|
||||||
|
menu.number.add=Add number
|
||||||
|
menu.number.update=Update number
|
||||||
|
menu.number.updateUncompleted=Update Uncompleted numbers
|
||||||
|
menu.number.moveToArchive=Move to archive
|
||||||
|
menu.number.addToCustom=Add to custom view
|
||||||
|
menu.number.restoreFromArchive=Restore from archive
|
||||||
|
menu.number.exit=Exit
|
||||||
|
menu.group.moveToGroup=Move to Group
|
||||||
|
menu.group.edit=Edit
|
||||||
|
menu.edit.newGroup=New Group
|
||||||
|
menu.edit.editGroups=Edit Groups
|
||||||
|
menu.edit.editPhones=Edit Phones
|
||||||
|
menu.edit.editSearchOptions=Edit Search Options
|
||||||
|
menu.edit.search=Search
|
||||||
|
menu.edit.config=Configuration
|
||||||
|
menu.group.view=View
|
||||||
|
menu.group.viewMode=View Mode
|
||||||
|
menu.group.filterMode=Filtering Mode
|
||||||
|
menu.view.detail=Detailed view
|
||||||
|
menu.view.showLog=Show Log
|
||||||
|
menu.group.plugins=Plugins
|
||||||
|
menu.plugins.loadPlugins=Load Plugins
|
||||||
|
menu.group.windows=Windows
|
||||||
|
menu.windows.customList=Custom numbers list
|
||||||
|
menu.windows.archivedList=Archived numbers
|
||||||
|
menu.windows.cascade=Show all as cascade
|
||||||
|
menu.windows.closeAll=Close all windows
|
||||||
|
menu.group.help=Help
|
||||||
|
menu.help.about=About
|
||||||
|
menu.log.copy=Copy LOG messages
|
||||||
|
menu.log.clear=Clear LOG messages
|
||||||
|
# Main window alerts
|
||||||
|
alert.firstLaunch.title=First launch
|
||||||
|
alert.firstLaunch.header=Welcome! There is a first launch of the Application.
|
||||||
|
alert.firstLaunch.message=Please fill all necessary configuration fields.
|
||||||
|
alert.NoNumber.title=No Uncompleted numbers
|
||||||
|
alert.NoNumber.message=There is no Uncompleted numbers in list
|
||||||
|
alert.log.NoNumber.message=Auto Update: There is no Uncompleted numbers in list
|
||||||
|
alert.CouldNotExit.title=Couldn't exit
|
||||||
|
alert.CouldNotExit.message=There is an opened windows potentially with unsaved data.\nClose it and try again
|
||||||
|
alert.archive.moveTo.header.numberExists=Error moving number to archive
|
||||||
|
alert.archive.moveTo.content.numberExists=The number '%s' already exists in archive.\nRemove it first and try again.
|
||||||
|
alert.archive.restore.header.numberExists=Error restoring number from archive
|
||||||
|
alert.archive.restore.content.numberExists=The number '%s' already exists in database.\nRestoring impossible
|
||||||
|
alert.archive.restore.content.numberNotFoundInArchive=The number '%s' doesn't exists in archive
|
||||||
|
alert.archive.title.confirmDelete=Confirm deletion
|
||||||
|
alert.archive.header.confirmDelete=Are you sure to permanently remove number '%s'?\nThis is an irreversible operation, it will be impossible to restore number.
|
||||||
|
alert.log.number.movedToArchive=The number '%s' moved to archive
|
||||||
|
alert.log.number.restoredFromArchive=The number '%s' restored from archive
|
||||||
|
alert.log.gettingResponse=Error getting response:
|
||||||
|
alert.message.gettingResponse=There was error occurred while getting data from server
|
||||||
|
# Main window view modes
|
||||||
|
label.vm.tooltip=View mode
|
||||||
|
vm.numbers=Numbers
|
||||||
|
vm.groups=Groups
|
||||||
|
vm.calendarUpdate=Calendar (Update)
|
||||||
|
vm.calendarCreate=Calendar (Create)
|
||||||
|
# Main window Filtering Mode
|
||||||
|
label.fm.filter.tooltip=View filter
|
||||||
|
fm.all=All
|
||||||
|
fm.uncompleted=Uncompleted
|
||||||
|
fm.inbound=Inbound
|
||||||
|
fm.outbound=Outbound
|
||||||
|
# Add Group window
|
||||||
|
group.add.title=Adding new group
|
||||||
|
group.add.label.name=Name:
|
||||||
|
group.alert.exists.title=Group already exists
|
||||||
|
group.alert.exists.message=Group '%s' already exists
|
||||||
|
group.alert.EmptyName.title=Empty group name
|
||||||
|
group.alert.EmptyName.message=Group name couldn't be empty
|
||||||
|
group.message.newGroup=Added new group '%s'
|
||||||
|
group.message.movedToGroup=Number '%s' moved to group '%s'
|
||||||
|
group.alert.cantMove.header=Can not move number
|
||||||
|
group.alert.cantMove.message=Can not move Number '%s'\nto Group it's already in
|
||||||
|
# List window commons
|
||||||
|
lw.menu.ctx.remove=Remove
|
||||||
|
lw.menu.ctx.clear=Clear
|
||||||
|
lw.alert.title=Deletion confirmation
|
||||||
|
# Custom Number List window
|
||||||
|
cnl.title=Custom Numbers List window
|
||||||
|
cnl.label=Numbers List:
|
||||||
|
cnl.alert.message=Are you sure to remove %d custom numbers from Custom List?
|
||||||
|
# Archived Number List window
|
||||||
|
anl.title=Archived Numbers List window
|
||||||
|
anl.label=Numbers List:
|
||||||
|
anl.alert.message=Are you sure to remove %d archived numbers?
|
||||||
|
anl.alert.content=This operation couldn't be reverted!
|
||||||
|
anl.log.numberRemoved=The number '%s' have been permanently removed
|
||||||
|
anl.log.numbersCleared=There was permanently removed all archived numbers
|
||||||
306
NovaPoshta/src/main/resources/languages/lang_uk.properties
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
# Ukrainian Language locale file
|
||||||
|
# Application
|
||||||
|
number.type.in=Вхідний
|
||||||
|
number.type.out=Вихідний
|
||||||
|
number.type.undef=Не визначено
|
||||||
|
number.status.new=Новий
|
||||||
|
number.status.error=Помилка
|
||||||
|
number.status.processing=Доставляється
|
||||||
|
number.status.waiting=Очікує
|
||||||
|
number.status.complete=Завершено
|
||||||
|
# Number item
|
||||||
|
item.tooltip.type=Тип вантажу: %s
|
||||||
|
item.tooltip.status=Стан вантажу: %s
|
||||||
|
item.tooltip.added.date=Дата додавання у БД
|
||||||
|
item.tooltip.created.date=Дата створення у НП
|
||||||
|
item.tooltip.updated.date=Дата останнього оновлення
|
||||||
|
# Number info
|
||||||
|
info.tooltip.comment=Коментар до вантажу, доданий користувачем
|
||||||
|
info.tooltip.descr=Опис вантажу
|
||||||
|
info.label.group=Група:
|
||||||
|
info.tooltip.group=Група, до якої внесено номер
|
||||||
|
info.label.status=Стан:
|
||||||
|
info.tooltip.status=Стан вантажу
|
||||||
|
info.label.type=Тип:
|
||||||
|
info.tooltip.type=Тип вантажу
|
||||||
|
info.label.cost=Вартість:
|
||||||
|
info.tooltip.cost=Вартість доставки, грн
|
||||||
|
info.label.seats=Місця:
|
||||||
|
info.tooltip.seats=Кількість місць
|
||||||
|
info.label.price=Ціна:
|
||||||
|
info.tooltip.price=Оголошена ціна, грн
|
||||||
|
info.label.weight=Вага:
|
||||||
|
info.tooltip.weight=Вага вантажу, кг
|
||||||
|
info.label.created=Створено:
|
||||||
|
info.tooltip.created=Дата створення
|
||||||
|
info.label.scheduled=Заплановано:
|
||||||
|
info.tooltip.scheduled=Планова дата доставки
|
||||||
|
info.label.updated=Оновлено:
|
||||||
|
info.tooltip.updated=Дата останнього оновлення
|
||||||
|
info.label.recipient.name=Для:
|
||||||
|
info.tooltip.recipient.name=Повне ім'я отримувача
|
||||||
|
info.label.recipient.city=у:
|
||||||
|
info.tooltip.recipient.city=Місто отримувача
|
||||||
|
info.label.recipient.warehouse=до:
|
||||||
|
info.tooltip.recipient.warehouse=Склад отримувача
|
||||||
|
info.label.sender.name=Від:
|
||||||
|
info.tooltip.sender.name=Повне ім'я відправника
|
||||||
|
info.label.sender.phone=(%s)
|
||||||
|
info.tooltip.sender.phone=Номер телефону відправника
|
||||||
|
info.label.sender.city=у:
|
||||||
|
info.tooltip.sender.city=Місто відправника
|
||||||
|
info.label.sender.warehouse=з:
|
||||||
|
info.tooltip.sender.warehouse=Склад відправника
|
||||||
|
info.tooltip.barcode=Штрих-код номера
|
||||||
|
info.button.tooltip.copy=Скопіювати текст
|
||||||
|
info.button.message.copy=Скопійовано
|
||||||
|
info.button.tooltip.open=Відкрити у новому вікні
|
||||||
|
info.label.detailed=Детальна інформація:
|
||||||
|
info.field.detailed.name=Поле
|
||||||
|
info.field.detailed.value=Значення
|
||||||
|
info.field.menu.copy.name=Копіювати ім'я поля
|
||||||
|
info.field.menu.copy.value=Копіювати значення поля
|
||||||
|
info.field.menu.copy.kv=Копіювати поле як ім'я=значення
|
||||||
|
info.field.menu.copy.kv1=Копіювати поле як ім'я->значення
|
||||||
|
info.field.menu.copy.all=Копіювати все
|
||||||
|
# Fields
|
||||||
|
number.field.id=ID
|
||||||
|
number.field.number=Номер
|
||||||
|
number.field.group=Група
|
||||||
|
number.field.appStatus=Статус номеру
|
||||||
|
number.field.numberType=Тип номеру
|
||||||
|
number.field.comment=Коментар користувача
|
||||||
|
number.field.dateCreated=Дата створення
|
||||||
|
number.field.weight=Вага
|
||||||
|
number.field.cost=Вартість
|
||||||
|
number.field.seatsAmount=Кількість місць
|
||||||
|
number.field.description=Опис
|
||||||
|
number.field.cargoType=Тип
|
||||||
|
number.field.statusCode=Код стану
|
||||||
|
number.field.announcedPrice=Оголошена вартість
|
||||||
|
number.field.scheduledDeliveryDate=Запланована дата доставки
|
||||||
|
number.field.recipientFullName=Повне ім'я Отримувача
|
||||||
|
number.field.cityRecipient=Місто Отримувача
|
||||||
|
number.field.warehouseRecipient=Відділення Отримувача
|
||||||
|
number.field.warehouseRecipientNumber=Номер відділення Отримувача
|
||||||
|
number.field.phoneRecipient=Номер телефону Отримувача
|
||||||
|
number.field.recipientAddress=Адреса Отримувача
|
||||||
|
number.field.citySender=Місто Відправника
|
||||||
|
number.field.phoneSender=Номер телефону Відправника
|
||||||
|
number.field.warehouseSender=Відділення Відправника
|
||||||
|
number.field.senderAddress=Адреса Відправника
|
||||||
|
number.field.fullData=Повні дані з сервера
|
||||||
|
number.field.created=Створено
|
||||||
|
number.field.updated=Оновлено
|
||||||
|
number.field.groupName=Ім'я групи
|
||||||
|
number.field.descr=Опис*
|
||||||
|
number.field.autoUpdated=Автоматичне оновлення
|
||||||
|
# Config window
|
||||||
|
config.title=Конфігурація:
|
||||||
|
config.label.url=API URL:
|
||||||
|
config.label.phone=Телефон:
|
||||||
|
config.label.language=Мова:
|
||||||
|
config.label.maxHistory=Записів у історії пошуку:
|
||||||
|
config.tooltip.maxHistory=Кількість записів у історії пошуку: від %d до %d\nНуль означає "Не зберігати історію"
|
||||||
|
config.label.maxLogRecords=Записів у журналі:
|
||||||
|
config.label.autoUpdate=Увімкнути автоматичне оновлення
|
||||||
|
config.alert.title=Error in config
|
||||||
|
config.alert.message.wrongApiUrl=У поле має бути правильний URL API НП
|
||||||
|
config.alert.message.wrongPhone=У поле має бути правильний номер телефону
|
||||||
|
# Detailed Info window
|
||||||
|
detail.title=Детально про номер %s
|
||||||
|
# Add Number window
|
||||||
|
add.title=Додавання нового номеру
|
||||||
|
add.label.number=Номер:
|
||||||
|
add.label.type=Тип:
|
||||||
|
add.label.phone=Телефон:
|
||||||
|
add.label.update=Автоматичне оновлення
|
||||||
|
add.label.another=Додати інший
|
||||||
|
add.label.comment=Коментар:
|
||||||
|
add.label.group=Група:
|
||||||
|
add.edit.comment.prompt=Коментар для нового номера ТТН (може бути порожнім)
|
||||||
|
add.alert.title.error=Помилка
|
||||||
|
add.alert.message.WrongNumber=Невірно введений номер
|
||||||
|
add.alert.message.NumberAlreadyAdded=Номер '%s' вже додано
|
||||||
|
add.alert.message.WrongPhone=Неправильний номер телефону
|
||||||
|
add.tooltip.AddPhone=Додати номер телефону до БД
|
||||||
|
add.tooltip.EditPhones=Редагувати всі номери телефонів
|
||||||
|
add.message.PhoneAdded=Телефон '%s' було додано до БД
|
||||||
|
add.message.PhoneExists=Телефон '%s' вже додано до БД
|
||||||
|
# Edit Phones window
|
||||||
|
edit.phones.title=Редагувати номери телефонів
|
||||||
|
edit.phones.dialog.title=Зміна номеру телефону
|
||||||
|
edit.phones.newPhone=Новий номер:
|
||||||
|
edit.phones.alert.title=Неправильний номер телефону '%s'
|
||||||
|
edit.phones.alert.message=Введено неправильний номер телефону.\nВиправте та спробуйте ще раз.
|
||||||
|
edit.phones.confirm.title=Підтвердження видалення
|
||||||
|
edit.phones.confirm.header=Підтвердіть видалення номеру '%s'
|
||||||
|
edit.phones.confirm.message=Ви дійсно хочете видалити вказаний номер?
|
||||||
|
edit.phones.alert.phoneUsed.title=Номер телефону '%s' використовується в ТТН
|
||||||
|
edit.phones.alert.phoneUsed.message=Номер телефону використовується в ТТН. Т.ч. його не можна видалити
|
||||||
|
# Edit Search Options window
|
||||||
|
edit.options.action.moveUp=Вгору
|
||||||
|
edit.options.action.moveDn=Вниз
|
||||||
|
edit.options.action.add=Додати
|
||||||
|
edit.options.action.edit=Редагувати
|
||||||
|
edit.options.action.apply=Підтвердити зміні
|
||||||
|
edit.options.action.remove=Видалити
|
||||||
|
edit.options.title=Редагувати налаштування пошуку
|
||||||
|
edit.options.confirm.title=Підтвердження видалення
|
||||||
|
edit.options.confirm.header=Підтвердіть видалення налаштувань пошуку '%s'
|
||||||
|
edit.options.confirm.message=Ви дійсно хочете видалити вказані налаштуваня пошуку?
|
||||||
|
edit.options.alert.title=Невірний параметр
|
||||||
|
edit.options.alert.message=Ім'я параметрів пошуку не може бути порожнім.\nВиправте та спробуйте ще раз.
|
||||||
|
edit.options.toast.message.applied=Зміни застосовано
|
||||||
|
edit.options.toast.message.noChanges=Змін не було зроблено
|
||||||
|
edit.options.toast.message.removed=Налаштування '%s' було видалено
|
||||||
|
edit.options.name.newOption=Нові налаштування пошуку
|
||||||
|
edit.options.label.name=Назва:
|
||||||
|
edit.options.label.text=Текст для пошуку:
|
||||||
|
# Edit Groups window
|
||||||
|
edit.groups.title=Редагувати групи
|
||||||
|
edit.groups.dialog.title=Редагування груп
|
||||||
|
edit.groups.newGroup=Ім'я нової групи:
|
||||||
|
edit.groups.alert.title=Група '%s' вже існує
|
||||||
|
edit.groups.alert.message=Група з таким іменем вже є.\nВведіт, будь ласка, нове ім'я групи.
|
||||||
|
edit.groups.confirm.title=Підтвердження видалення
|
||||||
|
edit.groups.confirm.header=Підтвердіть видалення групи '%s'
|
||||||
|
edit.groups.confirm.message==Ви дійсно хочете видалити вказану групу?
|
||||||
|
edit.groups.toast.message.removed=Групу '%s' було видалено
|
||||||
|
edit.groups.alert.notEmpty.title=Група '%s' не порожня
|
||||||
|
edit.groups.alert.notEmpty.message=Група містить %d ТТН.\nНепорожню групу видалити неможна.
|
||||||
|
# Search window
|
||||||
|
search.window.title=Пошук
|
||||||
|
search.fields.tooltip=Обрані для пошуку поля:\n%s
|
||||||
|
search.fields.tooltip.selectAll=Обрати всі поля
|
||||||
|
search.fields.tooltip.SelectNone=Очистити обрані поля
|
||||||
|
search.label.what=Що шукати:
|
||||||
|
search.edit.what.prompt=Введіть текст для пошуку
|
||||||
|
search.label.searchOptions=Шукати у:
|
||||||
|
search.button=Шукати
|
||||||
|
search.button.options=Налаштування пошуку
|
||||||
|
search.button.save=Зберегти налаштування пошуку
|
||||||
|
search.button.restore=Відновити налаштування пошуку
|
||||||
|
search.label.results=Результати пошуку
|
||||||
|
search.button.plugins.tooltip=Надіслати список до плагіну
|
||||||
|
search.button.simpleSearch=Простий пошук
|
||||||
|
search.button.extSearch=Розширений пошук
|
||||||
|
search.button.searchArchive=в архіві
|
||||||
|
search.button.sendAllItems=Усі ТТН
|
||||||
|
search.button.sendAllItems.tooltip=Надіслати до плагіну усі ТТН (якщо обрано) чи лише вибрані ТТН
|
||||||
|
search.alert.input.title=Назва пошуку
|
||||||
|
search.alert.input.header=Введіть нову назву для пошуку:
|
||||||
|
search.alert.input.content=Назва:
|
||||||
|
search.alert.error.header=Помилка зберігання налаштувань
|
||||||
|
search.alert.error.message.alreadyExists=Назва '%s' вже збережено. Будь ласка введіть нове.
|
||||||
|
search.alert.select.title=Вибір налаштувань
|
||||||
|
search.alert.select.header=Вибір назви налаштувань пошуку
|
||||||
|
search.alert.select.content=Виберіть назву:
|
||||||
|
search.alert.info.results.header=Результати пошуку
|
||||||
|
search.alert.info.results.content=За вашим запитом не знайдено жодного результату
|
||||||
|
search.log.numbersFound=За запитом '%s' знайдено %d ТТН
|
||||||
|
search.log.numbersNotFound=За запитом '%s' не знайдено жодного ТТН
|
||||||
|
search.log.searchMethodChanged=Результати пошуку очищено т.я. метод пошуку змінено з 'Шукати в архіві' на 'Звичайний пошук'
|
||||||
|
# search options pane
|
||||||
|
options.label.group=Група
|
||||||
|
options.label.groupName=Назва групи
|
||||||
|
options.label.weight=Вага
|
||||||
|
options.label.cost=Вартість
|
||||||
|
options.label.price=Оголошена вартість
|
||||||
|
options.label.seats=Кількість місць
|
||||||
|
options.label.numberStatus=Стан накладної
|
||||||
|
options.label.numberType=Тип накладної
|
||||||
|
options.label.status=Статус
|
||||||
|
options.label.createDate=Дата створення
|
||||||
|
options.label.scheduledDate=Планова доставка
|
||||||
|
# Main Menu
|
||||||
|
menu.group.number=Номери
|
||||||
|
menu.number.add=Додати номер
|
||||||
|
menu.number.update=Оновити номер
|
||||||
|
menu.number.updateUncompleted=Оновити незавершені номери
|
||||||
|
menu.number.moveToArchive=Перемістити до архіву
|
||||||
|
menu.number.addToCustom=Додати до обраних
|
||||||
|
menu.number.restoreFromArchive=Відновити з архіву
|
||||||
|
menu.number.exit=Вихід
|
||||||
|
menu.group.moveToGroup=Перемістити до групи
|
||||||
|
menu.group.edit=Змінити
|
||||||
|
menu.edit.newGroup=Нова група
|
||||||
|
menu.edit.editGroups=Змінити групи
|
||||||
|
menu.edit.editPhones=Змінити телефони
|
||||||
|
menu.edit.editSearchOptions=Змінити опції пошуку
|
||||||
|
menu.edit.search=Пошук
|
||||||
|
menu.edit.config=Конфігурація
|
||||||
|
menu.group.view=Вигляд
|
||||||
|
menu.group.viewMode=Перегляд
|
||||||
|
menu.group.filterMode=Фільтр
|
||||||
|
menu.view.detail=Детально
|
||||||
|
menu.view.showLog=Показати журнал
|
||||||
|
menu.group.plugins=Плагіни
|
||||||
|
menu.plugins.loadPlugins=Завантажити плагіни
|
||||||
|
menu.group.windows=Вікна
|
||||||
|
menu.windows.customList=Обрані номери
|
||||||
|
menu.windows.archivedList=Архівні номери
|
||||||
|
menu.windows.cascade=Показати всі каскадом
|
||||||
|
menu.windows.closeAll=Закрити всі
|
||||||
|
menu.group.help=Допомога
|
||||||
|
menu.help.about=Про додаток
|
||||||
|
menu.log.copy=Копіювати
|
||||||
|
menu.log.clear=Очистити
|
||||||
|
# Main window alerts
|
||||||
|
alert.firstLaunch.title=Перший запуск
|
||||||
|
alert.firstLaunch.header=Ласкаво прошу! Це перший запуск додатка.
|
||||||
|
alert.firstLaunch.message=Будь ласка, заповніть усі необхідні поля конфігурації.
|
||||||
|
alert.NoNumber.title=Немає незавершених номерів
|
||||||
|
alert.NoNumber.message=Жодного незавершеного номера у списку
|
||||||
|
alert.log.NoNumber.message=Автоматичне оновлення: Жодного незавершеного номера у списку
|
||||||
|
alert.CouldNotExit.title=Вихід неможливий
|
||||||
|
alert.CouldNotExit.message=Є відкриті вікна потенційно з незбереженими даними.\nЗакрийте їх та спробуйте ще раз
|
||||||
|
alert.archive.moveTo.header.numberExists=Помилка переміщення ТТН до архіву
|
||||||
|
alert.archive.moveTo.content.numberExists=ТТН '%s' вже є в архіві.\nСпершу видаліть цей ТТН з архіву та спробуйте ще раз.
|
||||||
|
alert.archive.restore.header.numberExists=Помилка відновлення номеру з архіву
|
||||||
|
alert.archive.restore.content.numberExists=ТТН '%s' вже є в основній БД.\nВідновлення неможливе.
|
||||||
|
alert.archive.restore.content.numberNotFoundInArchive=ТТН '%s' не знайдено в архіві
|
||||||
|
alert.archive.title.confirmDelete=Підтвердження видалення
|
||||||
|
alert.archive.header.confirmDelete=Ви впевнені, що ТТН '%s' потрібно видалити?\nЦе незворотня операція, відновити ТТН буде неможливо.
|
||||||
|
alert.log.number.movedToArchive=ТТН '%s' переміщено до архіву
|
||||||
|
alert.log.number.restoredFromArchive=ТТН '%s' відновлено з архіву
|
||||||
|
alert.log.gettingResponse=Помилка отримання даних:
|
||||||
|
alert.message.gettingResponse=Виникла помилка отримання даних з серверу
|
||||||
|
# Main window view modes
|
||||||
|
label.vm.tooltip=Перегляд
|
||||||
|
vm.numbers=Номери
|
||||||
|
vm.groups=Групи
|
||||||
|
vm.calendarUpdate=Календар (Оновлено)
|
||||||
|
vm.calendarCreate=Календар (Створено)
|
||||||
|
# Main window Filtering Mode
|
||||||
|
label.fm.filter.tooltip=Фільтр
|
||||||
|
fm.all=Всі
|
||||||
|
fm.uncompleted=Незавершені
|
||||||
|
fm.inbound=Вхідні
|
||||||
|
fm.outbound=Вихідні
|
||||||
|
# Add Group window
|
||||||
|
group.add.title=Додати нову групу
|
||||||
|
group.add.label.name=Назва:
|
||||||
|
group.alert.exists.title=Групу вже додано
|
||||||
|
group.alert.exists.message=Група '%s' вже існує
|
||||||
|
group.alert.EmptyName.title=Порожнє ім'я групи
|
||||||
|
group.alert.EmptyName.message=Ім'я групи не може бути порожнім
|
||||||
|
group.message.newGroup=Додано нову групу '%s'
|
||||||
|
group.message.movedToGroup=ТТН '%s' переміщено до групи '%s'
|
||||||
|
group.alert.cantMove.header=Неможливо перемістити ТТН
|
||||||
|
group.alert.cantMove.message=Неможливо перемістити ТТН '%s'\nдо групи т.я. він вже у групі
|
||||||
|
# List window commons
|
||||||
|
lw.menu.ctx.remove=Видалити
|
||||||
|
lw.menu.ctx.clear=Очистити
|
||||||
|
lw.alert.title=Підтвердження видалення
|
||||||
|
# Custom Number List window
|
||||||
|
cnl.title=Вікно обраних ТТН
|
||||||
|
cnl.label=Список номерів:
|
||||||
|
cnl.alert.message=Ви впевнені, що потрібно видалити %d обраних номерів зі списку обраних?
|
||||||
|
# Archived Number List window
|
||||||
|
anl.title=Вікно архівних ТТН
|
||||||
|
anl.label=Список номерів:
|
||||||
|
anl.alert.message=Ви впевнеі, що потрібно видалити %d номерів з архіву?
|
||||||
|
anl.alert.content=Цю операцію неможливо буде відмінити!
|
||||||
|
anl.log.numberRemoved=ТТН '%s' було повністю видалено
|
||||||
|
anl.log.numbersCleared=Було повністю видалено всі архівні ТТН
|
||||||
13
README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
## Nova Poshta: Tracker and Organizer
|
||||||
|
### _Desktop application to track, organize and manage parcels from Ukrainian delivery operator Nova Poshta_
|
||||||
|
|
||||||
|
[](https://www.java.com/) [](https://controlsfx.github.io) [](https://maven.apache.org/)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### ⏬ Getting
|
||||||
|
📖 Read [README.md](NovaPoshta/README.md)
|
||||||
|
|
||||||
|
You can download archive from [Releases section](https://github.com/anrydas/NovaPoshta/releases) or clone the repository.
|
||||||
|
|
||||||
|
Find full application's documentation at: [Ukrainian](NovaPoshta/help/uk/help.md) and [English](NovaPoshta/help/en/help.md).
|
||||||