Class AdminDashboardView
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
The admin dashboard view provides administrators with a user interface for managing utility bills and services. It includes multiple sections for displaying admin information, service-related controls, total bills, and a search interface for accessing specific utility bills.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionprivate JPanel
A panel displaying admin information, including the admin's name and email.protected App
The parent application.private JPanel
A panel displaying the search bar with search input and button.private JPanel
A panel displaying search results.private JPanel
A panel displaying search results.private JPanel
A panel displaying utility services and associated information.private JPanel
A panel displaying the total utility bill cost.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate JPanel
Creates and returns the admin information panel with account details and a logout button.private JPanel
createBillPanel
(UtilityBill bill) Creates a panel to display detailed information about a utility bill.private JPanel
Creates and returns the content pane for displaying search results.private JPanel
createResultsPanel
(ArrayList<UtilityBill> bills) Creates a panel to display utility bill information.private JPanel
Creates and returns the search bar panel with search input and button.private JPanel
Creates and returns the services panel displaying utility services and associated information.private JPanel
Creates a panel to display the total utility bill cost.private void
performSearch
(String searchText) Performs a search operation based on the provided search text.private void
Refreshes the search results panel with updated content.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
adminInfoPanel
A panel displaying admin information, including the admin's name and email.- See Also:
-
servicesPanel
A panel displaying utility services and associated information.- See Also:
-
totalPanel
A panel displaying the total utility bill cost.- See Also:
-
searchBar
A panel displaying the search bar with search input and button.- See Also:
-
searchResultsContainer
A panel displaying search results.- See Also:
-
searchResults
A panel displaying search results.- See Also:
-
app
The parent application.- See Also:
-
-
Constructor Details
-
AdminDashboardView
Constructs an instance ofAdminDashboardView
.- Parameters:
app
- The parent application.This constructor initializes the admin dashboard view with various panels and components, such as the admin information panel and service-related panels.
-
-
Method Details
-
createContentPane
Creates and returns the content pane for displaying search results.This method generates a graphical panel, referred to as the content pane, designed to display search results in a vertical layout. The panel's background color is set to white to provide a clean and visually appealing backdrop for the search results.
The content pane primarily contains the
searchResultsContainer
component, which is populated with search results. It arranges search results in a vertical stack, allowing users to scroll through a list of utility bills and related information.- Returns:
- The content pane for displaying search results.
- See Also:
-
createAdminInfoPanel
Creates and returns the admin information panel with account details and a logout button.This method generates a graphical panel in the user interface to display the admin's account information, including the admin's name, email, and a logout button. The admin's name is presented as a large, bold title, and the email is shown in italics. A "Logout" button is included, which allows the admin to log out of the system.
The panel's background color is set to a specific shade of blue (hex color code: #98c1d9) to provide a visually distinct appearance for the admin information section. The layout of the panel is defined using a GroupLayout, which allows precise control over the placement and alignment of components.
The admin's account information and the "Logout" button are aligned horizontally in the center of the panel. The button's appearance is customized by setting its background color to a dark shade (hex color code: #293241) and the text color to white, providing a clear visual cue for user interaction.
- Returns:
- The admin information panel displaying the admin's account details and a "Logout" button.
- See Also:
-
createServicesPanel
Creates and returns the services panel displaying utility services and associated information.This method generates a panel in the user interface that lists various utility services, including their names, service charges, and unit charges. It also includes an "Edit" button for each service, allowing administrators to modify service details.
The services panel is organized using GridLayout, with a single row and multiple columns. Each service is displayed in a separate sub-panel, with labels indicating the service name, service charge, and unit charge. The "Edit" button is available for each service, allowing administrators to access the service editing page using the
App.editServicePage(ServiceType)
method.The services' data, such as service charges and unit charges, are fetched from the
ServiceController
class. The layout includes appropriate spacing and padding for a visually appealing presentation.- Returns:
- The services panel displaying utility services, their charges, and "Edit" buttons.
- See Also:
-
createSearchBar
Creates and returns the search bar panel with search input and button.This method creates a panel that serves as a search bar in the user interface. The search bar includes a text area where users can input search text, a "Search" button to initiate the search operation, and associated event listeners for user interaction.
The search bar layout is based on GridBagLayout for precise placement of components. It includes a text area for entering search text, and a button to trigger the search operation. The button's action listener is set to invoke the
performSearch(String)
method when clicked. The text area also has a document listener to dynamically respond to changes in the search text input.The method sets up GridBagConstraints for fine-tuning the layout, such as adding padding around components.
- Returns:
- The search bar panel that includes a search text input area and a "Search" button.
- See Also:
-
performSearch
Performs a search operation based on the provided search text.- Parameters:
searchText
- The text to be used for searching utility bills.This method performs a search operation based on the provided search text. It retrieves utility bills that match the search criteria and displays the search results within the search results panel. If no matching utility bills are found, the search results panel displays a message indicating that no results were found. This method is typically triggered when the user initiates a search action within the application.
searchText
- The text used for searching utility bills.- See Also:
-
refreshSearchResultsPanel
private void refreshSearchResultsPanel()Refreshes the search results panel with updated content.This method updates the search results panel with new content. It removes the current content from the search results container, adds the updated search results, and then triggers a revalidation and repaint of the container to reflect the changes. This method is called to refresh the displayed search results when updates or changes occur.
If the search results container is null or empty, no action is performed.
-
createResultsPanel
Creates a panel to display utility bill information.- Parameters:
bills
- AnArrayList
ofUtilityBill
objects to display.- Returns:
- A panel displaying utility bill information or a "None" message if the list is empty.
This method generates a panel to display detailed information about utility bills, including customer name, utility type, usage data, price, and date. If the provided
bills
list is empty ornull
, it displays a message indicating no utility bills are available. Each bill's information is enclosed in a separate sub-panel with proper spacing. The total utility bill cost is also calculated and displayed at the end of the panel. - See Also:
-
createBillPanel
Creates a panel to display detailed information about a utility bill.- Parameters:
bill
- AUtilityBill
object containing bill information.bill
- TheUtilityBill
object representing the utility bill to be displayed.- Returns:
- A panel displaying the utility bill details.
This method generates a panel to display detailed information about a utility bill. The information includes the customer's name, utility type, usage data, price, and date of the bill. Each piece of information is presented in a properly formatted label within the panel. This method is typically used in the context of displaying individual utility bills within a larger view.
- See Also:
-
createTotalPanel
Creates a panel to display the total utility bill cost.- Returns:
- A panel displaying the total utility bill cost.
This method generates a panel to display the total utility bill cost for all utility bills. It calculates the total bill cost using the
StaffController.calculateTotalPrice()
method and presents it in the panel with proper formatting and styling. - See Also:
-