--- /dev/null
+/*****************************************************************************
+ * Copyright Igor Barma, Eric Brun, Alexandre Desoubeaux, Christian Martel,
+ * (2 décembre 2008)
+ *
+ * Ce logiciel est un programme informatique servant à l'évaluation des
+ * compétences.
+ *
+ * Ce logiciel est régi par la licence CeCILL soumise au droit français et
+ * respectant les principes de diffusion des logiciels libres. Vous pouvez
+ * utiliser, modifier et/ou redistribuer ce programme sous les conditions
+ * de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
+ * sur le site "http://www.cecill.info".
+ *
+ * En contrepartie de l'accessibilité au code source et des droits de copie,
+ * de modification et de redistribution accordés par cette licence, il n'est
+ * offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons,
+ * seule une responsabilité restreinte pèse sur l'auteur du programme, le
+ * titulaire des droits patrimoniaux et les concédants successifs.
+ *
+ * A cet égard l'attention de l'utilisateur est attirée sur les risques
+ * associés au chargement, à l'utilisation, à la modification et/ou au
+ * développement et à la reproduction du logiciel par l'utilisateur étant
+ * donné sa spécificité de logiciel libre, qui peut le rendre complexe à
+ * manipuler et qui le réserve donc à des développeurs et des professionnels
+ * avertis possédant des connaissances informatiques approfondies. Les
+ * utilisateurs sont donc invités à charger et tester l'adéquation du
+ * logiciel à leurs besoins dans des conditions permettant d'assurer la
+ * sécurité de leurs systèmes et ou de leurs données et, plus généralement,
+ * à l'utiliser et l'exploiter dans les mêmes conditions de sécurité.
+ *
+ * Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
+ * pris connaissance de la licence CeCILL, et que vous en avez accepté les
+ * termes.
+ *******************************************************************************/
+package com.pentila.evalcomp.client.services.examen;
+
+
+import com.google.gwt.user.client.ui.Label;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.BoxComponent;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.Component;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.event.PanelListenerAdapter;
+import com.gwtext.client.widgets.layout.RowLayout;
+import com.gwtext.client.widgets.layout.RowLayoutData;
+import com.pentila.evalcomp.client.i18n.Messages;
+import com.pentila.evalcomp.client.services.ServiceAbstract;
+import com.pentila.evalcomp.client.services.widget.EvalSubViewWidget;
+import com.pentila.evalcomp.client.services.widget.ExtRessourcesPanel;
+import com.pentila.evalcomp.client.services.widget.PropertyValuePanel;
+import com.pentila.evalcomp.client.services.widget.RessourcesPanel;
+import com.pentila.evalcomp.client.services.widget.TransitionPanel;
+import com.pentila.evalcomp.domain.instance.ScenarioInstance;
+import com.pentila.evalcomp.domain.service.Service;
+import com.pentila.evalcomp.domain.transit.Activity;
+import com.pentila.evalcomp.domain.transit.Todo;
+import com.smartgwt.client.widgets.Canvas;
+
+/**
+ * The Class EvaluationService.
+ */
+public class ConsulterResultatsService extends ServiceAbstract {
+
+
+
+ /** The eval grid. */
+ SmartExamenScore scoreGrid;
+
+ /** The eval sub view. */
+ private EvalSubViewWidget evalSubView;
+
+ private boolean readOnly = true;
+
+ /**
+ * Instantiates a new evaluation service.
+ */
+ public ConsulterResultatsService() {
+ super();
+ this.setTitle(Messages.getString(""));
+ this.setIconCls("iconEvaluer32");
+ this.readOnly = false;
+ initializeInterface();
+ }
+
+ /**
+ * Configure service.
+ *
+ * @param todo
+ * the todo
+ * @param activity
+ * the activity
+ */
+ @SuppressWarnings("unchecked")
+ public void configureService(final Todo todo, Activity activity) {
+ super.configureService(todo, activity);
+
+ this.todo = todo;
+ Service serv = activity.getExtActivity().getService();
+
+ //this.setTitle(Messages.getString(serv.getTitlei18n()));
+
+ ScenarioInstance si = (ScenarioInstance) todo.getScenarioInstanceAbstract();
+
+
+ this.clearZones();
+ content = new Panel();
+ content.setBorder(false);
+ content.setLayout(new RowLayout());
+ content.setAutoScroll(true);
+ center.add(content);
+
+ north.add(new Label(Messages.getString(serv.getDescriptioni18n())));
+
+ if (!si.getEvaluationSubjectInstance().getRessources().isEmpty()) {
+
+ east.add(new RessourcesPanel(si.getEvaluationSubjectInstance()
+ .getRessources()));
+ }
+
+
+ if (scoreGrid != null) {
+ scoreGrid.destroy();
+ }
+
+ final Panel container = new Panel();
+ container.setBorder(false);
+ container.addListener(new PanelListenerAdapter() {
+
+ public void onResize(BoxComponent component, int adjWidth,
+ int adjHeight, int rawWidth, int rawHeight) {
+
+ int containerW = container.getInnerWidth();
+ int containerH = container.getInnerHeight();
+
+ if (scoreGrid.getWidth() != containerW
+ || scoreGrid.getHeight() != containerH) {
+
+ if (containerW > 0 && containerH > 0) {
+
+ scoreGrid.resizeTo(containerW, containerH );
+
+
+ }
+
+ }
+
+ }
+
+ public void onDestroy(Component component) {
+ scoreGrid.destroy();
+
+ }
+
+ });
+
+ Boolean showDetail = false;
+
+ scoreGrid = new SmartExamenScore(si.getEvaluationSubjectInstance().getExamenInstance().getId(), showDetail);
+ scoreGrid.initializeInterface();
+
+ container.add(scoreGrid);
+
+
+ scoreGrid.update();
+
+ content.add(container, new RowLayoutData("100%"));
+
+ Button printPreviewButton = new Button(Messages.getString("print_preview"));
+
+ printPreviewButton.addListener(new ButtonListenerAdapter(){
+ public void onClick(Button button, EventObject e) {
+
+
+ Canvas.showPrintPreview(scoreGrid);
+
+
+
+
+ }
+ });
+
+
+
+ //}
+
+ tpanel = new TransitionPanel(todo, activity, this, false);
+
+ tpanel.add(printPreviewButton);
+ south.add(tpanel);
+
+
+
+ tpanel.showButtons();
+
+ if (evalSubView != null) {
+ evalSubView.clear();
+ }
+ evalSubView = new EvalSubViewWidget(si.getEvaluationSubjectInstance());
+ west.add(evalSubView, new RowLayoutData("50%"));
+
+ west.add(new ExtRessourcesPanel(todo, activity), new RowLayoutData("50%"));
+ west.add(new PropertyValuePanel(todo, activity), new RowLayoutData("50%"));
+ tpanel = new TransitionPanel(todo, activity, this, false);
+ south.add(tpanel);
+
+
+ finalizeLayout();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.pentila.evalcomp.client.services.IServiceProvider#doAfterTransit()
+ */
+ public void doAfterTransit() {
+
+ scoreGrid.disable();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.pentila.evalcomp.client.services.IServiceProvider#doBeforeTransit
+ * (java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void doBeforeTransit(final String login, final String processID,
+ final String activityID, final String transID) {
+
+ tpanel.performActivity(login, processID, activityID, transID);
+
+
+ }
+
+
+
+ /**
+ * Initialize interface.
+ */
+ private void initializeInterface() {
+ content = new Panel();
+ content.setBorder(false);
+ content.setLayout(new RowLayout());
+ content.setAutoScroll(true);
+
+ this.setPaddings(5);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.pentila.evalcomp.client.services.IServiceProvider#update()
+ */
+ public void update() {
+
+
+ }
+
+
+
+
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+
+
+}