Skip to content

Commit

Permalink
GWT: Display account, assignment and grade in right hand corner of de…
Browse files Browse the repository at this point in the history
…tails popup.
  • Loading branch information
calin-iorgulescu committed Apr 23, 2015
1 parent 1f87801 commit c8d13df
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface Widget {
HTMLTable getStudentTable();
void displayInfo(User user, Assignment[] assignments,
ArrayList<ResultInfo> teamResultInfo, ArrayList<ResultInfo> studentResultInfo);
void displayResultDetails(String htmlDetails);
void displayResultDetails(String account, String assignment, String result, String htmlDetails);
}

private class TableClickHandler implements ClickHandler {
Expand Down Expand Up @@ -111,12 +111,8 @@ public void onSuccess(EvaluationResult[] result) {
for (int i = 0; i < result.length; i++) {
resultsHTML += result[i].toHTML();
}
widget.displayResultDetails(resultsHTML);
}

});
}

widget.displayResultDetails(resultInfo.accountName, assignment,
resultInfo.results.get(assignment), resultsHTML);
}

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTMLTable;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.dom.client.Style.FontStyle;
import com.google.gwt.dom.client.Style.Unit;

import ro.pub.cs.vmchecker.client.i18n.StatisticsConstants;
import ro.pub.cs.vmchecker.client.model.Assignment;
Expand Down Expand Up @@ -155,8 +161,29 @@ public void displayInfo(User user, Assignment[] assignments,
}

@Override
public void displayResultDetails(String htmlDetails) {
resultDetailsPopup.showContent(htmlDetails);
public void displayResultDetails(String account, String assignment, String result, String htmlDetails) {
resultDetailsPopup.showContent(buildPopupHeader(account, assignment, result), htmlDetails);
}

private Widget buildPopupHeader(String account, String assignment, String result) {
HorizontalPanel p = new HorizontalPanel();
Label accountLabel = new Label(account);
accountLabel.getElement().getStyle().setFontWeight(FontWeight.BOLD);
accountLabel.getElement().getStyle().setMarginRight(1, Unit.PX);
p.add(accountLabel);
p.add(new Label("@"));
Label assignmentLabel = new Label(assignment);
assignmentLabel.getElement().getStyle().setFontWeight(FontWeight.BOLD);
assignmentLabel.getElement().getStyle().setMarginLeft(1, Unit.PX);
p.add(assignmentLabel);
p.add(new Label(":"));
Label resultLabel = new Label(result);
resultLabel.getElement().getStyle().setFontWeight(FontWeight.BOLD);
resultLabel.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
accountLabel.getElement().getStyle().setMarginRight(1, Unit.PX);
p.add(resultLabel);
p.getElement().getStyle().setFloat(Float.RIGHT);
return p;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.Event;
import com.google.gwt.event.dom.client.BlurEvent;
Expand All @@ -36,6 +38,7 @@ public class VmcheckerPopup extends PopupPanel {
private static VmcheckerConstants constants = GWT
.create(VmcheckerConstants.class);
private FlowPanel detailsPopupContainer = new FlowPanel();
private FlowPanel detailsPopupHeader = new FlowPanel();
private FocusPanel detailsPopupContent = new FocusPanel();
private Anchor popupCloseButton = new Anchor();

Expand All @@ -50,7 +53,8 @@ private void setup() {
setWidth("" + (3 * Window.getClientWidth() / 4) + "px");
setHeight("" + (Window.getClientHeight() - 200) + "px");
setGlassEnabled(true);
detailsPopupContainer.add(popupCloseButton);
detailsPopupHeader.add(popupCloseButton);
detailsPopupContainer.add(detailsPopupHeader);
detailsPopupContainer.add(detailsPopupContent);
detailsPopupContent.setWidth("" + ((3 * Window.getClientWidth() / 4) - 10) + "px");
detailsPopupContent.setHeight("" + (Window.getClientHeight() - 250) + "px");
Expand All @@ -75,6 +79,13 @@ public void onBlur(BlurEvent event) {
});
}

public void showContent(Widget header, String htmlContent) {
detailsPopupHeader.clear();
detailsPopupHeader.add(popupCloseButton);
detailsPopupHeader.add(header);
showContent(htmlContent);
}

public void showContent(String htmlContent) {
detailsPopupContent.clear();
detailsPopupContent.add(new HTML(htmlContent));
Expand Down

0 comments on commit c8d13df

Please sign in to comment.