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(broken): Refactor TransUnit to accept list of source…
Browse files Browse the repository at this point in the history
…s/comments and targets
  • Loading branch information
Alex Eng committed Mar 15, 2012
1 parent 412bcc8 commit 46a1808
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 51 deletions.
Expand Up @@ -33,7 +33,6 @@
import com.google.gwt.user.client.ui.Composite;
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
Expand All @@ -55,20 +54,13 @@ public SourcePanel(TransUnit value, TableResources resources, NavigationMessages
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());

sourceLabels.add(sourceLabel);
for (int i = 0; i < value.getSources().size(); i++)
{
HighlightingLabel sourceLabel = new HighlightingLabel(value.getSources().get(i));
sourceLabel.setStylePrimaryName("TableEditorContent");
sourceLabel.setTitle(messages.sourceCommentLabel() + value.getSourceComments().get(i));
sourceLabels.add(sourceLabel);
}
panel.add(sourceLabels);
}

Expand Down
Expand Up @@ -109,8 +109,8 @@ public TransUnit getCellValue(TransUnit rowValue)
@Override
public void setCellValue(TransUnit rowValue, TransUnit cellValue)
{
cellValue.setSource(rowValue.getSource());
cellValue.setSourceComment(rowValue.getSourceComment());
cellValue.setSources(rowValue.getSources());
cellValue.setSourceComments(rowValue.getSourceComments());
}
};

Expand All @@ -131,18 +131,6 @@ public void renderRowValue(final TransUnit rowValue, ColumnDefinition<TransUnit,
{
sourcePanel.highlightSearch(findMessage);
}
// 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 Expand Up @@ -171,7 +159,7 @@ public TransUnit getCellValue(TransUnit rowValue)
@Override
public void setCellValue(TransUnit rowValue, TransUnit cellValue)
{
cellValue.setTarget(rowValue.getTarget());
cellValue.setTargets(rowValue.getTargets());
}

};
Expand All @@ -197,14 +185,14 @@ public void renderRowValue(TransUnit rowValue, ColumnDefinition<TransUnit, Trans
return;
}

if (rowValue.getTarget().isEmpty() && !isReadOnly)
if (rowValue.getTargets().isEmpty() && !isReadOnly)
{
label.setText(messages.clickHere());
label.setStylePrimaryName("TableEditorContent-Empty");
}
else
{
label.setText(rowValue.getTarget());
label.setText(rowValue.getTargets());
label.setStylePrimaryName("TableEditorContent");
}

Expand Down
@@ -1,6 +1,7 @@
package org.zanata.webtrans.shared.model;

import java.io.Serializable;
import java.util.List;

import org.zanata.common.ContentState;
import org.zanata.common.LocaleId;
Expand All @@ -18,9 +19,9 @@ public class TransUnit implements IsSerializable, Serializable

private LocaleId localeId;

private String source;
private String sourceComment;
private String target;
private List<String> sources;
private List<String> sourceComments;
private List<String> targets;
private String msgContext;
private String lastModifiedBy;
private String lastModifiedTime;
Expand All @@ -32,14 +33,14 @@ private TransUnit()
{
}

public TransUnit(TransUnitId id, String resId, LocaleId localeId, String source, String sourceComment, String target, ContentState status, String lastModifiedBy, String lastModifiedTime, String msgContext, int rowIndex)
public TransUnit(TransUnitId id, String resId, LocaleId localeId, List<String> sources, List<String> sourceComments, List<String> targets, ContentState status, String lastModifiedBy, String lastModifiedTime, String msgContext, int rowIndex)
{
this.id = id;
this.resId = resId;
this.localeId = localeId;
this.source = source;
this.sourceComment = sourceComment;
this.target = target;
this.sources = sources;
this.sourceComments = sourceComments;
this.targets = targets;
this.status = status;
this.lastModifiedBy = lastModifiedBy;
this.lastModifiedTime = lastModifiedTime;
Expand All @@ -62,34 +63,34 @@ public LocaleId getLocaleId()
return localeId;
}

public String getSource()
public List<String> getSources()
{
return source;
return sources;
}

public String getSourceComment()
public void setSources(List<String> sources)
{
return sourceComment;
this.sources = sources;
}

public void setSource(String source)
public List<String> getSourceComments()
{
this.source = source;
return sourceComments;
}

public void setSourceComment(String sourceComment)
public void setSourceComments(List<String> sourceComments)
{
this.sourceComment = sourceComment;
this.sourceComments = sourceComments;
}

public String getTarget()
public List<String> getTargets()
{
return target;
return targets;
}

public void setTarget(String target)
public void setTargets(List<String> targets)
{
this.target = target;
this.targets = targets;
}

public ContentState getStatus()
Expand Down

0 comments on commit 46a1808

Please sign in to comment.