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

Commit

Permalink
Fix on glossary section on overflow layout
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sl-eng committed Sep 6, 2012
1 parent bf22a3c commit f8332f2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 43 deletions.
Expand Up @@ -26,10 +26,10 @@
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.ValueListBox;
import com.google.gwt.user.client.ui.Widget;
Expand Down Expand Up @@ -66,9 +66,9 @@ interface Styles extends CssResource
Button clearButton;

@UiField
ScrollPanel scrollPanel;
HTMLPanel container;

private final FlexTable table;
private final FlexTable resultTable;

private final Label loadingLabel, noResultFoundLabel;

Expand All @@ -82,11 +82,11 @@ interface Styles extends CssResource
@Inject
public GlossaryView(final UiMessages messages, SearchTypeRenderer searchTypeRenderer, Resources resources)
{
table = new FlexTable();
table.setStyleName("glossaryTable");
table.setCellSpacing(0);
resultTable = new FlexTable();
resultTable.setStyleName("glossaryTable");
resultTable.setCellSpacing(0);

FlexCellFormatter formatter = table.getFlexCellFormatter();
FlexCellFormatter formatter = resultTable.getFlexCellFormatter();
formatter.setStyleName(0, SOURCE_COL, "th");
formatter.setStyleName(0, TARGET_COL, "th");
formatter.setStyleName(0, ACTION_COL, "th");
Expand All @@ -96,10 +96,10 @@ public GlossaryView(final UiMessages messages, SearchTypeRenderer searchTypeRend
formatter.addStyleName(0, DETAILS_COL, "centered");
formatter.addStyleName(0, DETAILS_COL, "detailCol");

table.setWidget(0, 0, new Label(messages.srcTermLabel()));
table.setWidget(0, 1, new Label(messages.targetTermLabel()));
table.setWidget(0, 2, null);
table.setWidget(0, 3, new Label(messages.detailsLabel()));
resultTable.setWidget(0, 0, new Label(messages.srcTermLabel()));
resultTable.setWidget(0, 1, new Label(messages.targetTermLabel()));
resultTable.setWidget(0, 2, null);
resultTable.setWidget(0, 3, new Label(messages.detailsLabel()));

loadingLabel = new Label(messages.loading());
loadingLabel.setStyleName("tableMsg");
Expand All @@ -109,10 +109,8 @@ public GlossaryView(final UiMessages messages, SearchTypeRenderer searchTypeRend
searchType = new EnumListBox<SearchType>(SearchType.class, searchTypeRenderer);
initWidget(uiBinder.createAndBindUi(this));

scrollPanel.add(loadingLabel);
container.add(loadingLabel);

// copyColumn.setCellStyleNames(style.narrowCenteredColumn());
// detailsColumn.setCellStyleNames(style.narrowCenteredColumn());
headerLabel.setText(messages.glossaryHeading());
clearButton.setText(messages.clearButtonLabel());
searchButton.setText(messages.searchButtonLabel());
Expand Down Expand Up @@ -154,17 +152,17 @@ public Widget asWidget()
@Override
public void startProcessing()
{
scrollPanel.clear();
scrollPanel.add(loadingLabel);
container.clear();
container.add(loadingLabel);

clearTableContent();
}

private void clearTableContent()
{
for (int i = 1; i < table.getRowCount(); i++)
for (int i = 1; i < resultTable.getRowCount(); i++)
{
table.removeRow(i);
resultTable.removeRow(i);
}
}

Expand All @@ -191,8 +189,8 @@ public void renderTable(ArrayList<GlossaryResultItem> glossaries)
{
final GlossaryResultItem item = glossaries.get(i);

table.setWidget(i + 1, SOURCE_COL, new HighlightingLabel(item.getSource()));
table.setWidget(i + 1, TARGET_COL, new HighlightingLabel(item.getTarget()));
resultTable.setWidget(i + 1, SOURCE_COL, new HighlightingLabel(item.getSource()));
resultTable.setWidget(i + 1, TARGET_COL, new HighlightingLabel(item.getTarget()));

Button copyButton = new Button("Copy");
copyButton.addClickHandler(new ClickHandler()
Expand All @@ -204,9 +202,9 @@ public void onClick(ClickEvent event)
}
});

table.setWidget(i + 1, ACTION_COL, copyButton);
table.getFlexCellFormatter().setStyleName(i + 1, ACTION_COL, "centered");
table.getFlexCellFormatter().addStyleName(i + 1, ACTION_COL, "actionCol");
resultTable.setWidget(i + 1, ACTION_COL, copyButton);
resultTable.getFlexCellFormatter().setStyleName(i + 1, ACTION_COL, "centered");
resultTable.getFlexCellFormatter().addStyleName(i + 1, ACTION_COL, "actionCol");

InlineLabel infoCell = new InlineLabel();
infoCell.setStyleName("icon-info-circle-2 details");
Expand All @@ -219,15 +217,18 @@ public void onClick(ClickEvent event)
}
});

table.setWidget(i + 1, DETAILS_COL, infoCell);
table.getFlexCellFormatter().setStyleName(i + 1, DETAILS_COL, "centered");
table.getFlexCellFormatter().addStyleName(i + 1, DETAILS_COL, "detailCol");
resultTable.setWidget(i + 1, DETAILS_COL, infoCell);
resultTable.getFlexCellFormatter().setStyleName(i + 1, DETAILS_COL, "centered");
resultTable.getFlexCellFormatter().addStyleName(i + 1, DETAILS_COL, "detailCol");
}
scrollPanel.setWidget(table);
container.clear();
container.add(resultTable);
// scrollPanel.setWidget(table);
}
else
{
scrollPanel.setWidget(noResultFoundLabel);
container.clear();
container.add(noResultFoundLabel);
}
}

Expand Down
Expand Up @@ -10,6 +10,8 @@

.container {
border-left:2px solid #E0E8EE;
min-width:400px;
width:100%;
}

.searchBox
Expand All @@ -20,19 +22,21 @@
}

</ui:style>

<g:LayoutPanel styleName="{style.container}">
<g:layer top="0px" height="30px">
<g:HorizontalPanel>
<g:Label ui:field="headerLabel" styleName="{style.headerLabel}"/>
<g:TextBox ui:field="glossaryTextBox" styleName="{style.searchBox}" />
<g:ValueListBox ui:field="searchType" />
<g:Button ui:field="searchButton" />
<g:Button ui:field="clearButton" />
</g:HorizontalPanel>
</g:layer>
<g:layer top="25px" bottom="0px">
<g:ScrollPanel ui:field="scrollPanel" />
</g:layer>
</g:LayoutPanel>

<g:ScrollPanel>
<g:VerticalPanel styleName="{style.container}">
<g:cell height="30px">
<g:HorizontalPanel>
<g:Label ui:field="headerLabel" styleName="{style.headerLabel}"/>
<g:TextBox ui:field="glossaryTextBox" styleName="{style.searchBox}" />
<g:ValueListBox ui:field="searchType" />
<g:Button ui:field="searchButton" />
<g:Button ui:field="clearButton" />
</g:HorizontalPanel>
</g:cell>
<g:cell>
<g:HTMLPanel ui:field="container" />
</g:cell>
</g:VerticalPanel>
</g:ScrollPanel>
</ui:UiBinder>

0 comments on commit f8332f2

Please sign in to comment.