update project.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,11 +1,11 @@
|
||||
arguments=--init-script C\:\\Users\\sherw\\AppData\\Roaming\\VSCodium\\User\\globalStorage\\redhat.java\\1.52.0\\config_win\\org.eclipse.osgi\\58\\0\\.cp\\gradle\\init\\init.gradle --init-script C\:\\Users\\sherw\\AppData\\Roaming\\VSCodium\\User\\globalStorage\\redhat.java\\1.52.0\\config_win\\org.eclipse.osgi\\58\\0\\.cp\\gradle\\protobuf\\init.gradle
|
||||
arguments=--init-script /home/sherwinp/.config/VSCodium/User/globalStorage/redhat.java/1.50.0/config_linux/org.eclipse.osgi/58/0/.cp/gradle/init/init.gradle --init-script /home/sherwinp/.config/VSCodium/User/globalStorage/redhat.java/1.50.0/config_linux/org.eclipse.osgi/58/0/.cp/gradle/protobuf/init.gradle
|
||||
auto.sync=true
|
||||
build.scans.enabled=false
|
||||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
||||
connection.project.dir=
|
||||
eclipse.preferences.version=1
|
||||
gradle.user.home=
|
||||
java.home=C\:/Program Files/jdk-26
|
||||
java.home=/usr/lib/jvm/java-25-openjdk
|
||||
jvm.arguments=
|
||||
offline.mode=false
|
||||
override.workspace.settings=true
|
||||
|
||||
Binary file not shown.
+3
-17
@@ -49,22 +49,8 @@ last_name TEXT,
|
||||
email TEXT,
|
||||
phone_no TEXT,
|
||||
street TEXT,
|
||||
fk_CITY NUMBER,
|
||||
fk_STATE NUMBER,
|
||||
fk_ZIP NUMBER
|
||||
city TEXT,
|
||||
state TEXT,
|
||||
zip TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE CITY (
|
||||
ID NUMBER,
|
||||
CITY TEXT
|
||||
)
|
||||
|
||||
CREATE TABLE STATE (
|
||||
ID NUMBER,
|
||||
state TEXT
|
||||
)
|
||||
|
||||
CREATE TABLE ZIP (
|
||||
ID NUMBER,
|
||||
zip TEXT
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ public class AppSceneView extends Application {
|
||||
stage = primaryStage;
|
||||
stage.setTitle("Contacts View");
|
||||
Parent root = createView();
|
||||
Scene scene = new Scene(root, 600, 400);
|
||||
Scene scene = new Scene(root, 500, 360);
|
||||
stage.setScene(scene);
|
||||
stage.sizeToScene();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ControlDDXDialog extends Dialog<Contact> {
|
||||
private void setPropertyBindings(Contact ct) {
|
||||
Logger.getLogger(getClass().getName()).log(Level.INFO, "setPropertyBindings called.");
|
||||
if (ct == null) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
tfFirstName.setText(ct.getFirst_name());
|
||||
tfLastName.setText(ct.getLast_name());
|
||||
@@ -95,7 +95,7 @@ public class ControlDDXDialog extends Dialog<Contact> {
|
||||
}
|
||||
|
||||
private String getFirstName() {
|
||||
return String.format( "%s", tfFirstName.getText());
|
||||
return String.format("%s", tfFirstName.getText());
|
||||
}
|
||||
|
||||
private String getLastName() {
|
||||
|
||||
@@ -27,8 +27,6 @@ import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.input.PickResult;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
@@ -64,7 +62,7 @@ public class ViewController implements Initializable {
|
||||
private int currentPageIndex = 0;
|
||||
|
||||
private void log(String message) {
|
||||
logger.log(Level.INFO, message);
|
||||
logger.log(Level.FINE, message);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,23 +140,23 @@ public class ViewController implements Initializable {
|
||||
|
||||
contactView.setOnMouseClicked(e -> {
|
||||
|
||||
PickResult p = e.getPickResult();
|
||||
Contact ct = contactView.getSelectionModel().getSelectedItem();
|
||||
ControlDDXDialog dialog = new ControlDDXDialog(ct);
|
||||
Optional<Contact> result = dialog.showAndWait();
|
||||
if (result.isPresent()) {
|
||||
log("result is present.");
|
||||
// add to storage
|
||||
Contact updatedContact = (Contact) result.get();
|
||||
try {
|
||||
updatedContact.setId(ct.getId());
|
||||
ct.save();
|
||||
} catch (Exception ex) {
|
||||
log(ex.getMessage());
|
||||
if (ct != null) {
|
||||
ControlDDXDialog dialog = new ControlDDXDialog(ct);
|
||||
Optional<Contact> result = dialog.showAndWait();
|
||||
if (result.isPresent()) {
|
||||
log("result is present.");
|
||||
// add to storage
|
||||
Contact updatedContact = (Contact) result.get();
|
||||
try {
|
||||
updatedContact.setId(ct.getId());
|
||||
ct.save();
|
||||
} catch (Exception ex) {
|
||||
log(ex.getMessage());
|
||||
}
|
||||
updatecontactView();
|
||||
}
|
||||
updatecontactView();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -17,14 +17,12 @@ import org.sqlite.SQLiteDataSource;
|
||||
public final class DATASET {
|
||||
private static Connection connection = null;
|
||||
|
||||
public static synchronized Connection getConnection() throws IOException, SQLException {
|
||||
private final static synchronized Connection getConnection() throws IOException, SQLException {
|
||||
if (connection == null) {
|
||||
File rootDir = new File(String.format("%s", DataRepositoryConfig.getPath()));
|
||||
Files.createDirectories(rootDir.toPath());
|
||||
|
||||
SQLiteDataSource dataSource = new SQLiteDataSource();
|
||||
dataSource.setUrl(String.format("jdbc:sqlite:%ssample.db", DataRepositoryConfig.getPath()));
|
||||
|
||||
connection = dataSource.getConnection();
|
||||
}
|
||||
return connection;
|
||||
|
||||
@@ -2,6 +2,8 @@ package edu.bookocontacts.model;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class MailAddress {
|
||||
|
||||
@@ -19,25 +21,36 @@ public final class MailAddress {
|
||||
public MailAddress(String addressline) {
|
||||
this("", "", "", "");
|
||||
if (addressline != null) {
|
||||
try {
|
||||
addressline = addressline.trim();
|
||||
if (!addressline.isBlank()) {
|
||||
try {
|
||||
|
||||
String[] csz = addressline.split(",", 4);
|
||||
street = csz[0];
|
||||
city = csz[1];
|
||||
String[] csz2;
|
||||
if (csz.length < 3) {
|
||||
csz2 = csz[1].trim().split(" ");
|
||||
Pattern pattern = Pattern.compile("([0-9A-Za-z][^,]+)");
|
||||
Matcher matcher = pattern.matcher(addressline);
|
||||
if (matcher.find()) {
|
||||
street = matcher.group();
|
||||
matcher.find();
|
||||
city = matcher.group();
|
||||
matcher.find();
|
||||
state = matcher.group();
|
||||
if (matcher.find()) {
|
||||
zip = matcher.group();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
city = csz2[0];
|
||||
state = csz2[1];
|
||||
zip = csz2[2];
|
||||
pattern = Pattern.compile("(\\w+)\\b");
|
||||
matcher = pattern.matcher(state);
|
||||
if (matcher.find()) {
|
||||
state = matcher.group();
|
||||
if (matcher.find()) {
|
||||
zip = matcher.group();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.INFO, e.getMessage());
|
||||
}
|
||||
logger.log(Level.INFO, this.toString());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.INFO, e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,25 +12,26 @@
|
||||
|
||||
<AnchorPane id="AnchorPane" prefHeight="383.0" prefWidth="565.0" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="edu.bookocontacts.ViewController">
|
||||
<children>
|
||||
<TableView fx:id="contactView" layoutX="1.0" layoutY="76.0" prefHeight="226.0" prefWidth="564.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="contactViewIdCol" maxWidth="5000.0" minWidth="10.0" prefWidth="116.0" resizable="true" text="Id"/>
|
||||
<TableColumn fx:id="contactViewNameCol" maxWidth="5000.0" minWidth="10.0" prefWidth="124.0" resizable="true" text="Name" />
|
||||
<TableColumn fx:id="contactViewPhoneNoCol" maxWidth="5000.0" minWidth="10.0" prefWidth="93.0" resizable="true" text="Phone" />
|
||||
</columns>
|
||||
</TableView>
|
||||
<HBox layoutX="85.0" layoutY="290.0" prefHeight="64.0" prefWidth="400.0">
|
||||
<children>
|
||||
<Pagination fx:id="pagination" prefHeight="65.0" prefWidth="380.0" />
|
||||
</children></HBox>
|
||||
<Button id="btnAdd" fx:id="btnAdd" layoutX="126.0" layoutY="35.0" mnemonicParsing="false" text="Add" textFill="#0052cc" textOverrun="CLIP" />
|
||||
<Text fill="#1400ff" layoutX="25.0" layoutY="33.0" scaleX="1.393175914330746" scaleY="1.5976504915765308" strokeType="OUTSIDE" strokeWidth="0.0" text="Contacts" wrappingWidth="85.3748550415039">
|
||||
<font>
|
||||
<Font name="System Bold" size="16.0" />
|
||||
</font>
|
||||
</Text>
|
||||
<TextField id="txtSrch" fx:id="txtSrch" layoutX="236.0" layoutY="36.0" prefHeight="25.0" prefWidth="187.0" promptText="Search" />
|
||||
<Button id="btnDel" fx:id="btnDel" layoutX="427.0" layoutY="36.0" mnemonicParsing="false" text="Del" textFill="#0052cc" textOverrun="CLIP" />
|
||||
<Button id="btnSrch" fx:id="btnSrch" layoutX="174.0" layoutY="35.0" mnemonicParsing="false" text="Search" textFill="#0052cc" textOverrun="CLIP" />
|
||||
<Button id="btnAdd" fx:id="btnAdd" layoutX="126.0" layoutY="35.0" mnemonicParsing="false" text="Add" textFill="#0052cc" textOverrun="CLIP" />
|
||||
<TextField id="txtSrch" fx:id="txtSrch" layoutX="236.0" layoutY="36.0" prefHeight="25.0" prefWidth="187.0" promptText="Search" />
|
||||
<Button id="btnDel" fx:id="btnDel" layoutX="427.0" layoutY="36.0" mnemonicParsing="false" text="Del" textFill="#0052cc" textOverrun="CLIP" />
|
||||
<Button id="btnSrch" fx:id="btnSrch" layoutX="174.0" layoutY="35.0" mnemonicParsing="false" text="Search" textFill="#0052cc" textOverrun="CLIP" />
|
||||
<TableView fx:id="contactView" layoutX="6.0" layoutY="76.0" prefHeight="180.0" prefWidth="464.0">
|
||||
<columns>
|
||||
<TableColumn fx:id="contactViewIdCol" maxWidth="5000.0" minWidth="10.0" prefWidth="100.0" resizable="true" text="Id"/>
|
||||
<TableColumn fx:id="contactViewNameCol" maxWidth="5000.0" minWidth="10.0" prefWidth="124.0" resizable="true" text="Name" />
|
||||
<TableColumn fx:id="contactViewPhoneNoCol" maxWidth="5000.0" minWidth="10.0" prefWidth="93.0" resizable="true" text="Phone" />
|
||||
</columns>
|
||||
</TableView>
|
||||
<HBox layoutX="64.0" layoutY="272.0" prefHeight="64.0" prefWidth="400.0">
|
||||
<children>
|
||||
<Pagination fx:id="pagination" prefHeight="65.0" prefWidth="380.0" />
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
||||
Reference in New Issue
Block a user