Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction #73

Merged
merged 6 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions desktop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@
<configuration>
<type>DEB</type>
<linuxShortcut>true</linuxShortcut>
<linuxPackageName>unigrid</linuxPackageName>
<linuxAppCategory>Network</linuxAppCategory>
<linuxMenuGroup>Network</linuxMenuGroup>
<icon>${project.basedir}/../fx/src/main/resources/org/unigrid/janus/view/images/unigrid-1024x1024.png</icon>
<linuxPackageName>janus</linuxPackageName>
<linuxAppCategory>Utilities</linuxAppCategory>
<linuxMenuGroup>Utilities</linuxMenuGroup>
<icon>${project.basedir}/../fx/src/main/resources/org/unigrid/janus/view/images/unigrid-1024x1024.png</icon>
</configuration>
</execution>
</executions>
Expand Down
2 changes: 2 additions & 0 deletions fx/src/main/java/org/unigrid/janus/Janus.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ private void startMainWindow() {
debug.setListView((ListView) window.lookup("lstDebug"));

} catch (Exception e) {
System.out.print("error: " + e.getMessage());
System.out.print("error: " + e.getCause().toString());
Alert a = new Alert(AlertType.ERROR,
e.getMessage(),
ButtonType.OK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ of the License (see COPYING and COPYING.addendum).
import javafx.scene.paint.Paint;
import javafx.scene.text.Text;
import javafx.util.Callback;

import org.apache.commons.lang3.SystemUtils;
import org.controlsfx.control.Notifications;
import org.kordamp.ikonli.javafx.FontIcon;
Expand Down Expand Up @@ -89,52 +88,52 @@ public void initialize(URL url, ResourceBundle rb) {
private void setupAddressList() {
try {
colAddress.setCellValueFactory(
new Callback<TableColumn.CellDataFeatures<Address, Hyperlink>, ObservableValue<Hyperlink>>() {
public ObservableValue<Hyperlink> call(TableColumn.CellDataFeatures<Address, Hyperlink> t) {
Address address = t.getValue();
String text = address.getAddress();

Hyperlink link = new Hyperlink();
link.setText(text);
link.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
if (e.getTarget().equals(link)) {
window.browseURL("https://explorer"
+ ".unigrid.org/address/"
+ address.getAddress());
}
}
});
Button btn = new Button();
FontIcon fontIcon = new FontIcon("fas-clipboard");
fontIcon.setIconColor(Paint.valueOf("#FFFFFF"));
btn.setGraphic(fontIcon);
btn.setOnAction((ActionEvent event) -> {
final Clipboard cb = Clipboard.getSystemClipboard();
final ClipboardContent content = new ClipboardContent();
content.putString(address.getAddress());
cb.setContent(content);
if (SystemUtils.IS_OS_MAC_OSX) {
Notifications
.create()
.title("Address copied to clipboard")
.text(address.getAddress())
.position(Pos.TOP_RIGHT)
.showInformation();
} else {
Notifications
.create()
.title("Address copied to clipboard")
.text(address.getAddress())
.showInformation();
}
});
link.setGraphic(btn);
link.setAlignment(Pos.CENTER_RIGHT);
return new ReadOnlyObjectWrapper(link);
}
});
new Callback<TableColumn.CellDataFeatures<Address, Hyperlink>,
ObservableValue<Hyperlink>>() {
public ObservableValue<Hyperlink> call(TableColumn.CellDataFeatures<Address,
Hyperlink> t) {
Address address = t.getValue();
String text = address.getAddress();

Hyperlink link = new Hyperlink();
link.setText(text);
link.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
window.browseURL("https://explorer"
+ ".unigrid.org/address/"
+ address.getAddress());
}
});
Button btn = new Button();
FontIcon fontIcon = new FontIcon("fas-clipboard");
fontIcon.setIconColor(Paint.valueOf("#FFFFFF"));
btn.setGraphic(fontIcon);
btn.setOnAction((ActionEvent event) -> {
final Clipboard cb = Clipboard.getSystemClipboard();
final ClipboardContent content = new ClipboardContent();
content.putString(address.getAddress());
cb.setContent(content);
if (SystemUtils.IS_OS_MAC_OSX) {
Notifications
.create()
.title("Address copied to clipboard")
.text(address.getAddress())
.position(Pos.TOP_RIGHT)
.showInformation();
} else {
Notifications
.create()
.title("Address copied to clipboard")
.text(address.getAddress())
.showInformation();
}
});
link.setGraphic(btn);
link.setAlignment(Pos.CENTER_RIGHT);
return new ReadOnlyObjectWrapper(link);
}
});
colAddressBalance.setCellValueFactory(
new PropertyValueFactory<Address, String>("amount"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ of the License (see COPYING and COPYING.addendum).
import java.io.File;
import java.util.ResourceBundle;
import java.util.Optional;
import javafx.animation.FadeTransition;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.stage.FileChooser;
Expand All @@ -45,6 +46,7 @@ of the License (see COPYING and COPYING.addendum).
import javafx.scene.layout.BorderStroke;
import javafx.scene.layout.BorderStrokeStyle;
import javafx.scene.layout.CornerRadii;
import javafx.util.Duration;
import org.unigrid.janus.model.DataDirectory;
import org.unigrid.janus.model.JanusModel;
import org.unigrid.janus.model.service.DebugService;
Expand Down Expand Up @@ -84,6 +86,7 @@ public class SettingsController implements Initializable, PropertyChangeListener
@FXML private Label txtPassphraseTwo;
@FXML private Label txtPassWarningOne;
@FXML private Label txtPassWarningTwo;
@FXML private Label txtErrorMessage;

@Override
public void initialize(URL url, ResourceBundle rb) {
Expand Down
9 changes: 8 additions & 1 deletion fx/src/main/java/org/unigrid/janus/model/DataDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,12 @@ public static File getConfigFile() {
public static File getGridnodeFile() {
return Paths.get(get(), GRIDNODE_FILE).toFile();
}


public static File getBackendLog() {
return Paths.get(get(), "debug.log").toFile();
}

public static File getWalletLog() {
return Paths.get(get(), "wallet.log").toFile();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public int isDuplicate(Transaction trans, boolean beginning) {
} catch (Exception e) {
debug.log(String.format("ERROR: (TransactionList isDuplicate) %s", e.getMessage()));
}
debug.print("is duplicate transaction index: " + result, TransactionList.class.getSimpleName());
return result;
}

Expand Down Expand Up @@ -114,7 +115,7 @@ public boolean addTransaction(int index, Transaction trans) {
boolean result = false;
try {
boolean beginning = (index == 0);
int idx = isDuplicate(trans, beginning);
int idx = -1; //isDuplicate(trans, beginning);
if (idx != -1) {
// TODO: check for multipart and add, or create multipart if needed.
Transaction t = transactions.get(idx);
Expand Down
4 changes: 2 additions & 2 deletions fx/src/main/java/org/unigrid/janus/model/service/Daemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class Daemon {
private Optional<Process> process = Optional.empty();

private static final String[] LOCATIONS = new String[] {
System.getProperty("user.dir"),
"/usr/bin/",
System.getProperty("user.dir") + "/",
"/usr/bin/",
"/opt/bin/",
"/opt/unigrid/bin/",
System.getProperty("user.dir") + "/runtime/bin/",
Expand Down
3 changes: 2 additions & 1 deletion fx/src/main/resources/org/unigrid/janus/view/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
.table-view .table-cell {
-fx-text-fill: #aad;
-fx-text-alignment: right;
-fx-border-color: transparent #aad transparent transparent;
-fx-alingnment: center-rigth;
-fx-border-color: transparent #aad transparent transparent;
}

.table-view .table-cell .button {
Expand Down
9 changes: 6 additions & 3 deletions fx/src/main/resources/org/unigrid/janus/view/settings.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<children>
<AnchorPane>
<children>
<Label text="Conf file" textFill="#ee7722">
<Label text="Configuration file" textFill="#ee7722">
<font>
<Font size="18.0" />
</font>
Expand Down Expand Up @@ -83,6 +83,9 @@
<opaqueInsets>
<Insets top="20.0" />
</opaqueInsets>
<VBox.margin>
<Insets bottom="20.0" />
</VBox.margin>
</Button>
<AnchorPane>
<children>
Expand Down Expand Up @@ -251,7 +254,7 @@
<left>
<VBox alignment="TOP_RIGHT" prefHeight="200.0" prefWidth="100.0" styleClass="sidebar" BorderPane.alignment="TOP_RIGHT">
<children>
<ToggleButton alignment="CENTER_RIGHT" mnemonicParsing="false" onMouseClicked="#onSetGeneralTap" prefWidth="100.0" text="General">
<ToggleButton alignment="CENTER_RIGHT" mnemonicParsing="false" onMouseClicked="#onSetGeneralTap" prefWidth="100.0" selected="true" text="General">
<toggleGroup>
<ToggleGroup fx:id="settings" />
</toggleGroup>
Expand All @@ -270,7 +273,7 @@
<Insets bottom="3.0" left="8.0" right="8.0" top="3.0" />
</padding>
</ToggleButton>
<ToggleButton alignment="CENTER_RIGHT" mnemonicParsing="false" onMouseClicked="#onSetExportTap" prefWidth="100.0" selected="true" text="Import/Export" toggleGroup="$settings">
<ToggleButton alignment="CENTER_RIGHT" mnemonicParsing="false" onMouseClicked="#onSetExportTap" prefWidth="100.0" text="Import/Export" toggleGroup="$settings">
<VBox.margin>
<Insets bottom="4.0" />
</VBox.margin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<?import javafx.scene.layout.VBox?>
<?import org.unigrid.janus.view.component.PTableColumn?>

<AnchorPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.unigrid.janus.controller.view.TransactionsController">
<AnchorPane stylesheets="@main.css" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.unigrid.janus.controller.view.TransactionsController">
<children>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="300.0" prefWidth="450.0" style="-fx-background-color: linear-gradient(from 75px 75px to 200px 150px, #00001c, #000024);" stylesheets="@main.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<TableView fx:id="tblTransactions" VBox.vgrow="ALWAYS">
<TableView fx:id="tblTransactions" stylesheets="@main.css" VBox.vgrow="ALWAYS">
<columns>
<PTableColumn fx:id="colTransAddress" editable="false" percentageWidth="0.41" prefWidth="170.0" sortable="false" text="Address" />
<PTableColumn fx:id="colTransAmount" editable="false" percentageWidth="0.15" prefWidth="75.0" sortable="false" text="Amount" />
Expand Down
60 changes: 0 additions & 60 deletions nbactions.xml

This file was deleted.