1 /******************************************************************************* 2 * Copyhacked (H) 2012-2025. 3 * This program and the accompanying materials 4 * are made available under no term at all, use it like 5 * you want, but share and discuss it 6 * every time possible with every body. 7 * 8 * Contributors: 9 * ron190 at ymail dot com - initial implementation 10 ******************************************************************************/ 11 package com.jsql.model.bean.database; 12 13 /** 14 * Class used by the model to properly define components of the database. 15 * When the model ends a process of injection, it builds the corresponding database elements 16 * and provides them to the view. 17 * You can traverse elements from columns, to its corresponding table, to its corresponding database, 18 * inverse isn't required (database>table>column is not used) 19 * Concern only databases, tables and columns, values are raw data directly processed by the view 20 */ 21 public abstract class AbstractElementDatabase { 22 23 /** 24 * Label of the current element. 25 */ 26 protected String elementValue; 27 28 /** 29 * Traverse upward, and return the parent. 30 */ 31 public abstract AbstractElementDatabase getParent(); 32 33 /** 34 * Return the number of elements contained by current element :<br> 35 * - for database: number of tables,<br> 36 * - for table: number of rows.<br> 37 */ 38 public abstract int getChildCount(); 39 40 /** 41 * Return a readable label displayed by the view. 42 */ 43 public abstract String getLabelWithCount(); 44 45 /** 46 * Return the label of current element. 47 */ 48 @Override 49 public String toString() { 50 return this.elementValue; 51 } 52 53 public void setElementValue(String elementValue) { 54 this.elementValue = elementValue; 55 } 56 }