update project.

This commit is contained in:
2026-02-20 10:40:36 -05:00
parent 00133c5979
commit 787f83a688
15 changed files with 69 additions and 73 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -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 auto.sync=true
build.scans.enabled=false build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir= connection.project.dir=
eclipse.preferences.version=1 eclipse.preferences.version=1
gradle.user.home= gradle.user.home=
java.home=C\:/Program Files/jdk-26 java.home=/usr/lib/jvm/java-25-openjdk
jvm.arguments= jvm.arguments=
offline.mode=false offline.mode=false
override.workspace.settings=true override.workspace.settings=true
BIN
View File
Binary file not shown.
+3 -17
View File
@@ -49,22 +49,8 @@ last_name TEXT,
email TEXT, email TEXT,
phone_no TEXT, phone_no TEXT,
street TEXT, street TEXT,
fk_CITY NUMBER, city TEXT,
fk_STATE NUMBER, state TEXT,
fk_ZIP NUMBER 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 = primaryStage;
stage.setTitle("Contacts View"); stage.setTitle("Contacts View");
Parent root = createView(); Parent root = createView();
Scene scene = new Scene(root, 600, 400); Scene scene = new Scene(root, 500, 360);
stage.setScene(scene); stage.setScene(scene);
stage.sizeToScene(); stage.sizeToScene();
@@ -65,7 +65,7 @@ public class ControlDDXDialog extends Dialog<Contact> {
private void setPropertyBindings(Contact ct) { private void setPropertyBindings(Contact ct) {
Logger.getLogger(getClass().getName()).log(Level.INFO, "setPropertyBindings called."); Logger.getLogger(getClass().getName()).log(Level.INFO, "setPropertyBindings called.");
if (ct == null) { if (ct == null) {
return; return;
} }
tfFirstName.setText(ct.getFirst_name()); tfFirstName.setText(ct.getFirst_name());
tfLastName.setText(ct.getLast_name()); tfLastName.setText(ct.getLast_name());
@@ -95,7 +95,7 @@ public class ControlDDXDialog extends Dialog<Contact> {
} }
private String getFirstName() { private String getFirstName() {
return String.format( "%s", tfFirstName.getText()); return String.format("%s", tfFirstName.getText());
} }
private String getLastName() { private String getLastName() {
@@ -27,8 +27,6 @@ import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.PickResult;
/** /**
* FXML Controller class * FXML Controller class
@@ -64,7 +62,7 @@ public class ViewController implements Initializable {
private int currentPageIndex = 0; private int currentPageIndex = 0;
private void log(String message) { 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 -> { contactView.setOnMouseClicked(e -> {
PickResult p = e.getPickResult();
Contact ct = contactView.getSelectionModel().getSelectedItem(); Contact ct = contactView.getSelectionModel().getSelectedItem();
ControlDDXDialog dialog = new ControlDDXDialog(ct); if (ct != null) {
Optional<Contact> result = dialog.showAndWait(); ControlDDXDialog dialog = new ControlDDXDialog(ct);
if (result.isPresent()) { Optional<Contact> result = dialog.showAndWait();
log("result is present."); if (result.isPresent()) {
// add to storage log("result is present.");
Contact updatedContact = (Contact) result.get(); // add to storage
try { Contact updatedContact = (Contact) result.get();
updatedContact.setId(ct.getId()); try {
ct.save(); updatedContact.setId(ct.getId());
} catch (Exception ex) { ct.save();
log(ex.getMessage()); } catch (Exception ex) {
log(ex.getMessage());
}
updatecontactView();
} }
updatecontactView();
} }
}); });
} }
@@ -17,14 +17,12 @@ import org.sqlite.SQLiteDataSource;
public final class DATASET { public final class DATASET {
private static Connection connection = null; 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) { if (connection == null) {
File rootDir = new File(String.format("%s", DataRepositoryConfig.getPath())); File rootDir = new File(String.format("%s", DataRepositoryConfig.getPath()));
Files.createDirectories(rootDir.toPath()); Files.createDirectories(rootDir.toPath());
SQLiteDataSource dataSource = new SQLiteDataSource(); SQLiteDataSource dataSource = new SQLiteDataSource();
dataSource.setUrl(String.format("jdbc:sqlite:%ssample.db", DataRepositoryConfig.getPath())); dataSource.setUrl(String.format("jdbc:sqlite:%ssample.db", DataRepositoryConfig.getPath()));
connection = dataSource.getConnection(); connection = dataSource.getConnection();
} }
return connection; return connection;
@@ -2,6 +2,8 @@ package edu.bookocontacts.model;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public final class MailAddress { public final class MailAddress {
@@ -19,25 +21,36 @@ public final class MailAddress {
public MailAddress(String addressline) { public MailAddress(String addressline) {
this("", "", "", ""); this("", "", "", "");
if (addressline != null) { if (addressline != null) {
try { addressline = addressline.trim();
if (!addressline.isBlank()) {
try {
String[] csz = addressline.split(",", 4); Pattern pattern = Pattern.compile("([0-9A-Za-z][^,]+)");
street = csz[0]; Matcher matcher = pattern.matcher(addressline);
city = csz[1]; if (matcher.find()) {
String[] csz2; street = matcher.group();
if (csz.length < 3) { matcher.find();
csz2 = csz[1].trim().split(" "); city = matcher.group();
matcher.find();
state = matcher.group();
if (matcher.find()) {
zip = matcher.group();
return;
}
}
city = csz2[0]; pattern = Pattern.compile("(\\w+)\\b");
state = csz2[1]; matcher = pattern.matcher(state);
zip = csz2[2]; 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());
} }
} }
} }
+16 -15
View File
@@ -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"> <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> <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"> <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>
<Font name="System Bold" size="16.0" /> <Font name="System Bold" size="16.0" />
</font> </font>
</Text> </Text>
<TextField id="txtSrch" fx:id="txtSrch" layoutX="236.0" layoutY="36.0" prefHeight="25.0" prefWidth="187.0" promptText="Search" /> <Button id="btnAdd" fx:id="btnAdd" layoutX="126.0" layoutY="35.0" mnemonicParsing="false" text="Add" textFill="#0052cc" textOverrun="CLIP" />
<Button id="btnDel" fx:id="btnDel" layoutX="427.0" layoutY="36.0" mnemonicParsing="false" text="Del" 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="btnSrch" fx:id="btnSrch" layoutX="174.0" layoutY="35.0" mnemonicParsing="false" text="Search" textFill="#0052cc" textOverrun="CLIP" /> <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> </children>
</AnchorPane> </AnchorPane>