Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Work in progress: Reorganising sourcePanel for multiple source (plural)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Mar 15, 2012
1 parent 7228c17 commit 412bcc8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class SourcePanel extends Composite implements HasValue<TransUnit>, HasClickHandlers
{

private final FlowPanel panel;
private final HighlightingLabel sourceLabel;
private final VerticalPanel sourceLabels;
private TransUnit value;

public SourcePanel(TransUnit value, TableResources resources, NavigationMessages messages)
Expand All @@ -51,16 +52,29 @@ public SourcePanel(TransUnit value, TableResources resources, NavigationMessages
initWidget(panel);
setStylePrimaryName("TableEditorSource");

sourceLabel = new HighlightingLabel(value.getSource());
sourceLabels = new VerticalPanel();
sourceLabels.setSize("100%", "100%");

// for (String source : value.getSources)
// {
// HighlightingLabel sourceLabel = new HighlightingLabel(source);
// sourceLabel.setStylePrimaryName("TableEditorContent");
// sourceLabel.setTitle(messages.sourceCommentLabel() +
// value.getSourceComment());
// sourceLabels.add(sourceLabel);
// }

HighlightingLabel sourceLabel = new HighlightingLabel(value.getSource());
sourceLabel.setStylePrimaryName("TableEditorContent");
sourceLabel.setTitle(messages.sourceCommentLabel() + value.getSourceComment());

panel.add(sourceLabel);
sourceLabels.add(sourceLabel);
panel.add(sourceLabels);
}

public Label getLabel()
public VerticalPanel getLabels()
{
return sourceLabel;
return sourceLabels;
}

@Override
Expand Down Expand Up @@ -102,7 +116,10 @@ public HandlerRegistration addClickHandler(ClickHandler handler)

public void highlightSearch(String search)
{
sourceLabel.highlightSearch(search);
for (int i = 0; i < sourceLabels.getWidgetCount(); i++)
{
HighlightingLabel sourceLabel = (HighlightingLabel) sourceLabels.getWidget(i);
sourceLabel.highlightSearch(search);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ public void renderRowValue(final TransUnit rowValue, ColumnDefinition<TransUnit,
{
sourcePanel.highlightSearch(findMessage);
}
sourcePanel.getLabel().sinkEvents(Event.ONCLICK);
sourcePanel.getLabel().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
if (targetCellEditor.isOpened())
{
targetCellEditor.savePendingChange(true);
}
}
});
// sourcePanel.getLabels().sinkEvents(Event.ONCLICK);
// sourcePanel.getLabels().addClickHandler(new ClickHandler()
// {
// @Override
// public void onClick(ClickEvent event)
// {
// if (targetCellEditor.isOpened())
// {
// targetCellEditor.savePendingChange(true);
// }
// }
// });
panel.add(sourcePanel);
sourcePanelMap.put(rowValue.getId(), panel);

Expand Down

0 comments on commit 412bcc8

Please sign in to comment.