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 * Define a Column, e.g. is sent to the view by the model after injection. 15 * Allow to traverse upward to its corresponding table 16 */ 17 public class Column extends AbstractElementDatabase { 18 19 /** 20 * The table that contains the current column. 21 */ 22 private final Table parentTable; 23 24 /** 25 * Define the column label and parent table. 26 */ 27 public Column(String newColumnName, Table newTableName) { 28 this.elementValue = newColumnName; 29 this.parentTable = newTableName; 30 } 31 32 /** 33 * Return the parent table. 34 * @return Parent for column 35 */ 36 @Override 37 public AbstractElementDatabase getParent() { 38 return this.parentTable; 39 } 40 41 /** 42 * Default 0, a column doesn't contain anything. 43 * @return No child for column 44 */ 45 @Override 46 public int getChildCount() { 47 return 0; 48 } 49 50 /** 51 * A readable label for column is its own label. 52 * @return column text 53 */ 54 @Override 55 public String getLabelWithCount() { 56 return this.toString(); 57 } 58 } 59