Styles for links in tables #PL-2278

This commit is contained in:
Yuriy Artamonov 2013-07-31 10:47:13 +00:00
parent 5f8ae21a2d
commit a3f16c6243
5 changed files with 18 additions and 11 deletions

View File

@ -111,19 +111,19 @@ public class EditAction extends ItemTrackingAction {
Map<String, Object> params = getWindowParams(); Map<String, Object> params = getWindowParams();
if (params == null) if (params == null)
params = new HashMap<String, Object>(); params = new HashMap<>();
final Window window = owner.getFrame().openEditor(windowID, datasource.getItem(), openType, params, parentDs); final Window window = owner.getFrame().openEditor(windowID, datasource.getItem(), openType, params, parentDs);
window.addListener(new Window.CloseListener() { window.addListener(new Window.CloseListener() {
public void windowClosed(String actionId) { public void windowClosed(String actionId) {
if (Window.COMMIT_ACTION_ID.equals(actionId) && window instanceof Window.Editor) { if (Window.COMMIT_ACTION_ID.equals(actionId) && window instanceof Window.Editor) {
Object item = ((Window.Editor) window).getItem(); Entity item = ((Window.Editor) window).getItem();
if (item instanceof Entity) { if (item != null) {
if (pDs == null) { if (pDs == null) {
datasource.updateItem((Entity) item); datasource.updateItem(item);
} }
afterCommit((Entity) item); afterCommit(item);
} }
} }
afterWindowClosed(window); afterWindowClosed(window);

View File

@ -49,6 +49,7 @@ import com.vaadin.server.Sizeable;
import com.vaadin.ui.*; import com.vaadin.ui.*;
import com.vaadin.ui.Button; import com.vaadin.ui.Button;
import com.vaadin.ui.Label; import com.vaadin.ui.Label;
import com.vaadin.ui.themes.BaseTheme;
import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
@ -511,7 +512,7 @@ public abstract class WebAbstractTable<T extends com.vaadin.ui.Table> extends We
null : column.getXmlDescriptor().attributeValue("clickAction"); null : column.getXmlDescriptor().attributeValue("clickAction");
if (propertyPath.getRange().isClass()) { if (propertyPath.getRange().isClass()) {
if (!isLookup && !StringUtils.isEmpty(clickAction)) { if (!isLookup && StringUtils.isNotEmpty(clickAction)) {
addGeneratedColumn(propertyPath, new ReadOnlyAssociationGenerator(column)); addGeneratedColumn(propertyPath, new ReadOnlyAssociationGenerator(column));
} }
} else if (propertyPath.getRange().isDatatype()) { } else if (propertyPath.getRange().isDatatype()) {
@ -525,9 +526,9 @@ public abstract class WebAbstractTable<T extends com.vaadin.ui.Table> extends We
addGeneratedColumn(propertyPath, new ReadOnlyBooleanDatatypeGenerator()); addGeneratedColumn(propertyPath, new ReadOnlyBooleanDatatypeGenerator());
} }
} }
} else if (propertyPath.getRange().isEnum()) { } /*else if (propertyPath.getRange().isEnum()) {
// TODO (abramov) // TODO (abramov)
} else { }*/ else {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }
@ -1134,7 +1135,7 @@ public abstract class WebAbstractTable<T extends com.vaadin.ui.Table> extends We
final com.vaadin.ui.Button component = new com.vaadin.ui.Button(); final com.vaadin.ui.Button component = new com.vaadin.ui.Button();
component.setData(value); component.setData(value);
component.setCaption(value == null ? "" : property.toString()); component.setCaption(value == null ? "" : property.toString());
component.setStyleName("link"); component.setStyleName(BaseTheme.BUTTON_LINK);
component.addClickListener(new com.vaadin.ui.Button.ClickListener() { component.addClickListener(new com.vaadin.ui.Button.ClickListener() {
@Override @Override
@ -1150,7 +1151,6 @@ public abstract class WebAbstractTable<T extends com.vaadin.ui.Table> extends We
String screenName = clickAction.substring("open:".length()).trim(); String screenName = clickAction.substring("open:".length()).trim();
final Window window = frame.openEditor(screenName, getItem(item, property), WindowManager.OpenType.THIS_TAB); final Window window = frame.openEditor(screenName, getItem(item, property), WindowManager.OpenType.THIS_TAB);
// todo use EditAction instead of this
window.addListener(new Window.CloseListener() { window.addListener(new Window.CloseListener() {
@Override @Override
public void windowClosed(String actionId) { public void windowClosed(String actionId) {

View File

@ -42,7 +42,7 @@
font-family: $theme_fonts; font-family: $theme_fonts;
vertical-align: middle; vertical-align: middle;
white-space: nowrap; white-space: nowrap;
color: #1E3146; color: $theme_buttonCaptionColor;
line-height: normal; line-height: normal;
} }
} }

View File

@ -83,6 +83,12 @@
.#{$primaryStyleName}-cell-content { .#{$primaryStyleName}-cell-content {
border-right-color: $theme_tableCellSeparatorColor; border-right-color: $theme_tableCellSeparatorColor;
.v-button-caption,
.v-button-link .v-button-caption {
font-size: 11px;
color: $theme_buttonCaptionColor;
}
} }
.#{$primaryStyleName}-cell-wrapper.widget-container { .#{$primaryStyleName}-cell-wrapper.widget-container {

View File

@ -23,6 +23,7 @@ $theme_windowBorderColor: #8aa9d1;
$theme_foldersPaneCaptionColor: #2B4766; $theme_foldersPaneCaptionColor: #2B4766;
$theme_buttonBorderColor: #9bb3d3; $theme_buttonBorderColor: #9bb3d3;
$theme_buttonCaptionColor: #1e3146;
$theme_fieldBorderColor: #a5c4e0; $theme_fieldBorderColor: #a5c4e0;
$theme_fieldFocusedBorderColor: #4d7ab2; $theme_fieldFocusedBorderColor: #4d7ab2;