Grundlegende Funktionen von Athar erstellt

master
Abbas 2024-06-29 16:08:09 +02:00
commit 69ba157b30
17 changed files with 2294 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
PR2 KI Projekt/.gitignore vendored 100644
View File

@ -0,0 +1 @@
/bin/

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PR2 KI Projekt</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -0,0 +1,40 @@
class Customer {
private int id;
private String name;
private String address;
private String contact;
private String segment;
public Customer(int id, String name, String address, String contact, String segment) {
this.id = id;
this.name = name;
this.address = address;
this.contact = contact;
this.segment = segment;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getAddress() {
return address;
}
public String getContact() {
return contact;
}
public String getSegment() {
return segment;
}
@Override
public String toString() {
return name;
}
}

View File

@ -0,0 +1,18 @@
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.*;
class CustomerCellRenderer extends DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (component instanceof JLabel && value instanceof Customer) {
JLabel label = (JLabel) component;
Customer customer = (Customer) value;
label.setText(customer.getName());
}
return component;
}
}

View File

@ -0,0 +1,21 @@
import java.awt.*;
import javax.swing.*;
class EmployeeCellRenderer extends JLabel implements ListCellRenderer<Employee> {
@Override
public Component getListCellRendererComponent(JList<? extends Employee> list, Employee value, int index, boolean isSelected, boolean cellHasFocus) {
setText(value.getName() + " - " + value.getPosition());
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
setEnabled(list.isEnabled());
setFont(list.getFont());
setOpaque(true);
return this;
}
}

View File

@ -0,0 +1,35 @@
class Employee {
private int id;
private String name;
private String position;
private String department;
private double salary;
public Employee(int id, String name, String position, String department, double salary) {
this.id = id;
this.name = name;
this.position = position;
this.department = department;
this.salary = salary;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getPosition() {
return position;
}
public String getDepartment() {
return department;
}
public double getSalary() {
return salary;
}
}

View File

@ -0,0 +1,46 @@
class Order {
private int id;
private String product;
private int quantity;
private String date;
private String deliveryDate;
private String status;
public Order(int id, String product, int quantity, String date, String deliveryDate, String status) {
this.id = id;
this.product = product;
this.quantity = quantity;
this.date = date;
this.deliveryDate = deliveryDate;
this.status = status;
}
public int getId() {
return id;
}
public String getProduct() {
return product;
}
public int getQuantity() {
return quantity;
}
public String getDate() {
return date;
}
public String getDeliveryDate() {
return deliveryDate;
}
public String getStatus() {
return status;
}
@Override
public String toString() {
return "Order " + id + " - " + product;
}
}

View File

@ -0,0 +1,15 @@
import java.awt.Component;
import javax.swing.*;
class OrderCellRenderer extends DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (component instanceof JLabel && value instanceof Order) {
JLabel label = (JLabel) component;
Order order = (Order) value;
label.setText(order.getProduct());
}
return component;
}
}

View File

@ -0,0 +1,82 @@
class Product {
private int id;
private String itemNumber;
private String productName;
private String description;
private String category;
private int availableStock;
private int minimumStock;
private String storageLocation;
private double purchasePrice;
private double sellingPrice;
private String mainSupplier;
private String imagePath;
public Product(int id, String itemNumber, String productName, String description, String category, int availableStock, int minimumStock, String storageLocation, double purchasePrice, double sellingPrice, String mainSupplier, String imagePath) {
this.id = id;
this.itemNumber = itemNumber;
this.productName = productName;
this.description = description;
this.category = category;
this.availableStock = availableStock;
this.minimumStock = minimumStock;
this.storageLocation = storageLocation;
this.purchasePrice = purchasePrice;
this.sellingPrice = sellingPrice;
this.mainSupplier = mainSupplier;
this.imagePath = imagePath;
}
public int getId() {
return id;
}
public String getItemNumber() {
return itemNumber;
}
public String getProductName() {
return productName;
}
public String getDescription() {
return description;
}
public String getCategory() {
return category;
}
public int getAvailableStock() {
return availableStock;
}
public int getMinimumStock() {
return minimumStock;
}
public String getStorageLocation() {
return storageLocation;
}
public double getPurchasePrice() {
return purchasePrice;
}
public double getSellingPrice() {
return sellingPrice;
}
public String getMainSupplier() {
return mainSupplier;
}
public String getImagePath() {
return imagePath;
}
@Override
public String toString() {
return productName;
}
}

View File

@ -0,0 +1,19 @@
import java.awt.*;
import javax.swing.*;
class ProductCellRenderer extends JLabel implements ListCellRenderer<Product> {
@Override
public Component getListCellRendererComponent(JList<? extends Product> list, Product product, int index, boolean isSelected, boolean cellHasFocus) {
setText(product.getProductName());
setOpaque(true);
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
return this;
}
}

View File

@ -0,0 +1,52 @@
class Supplier {
private int id;
private String name;
private String address;
private String contact;
private String contractDetails;
private String orderHistory;
private String qualityRating;
public Supplier(int id, String name, String address, String contact, String contractDetails, String orderHistory, String qualityRating) {
this.id = id;
this.name = name;
this.address = address;
this.contact = contact;
this.contractDetails = contractDetails;
this.orderHistory = orderHistory;
this.qualityRating = qualityRating;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getAddress() {
return address;
}
public String getContact() {
return contact;
}
public String getContractDetails() {
return contractDetails;
}
public String getOrderHistory() {
return orderHistory;
}
public String getQualityRating() {
return qualityRating;
}
@Override
public String toString() {
return name;
}
}

View File

@ -0,0 +1,18 @@
import java.awt.*;
import javax.swing.*;
class SupplierCellRenderer extends JLabel implements ListCellRenderer<Supplier> {
@Override
public Component getListCellRendererComponent(JList<? extends Supplier> list, Supplier supplier, int index, boolean isSelected, boolean cellHasFocus) {
setText(supplier.getName());
setOpaque(true);
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
return this;
}
}

View File

@ -0,0 +1,29 @@
class User {
private int id;
private String username;
private String password;
private String role;
public User(int id, String username, String password, String role) {
this.id = id;
this.username = username;
this.password = password;
this.role = role;
}
public int getId() {
return id;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getRole() {
return role;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
1,admin,admin123,Administrator
2,manager,manager123,Manager
3,user,user123,User
4,Abbas,12,Administrator