use of javafx.beans.property.IntegerProperty in project bitsquare by bitsquare.
the class TradeDetailsWindow method addContent.
private void addContent() {
Offer offer = trade.getOffer();
Contract contract = trade.getContract();
int rows = 5;
addTitledGroupBg(gridPane, ++rowIndex, rows, "Trade");
boolean myOffer = tradeManager.isMyOffer(offer);
String fiatDirectionInfo;
String btcDirectionInfo;
if (tradeManager.isBuyer(offer)) {
addLabelTextField(gridPane, rowIndex, "Trade type:", formatter.getDirectionForBuyer(myOffer, offer.getCurrencyCode()), Layout.FIRST_ROW_DISTANCE);
fiatDirectionInfo = " to spend:";
btcDirectionInfo = " to receive:";
} else {
addLabelTextField(gridPane, rowIndex, "Trade type:", formatter.getDirectionForSeller(myOffer, offer.getCurrencyCode()), Layout.FIRST_ROW_DISTANCE);
fiatDirectionInfo = " to receive:";
btcDirectionInfo = " to spend:";
}
addLabelTextField(gridPane, ++rowIndex, "Bitcoin amount" + btcDirectionInfo, formatter.formatCoinWithCode(trade.getTradeAmount()));
addLabelTextField(gridPane, ++rowIndex, formatter.formatVolumeLabel(offer.getCurrencyCode()) + fiatDirectionInfo, formatter.formatVolumeWithCode(trade.getTradeVolume()));
addLabelTextField(gridPane, ++rowIndex, "Trade price:", formatter.formatPrice(trade.getTradePrice()));
addLabelTextField(gridPane, ++rowIndex, "Payment method:", BSResources.get(offer.getPaymentMethod().getId()));
// second group
rows = 5;
PaymentAccountContractData buyerPaymentAccountContractData = null;
PaymentAccountContractData sellerPaymentAccountContractData = null;
if (contract != null) {
rows++;
buyerPaymentAccountContractData = contract.getBuyerPaymentAccountContractData();
sellerPaymentAccountContractData = contract.getSellerPaymentAccountContractData();
if (buyerPaymentAccountContractData != null)
rows++;
if (sellerPaymentAccountContractData != null)
rows++;
if (buyerPaymentAccountContractData == null && sellerPaymentAccountContractData == null)
rows++;
}
if (trade.getTakeOfferFeeTxId() != null)
rows++;
if (trade.getDepositTx() != null)
rows++;
if (trade.getPayoutTx() != null)
rows++;
boolean showDisputedTx = disputeManager.findOwnDispute(trade.getId()).isPresent() && disputeManager.findOwnDispute(trade.getId()).get().getDisputePayoutTxId() != null;
if (showDisputedTx)
rows++;
if (trade.errorMessageProperty().get() != null)
rows += 2;
if (trade.getTradingPeerNodeAddress() != null)
rows++;
addTitledGroupBg(gridPane, ++rowIndex, rows, "Details", Layout.GROUP_DISTANCE);
addLabelTextFieldWithCopyIcon(gridPane, rowIndex, "Trade ID:", trade.getId(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++rowIndex, "Trade date:", formatter.formatDateTime(trade.getDate()));
addLabelTextField(gridPane, ++rowIndex, "Security deposit:", formatter.formatCoinWithCode(FeePolicy.getSecurityDeposit(offer)));
addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Selected arbitrator:", trade.getArbitratorNodeAddress().getFullAddress());
if (trade.getTradingPeerNodeAddress() != null)
addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Trading peers onion address:", trade.getTradingPeerNodeAddress().getFullAddress());
if (contract != null) {
if (buyerPaymentAccountContractData != null) {
TextFieldWithCopyIcon tf = addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "BTC buyer payment details:", BSResources.get(buyerPaymentAccountContractData.getPaymentDetails())).second;
tf.setTooltip(new Tooltip(tf.getText()));
}
if (sellerPaymentAccountContractData != null) {
TextFieldWithCopyIcon tf = addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "BTC seller payment details:", BSResources.get(sellerPaymentAccountContractData.getPaymentDetails())).second;
tf.setTooltip(new Tooltip(tf.getText()));
}
if (buyerPaymentAccountContractData == null && sellerPaymentAccountContractData == null)
addLabelTextField(gridPane, ++rowIndex, "Payment method:", BSResources.get(contract.getPaymentMethodName()));
}
addLabelTxIdTextField(gridPane, ++rowIndex, "Offer fee transaction ID:", offer.getOfferFeePaymentTxID());
if (trade.getTakeOfferFeeTxId() != null)
addLabelTxIdTextField(gridPane, ++rowIndex, "Taker fee transaction ID:", trade.getTakeOfferFeeTxId());
if (trade.getDepositTx() != null)
addLabelTxIdTextField(gridPane, ++rowIndex, "Deposit transaction ID:", trade.getDepositTx().getHashAsString());
if (trade.getPayoutTx() != null)
addLabelTxIdTextField(gridPane, ++rowIndex, "Payout transaction ID:", trade.getPayoutTx().getHashAsString());
if (showDisputedTx)
addLabelTxIdTextField(gridPane, ++rowIndex, "Disputed payout transaction ID:", disputeManager.findOwnDispute(trade.getId()).get().getDisputePayoutTxId());
if (contract != null) {
Button viewContractButton = addLabelButton(gridPane, ++rowIndex, "Contract in JSON format:", "View contract", 0).second;
viewContractButton.setDefaultButton(false);
viewContractButton.setOnAction(e -> {
TextArea textArea = new TextArea();
textArea.setText(trade.getContractAsJson());
String contractAsJson = trade.getContractAsJson();
contractAsJson += "\n\nBuyerMultiSigPubKeyHex: " + Utils.HEX.encode(contract.getBuyerMultiSigPubKey());
contractAsJson += "\nSellerMultiSigPubKeyHex: " + Utils.HEX.encode(contract.getSellerMultiSigPubKey());
textArea.setText(contractAsJson);
textArea.setPrefHeight(50);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setPrefSize(800, 600);
Scene viewContractScene = new Scene(textArea);
Stage viewContractStage = new Stage();
viewContractStage.setTitle("Contract for trade with ID: " + trade.getShortId());
viewContractStage.setScene(viewContractScene);
if (owner == null)
owner = MainView.getRootContainer();
Scene rootScene = owner.getScene();
viewContractStage.initOwner(rootScene.getWindow());
viewContractStage.initModality(Modality.NONE);
viewContractStage.initStyle(StageStyle.UTILITY);
viewContractStage.show();
Window window = rootScene.getWindow();
double titleBarHeight = window.getHeight() - rootScene.getHeight();
viewContractStage.setX(Math.round(window.getX() + (owner.getWidth() - viewContractStage.getWidth()) / 2) + 200);
viewContractStage.setY(Math.round(window.getY() + titleBarHeight + (owner.getHeight() - viewContractStage.getHeight()) / 2) + 50);
});
}
if (trade.errorMessageProperty().get() != null) {
textArea = addLabelTextArea(gridPane, ++rowIndex, "Error message:", "").second;
textArea.setText(trade.errorMessageProperty().get());
textArea.setEditable(false);
IntegerProperty count = new SimpleIntegerProperty(20);
int rowHeight = 10;
textArea.prefHeightProperty().bindBidirectional(count);
changeListener = (ov, old, newVal) -> {
if (newVal.intValue() > rowHeight)
count.setValue(count.get() + newVal.intValue() + 10);
};
textArea.scrollTopProperty().addListener(changeListener);
textArea.setScrollTop(30);
TextField state = addLabelTextField(gridPane, ++rowIndex, "Trade state:").second;
state.setText(trade.getState().getPhase().name());
}
Button cancelButton = addButtonAfterGroup(gridPane, ++rowIndex, "Close");
//TODO app wide focus
//cancelButton.requestFocus();
cancelButton.setOnAction(e -> {
closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
hide();
});
}
use of javafx.beans.property.IntegerProperty in project latexdraw by arnobl.
the class AlignDistribCmd method undo.
@Override
public void undo() {
final IntegerProperty pos = new SimpleIntegerProperty(0);
shape.ifPresent(gp -> {
gp.getShapes().forEach(sh -> {
// Reusing the old position.
final IPoint pt = sh.getTopLeftPoint();
final IPoint oldPt = oldPositions.get(pos.get());
if (!pt.equals(oldPt)) {
sh.translate(oldPt.getX() - pt.getX(), oldPt.getY() - pt.getY());
}
pos.set(pos.get() + 1);
});
gp.setModified(true);
});
}
use of javafx.beans.property.IntegerProperty in project Board-Instrumentation-Framework by intel.
the class LedBuilder method build.
public final Led build() {
final Led CONTROL = new Led();
for (String key : properties.keySet()) {
if ("prefSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("minSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("maxSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("prefWidth".equals(key)) {
CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
} else if ("prefHeight".equals(key)) {
CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
} else if ("minWidth".equals(key)) {
CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
} else if ("minHeight".equals(key)) {
CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
} else if ("maxWidth".equals(key)) {
CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
} else if ("maxHeight".equals(key)) {
CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
} else if ("scaleX".equals(key)) {
CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
} else if ("scaleY".equals(key)) {
CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
} else if ("layoutX".equals(key)) {
CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
} else if ("layoutY".equals(key)) {
CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
} else if ("translateX".equals(key)) {
CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
} else if ("translateY".equals(key)) {
CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
} else if ("styleClass".equals(key)) {
CONTROL.getStyleClass().setAll("led", ((StringProperty) properties.get(key)).get());
} else if ("ledColor".equals(key)) {
CONTROL.setLedColor(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("on".equals(key)) {
CONTROL.setOn(((BooleanProperty) properties.get(key)).get());
} else if ("blinking".equals(key)) {
CONTROL.setBlinking(((BooleanProperty) properties.get(key)).get());
} else if ("interval".equals(key)) {
CONTROL.setInterval(((IntegerProperty) properties.get(key)).get());
} else if ("frameVisible".equals(key)) {
CONTROL.setFrameVisible(((BooleanProperty) properties.get(key)).get());
}
}
return CONTROL;
}
use of javafx.beans.property.IntegerProperty in project Board-Instrumentation-Framework by intel.
the class SixteenSegmentBuilder method build.
public final SixteenSegment build() {
final SixteenSegment CONTROL = new SixteenSegment();
for (String key : properties.keySet()) {
if ("prefSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("minSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("maxSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("prefWidth".equals(key)) {
CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
} else if ("prefHeight".equals(key)) {
CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
} else if ("minWidth".equals(key)) {
CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
} else if ("minHeight".equals(key)) {
CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
} else if ("maxWidth".equals(key)) {
CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
} else if ("maxHeight".equals(key)) {
CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
} else if ("scaleX".equals(key)) {
CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
} else if ("scaleY".equals(key)) {
CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
} else if ("layoutX".equals(key)) {
CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
} else if ("layoutY".equals(key)) {
CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
} else if ("translateX".equals(key)) {
CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
} else if ("translateY".equals(key)) {
CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
} else if ("styleClass".equals(key)) {
CONTROL.getStyleClass().setAll("sixteen-segment", ((StringProperty) properties.get(key)).get());
} else if ("segmentStyle".equals(key)) {
CONTROL.setSegmentStyle(((ObjectProperty<SixteenSegment.SegmentStyle>) properties.get(key)).get());
} else if ("characterString".equals(key)) {
CONTROL.setCharacter(((StringProperty) properties.get(key)).get());
} else if ("characterChar".equals(key)) {
CONTROL.setCharacter(((ObjectProperty<Character>) properties.get(key)).get());
} else if ("characterInt".equals(key)) {
CONTROL.setCharacter(((IntegerProperty) properties.get(key)).get());
} else if ("dotOn".equals(key)) {
CONTROL.setDotOn(((BooleanProperty) properties.get(key)).get());
}
}
return CONTROL;
}
use of javafx.beans.property.IntegerProperty in project Board-Instrumentation-Framework by intel.
the class RadialBuilder method build.
public final Radial build() {
final Radial CONTROL = new Radial();
// Make sure that sections and markers will be added first
if (properties.keySet().contains("sectionsArray")) {
CONTROL.setSections(((ObjectProperty<Section[]>) properties.get("sectionsArray")).get());
}
if (properties.keySet().contains("sectionsList")) {
CONTROL.setSections(((ObjectProperty<List<Section>>) properties.get("sectionsList")).get());
}
if (properties.keySet().contains("areasArray")) {
CONTROL.setAreas(((ObjectProperty<Section[]>) properties.get("areasArray")).get());
}
if (properties.keySet().contains("areasList")) {
CONTROL.setAreas(((ObjectProperty<List<Section>>) properties.get("areasList")).get());
}
properties.forEach((key, property) -> {
if ("prefSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("minSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("maxSize".equals(key)) {
Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
} else if ("prefWidth".equals(key)) {
CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
} else if ("prefHeight".equals(key)) {
CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
} else if ("minWidth".equals(key)) {
CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
} else if ("minHeight".equals(key)) {
CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
} else if ("maxWidth".equals(key)) {
CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
} else if ("maxHeight".equals(key)) {
CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
} else if ("scaleX".equals(key)) {
CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
} else if ("scaleY".equals(key)) {
CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
} else if ("layoutX".equals(key)) {
CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
} else if ("layoutY".equals(key)) {
CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
} else if ("translateX".equals(key)) {
CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
} else if ("translateY".equals(key)) {
CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
} else if ("styleClass".equals(key)) {
CONTROL.getStyleClass().setAll("gauge");
CONTROL.getStyleClass().addAll(((ObjectProperty<String[]>) properties.get(key)).get());
} else if ("minValue".equals(key)) {
CONTROL.setMinValue(((DoubleProperty) properties.get(key)).get());
} else if ("maxValue".equals(key)) {
CONTROL.setMaxValue(((DoubleProperty) properties.get(key)).get());
} else if ("value".equals(key)) {
CONTROL.setValue(((DoubleProperty) properties.get(key)).get());
} else if ("decimals".equals(key)) {
CONTROL.setDecimals(((IntegerProperty) properties.get(key)).get());
} else if ("title".equals(key)) {
CONTROL.setTitle(((StringProperty) properties.get(key)).get());
} else if ("unit".equals(key)) {
CONTROL.setUnit(((StringProperty) properties.get(key)).get());
} else if ("animated".equals(key)) {
CONTROL.setAnimated(((BooleanProperty) properties.get(key)).get());
} else if ("animationDuration".equals(key)) {
CONTROL.setAnimationDuration(((DoubleProperty) properties.get(key)).get());
} else if ("startAngle".equals(key)) {
CONTROL.setStartAngle(((DoubleProperty) properties.get(key)).get());
} else if ("angleRange".equals(key)) {
CONTROL.setAngleRange(((DoubleProperty) properties.get(key)).get());
} else if ("autoScale".equals(key)) {
CONTROL.setAutoScale(((BooleanProperty) properties.get(key)).get());
} else if ("ledColor".equals(key)) {
CONTROL.setLedColor(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("ledVisible".equals(key)) {
CONTROL.setLedVisible(((BooleanProperty) properties.get(key)).get());
} else if ("lcdVisible".equals(key)) {
CONTROL.setLcdVisible(((BooleanProperty) properties.get(key)).get());
} else if ("needleColor".equals(key)) {
CONTROL.setNeedleColor(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("tickLabelOrientation".equals(key)) {
CONTROL.setTickLabelOrientation(((ObjectProperty<Radial.TickLabelOrientation>) properties.get(key)).get());
} else if ("numberFormat".equals(key)) {
CONTROL.setNumberFormat(((ObjectProperty<Radial.NumberFormat>) properties.get(key)).get());
} else if ("majorTickSpace".equals(key)) {
CONTROL.setMajorTickSpace(((DoubleProperty) properties.get(key)).get());
} else if ("minorTickSpace".equals(key)) {
CONTROL.setMinorTickSpace(((DoubleProperty) properties.get(key)).get());
} else if ("tickLabelFill".equals(key)) {
CONTROL.setTickLabelFill(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("tickMarkFill".equals(key)) {
CONTROL.setTickMarkFill(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("style".equals(key)) {
CONTROL.setStyle(((StringProperty) properties.get(key)).get());
} else if ("frameSizeFactor".equals(key)) {
CONTROL.setFrameSizeFactor(((DoubleProperty) properties.get(key)).get());
} else if ("sectionFill0".equals(key)) {
CONTROL.setSectionFill0(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill1".equals(key)) {
CONTROL.setSectionFill1(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill2".equals(key)) {
CONTROL.setSectionFill2(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill3".equals(key)) {
CONTROL.setSectionFill3(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill4".equals(key)) {
CONTROL.setSectionFill4(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill5".equals(key)) {
CONTROL.setSectionFill5(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill6".equals(key)) {
CONTROL.setSectionFill6(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill7".equals(key)) {
CONTROL.setSectionFill7(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill8".equals(key)) {
CONTROL.setSectionFill8(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("sectionFill9".equals(key)) {
CONTROL.setSectionFill9(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill0".equals(key)) {
CONTROL.setAreaFill0(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill1".equals(key)) {
CONTROL.setAreaFill1(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill2".equals(key)) {
CONTROL.setAreaFill2(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill3".equals(key)) {
CONTROL.setAreaFill3(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill4".equals(key)) {
CONTROL.setAreaFill4(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill5".equals(key)) {
CONTROL.setAreaFill5(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill6".equals(key)) {
CONTROL.setAreaFill6(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill7".equals(key)) {
CONTROL.setAreaFill7(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill8".equals(key)) {
CONTROL.setAreaFill8(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("areaFill9".equals(key)) {
CONTROL.setAreaFill9(((ObjectProperty<Color>) properties.get(key)).get());
}
});
return CONTROL;
}
Aggregations