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

Commit

Permalink
In progress: top bar refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Oct 10, 2013
1 parent 6eab040 commit dc2b38c
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 123 deletions.
19 changes: 5 additions & 14 deletions zanata-war/src/main/java/org/zanata/webtrans/client/ui/Pager.java
Expand Up @@ -20,7 +20,6 @@
*/
package org.zanata.webtrans.client.ui;

import org.zanata.webtrans.client.resources.Resources;
import org.zanata.webtrans.client.resources.WebTransMessages;

import com.allen_sauer.gwt.log.client.Log;
Expand All @@ -40,8 +39,8 @@
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
Expand All @@ -59,23 +58,18 @@ interface PagerUiBinder extends UiBinder<Widget, Pager> {
}

interface Styles extends CssResource {
String enabled();

String disabled();
}

@UiField
InlineLabel firstPage, lastPage, nextPage, prevPage;
Anchor firstPage, lastPage, nextPage, prevPage;

@UiField
TextBox gotoPage;

@UiField
Label pageCountLabel;

@UiField(provided = true)
Resources resources;

@UiField
Styles style;

Expand All @@ -84,8 +78,7 @@ interface Styles extends CssResource {
private int currentPage;
private boolean isFocused;

public Pager(final WebTransMessages messages, final Resources resources) {
this.resources = resources;
public Pager(final WebTransMessages messages) {
initWidget(uiBinder.createAndBindUi(this));

// set tooltips of page nav icons, i18n-ized w/ WebTransMessages.java
Expand Down Expand Up @@ -207,7 +200,7 @@ public void onClick(ClickEvent event) {
};

private boolean isButtonEnabled(Widget button) {
return button.getStyleName().contains(style.enabled());
return !button.getStyleName().contains(style.disabled());
}

@Override
Expand All @@ -220,12 +213,10 @@ public HandlerRegistration addBlurHandler(BlurHandler handler) {
return gotoPage.addBlurHandler(handler);
}

private void setEnabled(InlineLabel button, boolean enabled) {
private void setEnabled(Anchor button, boolean enabled) {
if (enabled) {
button.removeStyleName(style.disabled());
button.addStyleName(style.enabled());
} else {
button.removeStyleName(style.enabled());
button.addStyleName(style.disabled());
}
}
Expand Down
69 changes: 31 additions & 38 deletions zanata-war/src/main/java/org/zanata/webtrans/client/ui/Pager.ui.xml
Expand Up @@ -2,54 +2,47 @@
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">

<ui:with field="resources"
type="org.zanata.webtrans.client.resources.Resources" />

<ui:style type="org.zanata.webtrans.client.ui.Pager.Styles">
.nav-button {
font-size: 1.1em;
}

.rootContainer {
text-align: center;
font-size: 1.2em;
}

.textBox {
border: 1px solid #CCC;
border-radius: 2px;
width: 40px;
}

.enabled {
opacity: 1;
cursor: pointer;
transition: 0.2s;
width: 3em !important;
}

.enabled:hover {
color: #0085cc;
}

.disabled {
opacity: 0.3;
cursor: default;
.disabled, .disabled:hover {
opacity: 0.5;
cursor: default !important;
}

</ui:style>

<g:HTMLPanel styleName="{style.rootContainer}">
<g:InlineLabel ui:field="firstPage"
addStyleNames="{style.nav-button} icon-to-start" />
<g:InlineLabel ui:field="prevPage"
addStyleNames="{style.nav-button} icon-left-open" />

<g:TextBox ui:field="gotoPage" maxLength="8" styleName="{style.textBox}" />
<g:InlineLabel ui:field="pageCountLabel" />

<g:InlineLabel ui:field="nextPage"
addStyleNames="{style.nav-button} icon-right-open-1" />
<g:InlineLabel ui:field="lastPage"
addStyleNames="{style.nav-button} icon-to-end" />

<g:HTMLPanel styleName="new-zanata">
<ul class="list--horizontal txt--align-center ">
<li>
<g:Anchor ui:field="firstPage"
addStyleNames="{style.nav-button} icon-to-start" />
</li>
<li>
<g:Anchor ui:field="prevPage"
addStyleNames="{style.nav-button} icon-left-open" />
</li>
<li>
<g:TextBox ui:field="gotoPage" maxLength="8"
styleName="{style.textBox}" />
</li>
<li>
<g:InlineLabel ui:field="pageCountLabel" />
</li>
<li>
<g:Anchor ui:field="nextPage"
addStyleNames="{style.nav-button} icon-right-open-1" />
</li>
<li>
<g:Anchor ui:field="lastPage"
addStyleNames="{style.nav-button} icon-to-end" />
</li>
</ul>
</g:HTMLPanel>
</ui:UiBinder>
Expand Up @@ -28,6 +28,7 @@
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.TextBox;
Expand All @@ -49,7 +50,7 @@ interface SearchFieldUiBinder extends UiBinder<Widget, SearchField> {
TextBox filterTextBox;

@UiField
InlineLabel cancelBtn;
Anchor cancelBtn;

private SearchFieldListener listener;

Expand Down
Expand Up @@ -5,29 +5,24 @@

<ui:style>
.filterTextBox {
margin: 0px;
font-size: 16px;
border: 2px solid #C5C5C5;
border-radius: 3px;
width: 305px;
line-height: 18px;
padding-left: 22px;
padding-right: 20px;
margin: 0 !important;
padding-left: 1.6em !important;
padding-right: 1.6em !important;
}

.searchIcon {
position: absolute;
font-size: 20px;
font-size: 1.5em;
opacity: 0.8;
left: 4px;
top: 5px;
left: 0.15em;
top: 0.34em;
}

.cancelBtn {
position: absolute;
top: 7px;
left: 330px;
font-size: 16px;
top: 0.55em;
right: 0.1em;
font-size: 1.2em;
cursor: pointer;
}

Expand All @@ -36,14 +31,15 @@
}

.container {
display: inline-block;
width: 25em;
position: relative;
}


</ui:style>
<g:HTMLPanel styleName="{style.container}">
<g:TextBox ui:field="filterTextBox" addStyleNames='{style.filterTextBox}' />
<g:InlineLabel ui:field="cancelBtn"
<g:Anchor ui:field="cancelBtn"
styleName="{style.cancelBtn} icon-cancel-circle" />
<g:InlineLabel styleName="icon-search {style.searchIcon}" />
</g:HTMLPanel>
Expand Down
Expand Up @@ -109,7 +109,7 @@ public DocumentListView(Resources resources, WebTransMessages messages,
confirmationBox =
new DownloadFilesConfirmationBox(false, messages, resources);
fileUploadDialog = new FileUploadDialog(resources);
pager = new Pager(messages, resources);
pager = new Pager(messages);
searchField = new SearchField(this);
searchField.setTextBoxTitle(messages.docListFilterDescription());

Expand Down
Expand Up @@ -85,7 +85,7 @@
<g:ScrollPanel styleName="{style.listContainer}">
<g:HTMLPanel width="100%">
<g:FlowPanel ui:field="documentListContainer" />
<fui:Pager ui:field="pager" />
<fui:Pager ui:field="pager"/>
</g:HTMLPanel>
</g:ScrollPanel>
</g:layer>
Expand Down
Expand Up @@ -34,7 +34,7 @@
</li>
</ul>

<g:HTMLPanel ui:field="data" />
<g:HTMLPanel ui:field="data" styleName="txt--align-center" />

</g:HTMLPanel>
</ui:UiBinder>
Expand Up @@ -8,14 +8,13 @@
}

.container ul {
display: inline-block;
margin: 0;
padding: 0;
}

.container > ul > li {
display: inline-block;
}
/*.container > ul > li {*/
/*display: inline-block;*/
/*}*/

.transFilterTextBoxEmpty {
color: grey;
Expand Down Expand Up @@ -69,11 +68,11 @@
z-index: 3;
background-color: #fafafa;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(0, 0, 0, 0.2);
top: 95%;
}

.container ul.filterList li {
display: inherit;
margin-right: 0 !important;
}

.drop-down {
Expand All @@ -89,9 +88,7 @@
display: block;
}

.drop-down label,
.drop-down input[type=checkbox],
.filterList li label,
.filterList li input[type=checkbox] {
cursor: pointer;
display: inline-block;
Expand All @@ -100,7 +97,8 @@

.drop-down label,
.filterList li label {
line-height: 32px;
line-height: 2em;
font-weight: normal;
}

.drop-down input[type=checkbox] {
Expand Down
Expand Up @@ -58,7 +58,7 @@
</li>
</ul>

<g:HTMLPanel ui:field="container" />
<g:HTMLPanel ui:field="container" styleName="txt--align-center" />

</g:HTMLPanel>
</ui:UiBinder>
Expand Up @@ -20,7 +20,7 @@
*/
package org.zanata.webtrans.client.view;

import org.zanata.webtrans.client.resources.Resources;
import com.google.gwt.user.client.ui.Anchor;
import org.zanata.webtrans.client.resources.WebTransMessages;
import org.zanata.webtrans.client.ui.HasPager;
import org.zanata.webtrans.client.ui.Pager;
Expand Down Expand Up @@ -60,14 +60,11 @@ interface TranslationEditorViewUiBinder extends
@UiField(provided = true)
Pager pager;

@UiField(provided = true)
Resources resources;

@UiField
HTMLPanel filterPanelContainer;

@UiField
InlineLabel refreshCurrentPage, resize;
Anchor refreshCurrentPage, resize;

private Listener listener;

Expand All @@ -77,10 +74,8 @@ interface TranslationEditorViewUiBinder extends
private final static String STYLE_RESTORE_SOUTHPANEL = "icon-up-circle";

@Inject
public TranslationEditorView(final WebTransMessages messages,
final Resources resources) {
this.resources = resources;
this.pager = new Pager(messages, resources);
public TranslationEditorView(final WebTransMessages messages) {
this.pager = new Pager(messages);
this.messages = messages;

initWidget(uiBinder.createAndBindUi(this));
Expand Down

0 comments on commit dc2b38c

Please sign in to comment.