forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@1129 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
260266fe34
commit
f91549db3e
@ -1,8 +1,88 @@
|
|||||||
package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.seguimento;
|
package com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.seguimento;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoService;
|
||||||
|
import com.evolute.siprp.client.panels.apps.AnaliseAcidentesTrabalho.AnaliseAcidentesTrabalhoServiceAsync;
|
||||||
|
import com.evolute.siprp.client.panels.utils.navigation.PageNavigation;
|
||||||
|
import com.evolute.siprp.client.vo.ActualTableRow;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
|
|
||||||
public class SeguimentoTable extends FlexTable
|
public class SeguimentoTable extends FlexTable
|
||||||
{
|
{
|
||||||
|
private final DateTimeFormat D_F = DateTimeFormat.getFormat( "yyyy-MM-dd" );
|
||||||
|
|
||||||
|
private AnaliseAcidentesTrabalhoServiceAsync aatService;
|
||||||
|
|
||||||
|
public SeguimentoTable()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.aatService = ( AnaliseAcidentesTrabalhoServiceAsync ) GWT.create( AnaliseAcidentesTrabalhoService.class );
|
||||||
|
ServiceDefTarget serviceDef = ( ServiceDefTarget ) this.aatService;
|
||||||
|
serviceDef.setServiceEntryPoint( GWT.getModuleBaseURL() + "aatService" );
|
||||||
|
|
||||||
|
this.setText( 0, 0, "Data do acidente" );
|
||||||
|
this.setText( 0, 1, "Data da abertura" );
|
||||||
|
this.setText( 0, 2, "Nº acidente" );
|
||||||
|
this.setText( 0, 3, "POR" );
|
||||||
|
this.setText( 0, 4, "Nome do acidentado" );
|
||||||
|
this.setText( 0, 5, "Fase" );
|
||||||
|
|
||||||
|
CellFormatter cellFormatter = this.getCellFormatter();
|
||||||
|
cellFormatter.setStyleName( 0, 0, "lblBold" );
|
||||||
|
cellFormatter.setStyleName( 0, 1, "lblBold" );
|
||||||
|
cellFormatter.setStyleName( 0, 2, "lblBold" );
|
||||||
|
cellFormatter.setStyleName( 0, 3, "lblBold" );
|
||||||
|
cellFormatter.setStyleName( 0, 4, "lblBold" );
|
||||||
|
cellFormatter.setStyleName( 0, 5, "lblBold" );
|
||||||
|
|
||||||
|
this.setText( 1, 0, "loading ..." );
|
||||||
|
this.getFlexCellFormatter().setColSpan( 1, 0, 6 );
|
||||||
|
|
||||||
|
this.aatService.getSeguimentoTableData( PageNavigation.getProvider().getUserLogged(), new AsyncCallback< Vector< ActualTableRow > >() {
|
||||||
|
@Override
|
||||||
|
public void onFailure( Throwable caught )
|
||||||
|
{
|
||||||
|
Window.alert( "Oops ! unable to fetch 'Actual' table data." );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess( Vector< ActualTableRow > result )
|
||||||
|
{
|
||||||
|
showTableData( result );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void showTableData( Vector< ActualTableRow > tableRows )
|
||||||
|
{
|
||||||
|
if ( tableRows == null || tableRows.size() == 0 )
|
||||||
|
{
|
||||||
|
this.setText( 1, 0, "No items found." );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.getFlexCellFormatter().setColSpan( 1, 0, 0 );
|
||||||
|
|
||||||
|
for ( int rowNumber = 0, columnNumber = 0; rowNumber < tableRows.size(); rowNumber++, columnNumber = 0 )
|
||||||
|
{
|
||||||
|
ActualTableRow row = tableRows.get( rowNumber );
|
||||||
|
|
||||||
|
this.setText( (rowNumber+1), columnNumber++, D_F.format( row.getDataAcidente() ) );
|
||||||
|
this.setText( (rowNumber+1), columnNumber++, D_F.format( row.getDataAbertura() ) );
|
||||||
|
this.setText( (rowNumber+1), columnNumber++, row.getNrAcidente() );
|
||||||
|
this.setText( (rowNumber+1), columnNumber++, row.getPOR() );
|
||||||
|
this.setText( (rowNumber+1), columnNumber++, row.getNomeAcidentado() );
|
||||||
|
this.setText( (rowNumber+1), columnNumber++, String.valueOf( row.getFase() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
package com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho.seguimento;
|
||||||
|
|
||||||
|
import com.evolute.siprp.server.db.InitDB;
|
||||||
|
import com.evolute.siprp.server.logic.AnaliseAcidentesTrabalho.actual.ActualTableDataProvider;
|
||||||
|
import com.evolute.utils.Singleton;
|
||||||
|
import com.evolute.utils.db.DBManager;
|
||||||
|
import com.evolute.utils.db.Executer;
|
||||||
|
import com.evolute.utils.jdo.JDOProvider;
|
||||||
|
|
||||||
|
public class SeguimentoTableDataProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
private static SeguimentoTableDataProvider instance = null;
|
||||||
|
|
||||||
|
private final Executer EXECUTER;
|
||||||
|
private final JDOProvider JDO_PROVIDER;
|
||||||
|
|
||||||
|
private SeguimentoTableDataProvider() throws Exception
|
||||||
|
{
|
||||||
|
InitDB.init();
|
||||||
|
|
||||||
|
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
|
||||||
|
EXECUTER = dbm.getSharedExecuter( this );
|
||||||
|
JDO_PROVIDER = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static SeguimentoTableDataProvider getProvider() throws Exception
|
||||||
|
{
|
||||||
|
if ( instance == null )
|
||||||
|
{
|
||||||
|
instance = new SeguimentoTableDataProvider();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue