git-svn-id: https://svn.coded.pt/svn/SIPRP@845 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
Tiago Simão 17 years ago
parent 8bb3758dc0
commit 2f28e47b09

@ -1,8 +1,10 @@
package siprp.higiene.relatorio; package siprp.higiene.relatorio;
import static com.evolute.utils.strings.UnicodeLatin1Map.aacute;
import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;
import static com.evolute.utils.strings.UnicodeLatin1Map.eacute; import static com.evolute.utils.strings.UnicodeLatin1Map.eacute;
import static com.evolute.utils.strings.UnicodeLatin1Map.iacute;
import static com.evolute.utils.strings.UnicodeLatin1Map.oacute; import static com.evolute.utils.strings.UnicodeLatin1Map.oacute;
import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; import static com.evolute.utils.strings.UnicodeLatin1Map.otilde;
import info.clearthought.layout.TableLayout; import info.clearthought.layout.TableLayout;
@ -18,6 +20,7 @@ import java.util.EventObject;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRadioButton; import javax.swing.JRadioButton;
import javax.swing.JTabbedPane; import javax.swing.JTabbedPane;
@ -193,11 +196,19 @@ public class PanelRelatorio extends JPanel implements CaretListener, ChangeListe
@Override @Override
public void actionPerformed( ActionEvent e ) public void actionPerformed( ActionEvent e )
{ {
submit(); if( JOptionPane.OK_OPTION == confirmSubmit() )
{
submit();
}
} }
} ); } );
} }
private int confirmSubmit()
{
return JOptionPane.showConfirmDialog( this, "Ao submeter o Plano de Actua"+ccedil+atilde+"o n"+atilde+"o ser"+aacute+" mais poss"+iacute+"vel alter"+aacute+"-lo. Deseja continuar?" );
}
private void submit() private void submit()
{ {
if( relatorio != null ) if( relatorio != null )
@ -205,6 +216,7 @@ public class PanelRelatorio extends JPanel implements CaretListener, ChangeListe
relatorio.setIsSubmetido( new Date() ); relatorio.setIsSubmetido( new Date() );
relatorio.save(); relatorio.save();
refresh(); refresh();
setRelatorio( relatorio, false );
} }
} }

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-class>siprp.images.servlet.ImagesServlet</servlet-class>
<servlet-name>Some dummy name</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>Some dummy name</servlet-name>
<url-pattern>/image</url-pattern>
</servlet-mapping>
</web-app>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<driver project-version="3.0" class="org.postgresql.Driver">
<url value="jdbc:postgresql://storage:5432/siprp_local"/>
<connectionPool min="1" max="1"/>
<login userName="postgres" password="Typein"/>
</driver>

@ -0,0 +1,37 @@
package siprp.images.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import siprp.database.cayenne.objects.Image;
import siprp.database.cayenne.providers.ImageDAO;
public final class ImagesServlet extends HttpServlet
{
private static final long serialVersionUID = 999506147931075031L;
private static final String PARAMETER_ID = "id";
public void doGet( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException
{
response.setContentType( "image/png" );
ServletOutputStream out = response.getOutputStream();
String param = request.getParameter( PARAMETER_ID );
System.out.println(param);
try
{
Integer id = new Integer(param);
Image img = new ImageDAO().getImageForID( id );
out.write( img.getImageData() );
}
catch (Exception e) {
e.printStackTrace();
}
}
}
Loading…
Cancel
Save