use of org.jboss.tools.hibernate.runtime.spi.IColumn in project jbosstools-hibernate by jbosstools.
the class TableFacadeTest method testGetColumnIterator.
@Test
public void testGetColumnIterator() {
Table table = new Table();
ITable tableFacade = FACADE_FACTORY.createTable(table);
Iterator<IColumn> columnIterator = tableFacade.getColumnIterator();
Assert.assertFalse(columnIterator.hasNext());
Column column = new Column("foo");
table.addColumn(column);
tableFacade = FACADE_FACTORY.createTable(table);
columnIterator = tableFacade.getColumnIterator();
IColumn columnFacade = columnIterator.next();
Assert.assertSame(column, ((IFacade) columnFacade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.IColumn in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testAddColumn.
@Test
public void testAddColumn() {
SimpleValue simpleValueTarget = new SimpleValue(null);
valueFacade = FACADE_FACTORY.createValue(simpleValueTarget);
Iterator<?> columnIterator = simpleValueTarget.getColumnIterator();
Assert.assertFalse(columnIterator.hasNext());
Column columnTarget = new Column();
IColumn columnFacade = FACADE_FACTORY.createColumn(columnTarget);
valueFacade.addColumn(columnFacade);
columnIterator = simpleValueTarget.getColumnIterator();
Assert.assertTrue(columnIterator.hasNext());
Assert.assertSame(columnTarget, columnIterator.next());
}
use of org.jboss.tools.hibernate.runtime.spi.IColumn in project jbosstools-hibernate by jbosstools.
the class TableFacadeTest method testGetColumnIterator.
@Test
public void testGetColumnIterator() {
Table table = new Table();
ITable tableFacade = FACADE_FACTORY.createTable(table);
Iterator<IColumn> columnIterator = tableFacade.getColumnIterator();
Assert.assertFalse(columnIterator.hasNext());
Column column = new Column("foo");
table.addColumn(column);
tableFacade = FACADE_FACTORY.createTable(table);
columnIterator = tableFacade.getColumnIterator();
IColumn columnFacade = columnIterator.next();
Assert.assertSame(column, ((IFacade) columnFacade).getTarget());
}
use of org.jboss.tools.hibernate.runtime.spi.IColumn in project jbosstools-hibernate by jbosstools.
the class TableWorkbenchAdapter method getChildren.
public Object[] getChildren(Object o) {
ITable t = getTable(o);
List<Object> items = new ArrayList<Object>();
IPrimaryKey primaryKey = t.getPrimaryKey();
if (primaryKey != null) {
items.add(primaryKey);
}
Iterator<?> columnIterator = t.getColumnIterator();
while (columnIterator.hasNext()) {
IColumn col = (IColumn) columnIterator.next();
if (primaryKey == null || !primaryKey.containsColumn(col)) {
// only add non-pk columns here
items.add(col);
}
}
return items.toArray(new Object[items.size()]);
}
use of org.jboss.tools.hibernate.runtime.spi.IColumn in project jbosstools-hibernate by jbosstools.
the class ColumnEditPart method createFigure.
protected IFigure createFigure() {
IColumn column = ((ColumnViewAdapter) getModel()).getcolumn();
String label = column.getName();
Label columnLabel = new EditableLabel(label);
// columnLabel.setIcon(((ColumnViewAdapter)getModel()).getImage());
return columnLabel;
}
Aggregations