mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 19:57:36 +08:00
Havana SCSS theme, Tree styles #PL-1995
This commit is contained in:
parent
ec74d506d7
commit
8bb1555f12
@ -1,3 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.gui.data;
|
||||
|
||||
import com.haulmont.cuba.core.entity.Entity;
|
||||
@ -34,4 +40,4 @@ public interface HierarchicalDatasource<T extends Entity<K>, K> extends Collecti
|
||||
|
||||
/** True if item with ID specified can ever has children */
|
||||
boolean canHasChildren(K itemId);
|
||||
}
|
||||
}
|
@ -22,21 +22,24 @@ public class HierarchicalDatasourceImpl<T extends Entity<K>, K>
|
||||
|
||||
protected String hierarchyPropertyName;
|
||||
|
||||
@Override
|
||||
public String getHierarchyPropertyName() {
|
||||
return hierarchyPropertyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHierarchyPropertyName(String hierarchyPropertyName) {
|
||||
this.hierarchyPropertyName = hierarchyPropertyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<K> getChildren(K itemId) {
|
||||
if (hierarchyPropertyName != null) {
|
||||
final Entity item = getItem(itemId);
|
||||
if (item == null)
|
||||
return Collections.emptyList();
|
||||
|
||||
List<K> res = new ArrayList<K>();
|
||||
List<K> res = new ArrayList<>();
|
||||
|
||||
Collection<K> ids = getItemIds();
|
||||
for (K id : ids) {
|
||||
@ -51,6 +54,7 @@ public class HierarchicalDatasourceImpl<T extends Entity<K>, K>
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public K getParent(K itemId) {
|
||||
if (hierarchyPropertyName != null) {
|
||||
Instance item = getItem(itemId);
|
||||
@ -64,11 +68,12 @@ public class HierarchicalDatasourceImpl<T extends Entity<K>, K>
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<K> getRootItemIds() {
|
||||
Collection<K> ids = getItemIds();
|
||||
|
||||
if (hierarchyPropertyName != null) {
|
||||
Set<K> result = new LinkedHashSet<K>();
|
||||
Set<K> result = new LinkedHashSet<>();
|
||||
for (K id : ids) {
|
||||
Entity<K> item = getItemNN(id);
|
||||
Object value = item.getValue(hierarchyPropertyName);
|
||||
@ -77,10 +82,11 @@ public class HierarchicalDatasourceImpl<T extends Entity<K>, K>
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
return new LinkedHashSet<K>(ids);
|
||||
return new LinkedHashSet<>(ids);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRoot(K itemId) {
|
||||
Instance item = getItem(itemId);
|
||||
if (item == null) return false;
|
||||
@ -93,6 +99,7 @@ public class HierarchicalDatasourceImpl<T extends Entity<K>, K>
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildren(K itemId) {
|
||||
final Entity item = getItem(itemId);
|
||||
if (item == null) return false;
|
||||
@ -110,7 +117,8 @@ public class HierarchicalDatasourceImpl<T extends Entity<K>, K>
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHasChildren(K itemId) {
|
||||
return true;
|
||||
return hasChildren(itemId);
|
||||
}
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ public class HierarchicalPropertyDatasourceImpl<T extends Entity<K>, K>
|
||||
if (item == null)
|
||||
return Collections.emptyList();
|
||||
|
||||
List<K> res = new ArrayList<K>();
|
||||
List<K> res = new ArrayList<>();
|
||||
|
||||
Collection<K> ids = getItemIds();
|
||||
for (K id : ids) {
|
||||
@ -136,7 +136,7 @@ public class HierarchicalPropertyDatasourceImpl<T extends Entity<K>, K>
|
||||
|
||||
@Override
|
||||
public boolean canHasChildren(K itemId) {
|
||||
return true;
|
||||
return hasChildren(itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,5 +153,4 @@ public class HierarchicalPropertyDatasourceImpl<T extends Entity<K>, K>
|
||||
public void setSortPropertyName(String sortPropertyName) {
|
||||
this.sortPropertyName = sortPropertyName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -8,6 +8,6 @@ modeSingle=Без закладок
|
||||
|
||||
changePassw=Сменить пароль
|
||||
|
||||
modeChangeNotification=Режим главного окна и тема оформления</BR>вступят в силу при следующем входе в систему
|
||||
modeChangeNotification=Режим главного окна и тема оформления вступят в силу при следующем входе в систему
|
||||
|
||||
mainWindowThemeMsg=Заполните поле "Тема главного окна"
|
@ -46,25 +46,6 @@ public class WebComponentsHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public static class ComponentPath {
|
||||
String[] elements;
|
||||
com.haulmont.cuba.gui.components.Component[] components;
|
||||
|
||||
public ComponentPath(String[] elements, com.haulmont.cuba.gui.components.Component[] components) {
|
||||
this.elements = elements;
|
||||
this.components = components;
|
||||
}
|
||||
|
||||
public String[] getElements() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
public com.haulmont.cuba.gui.components.Component[] getComponents() {
|
||||
return components;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static <T extends Component> Collection<T> getComponents(ComponentContainer container, Class<T> aClass) {
|
||||
List<T> res = new ArrayList<>();
|
||||
for (Object aContainer : container) {
|
||||
@ -95,10 +76,6 @@ public class WebComponentsHelper {
|
||||
|
||||
return (com.vaadin.ui.Component) comp;
|
||||
}
|
||||
/*
|
||||
public static com.haulmont.cuba.web.toolkit.Timer unwrap(com.haulmont.cuba.gui.components.Timer timer) {
|
||||
return (com.haulmont.cuba.web.toolkit.Timer) timer;
|
||||
} */
|
||||
|
||||
/**
|
||||
* Returns underlying Vaadin component, which serves as the outermost container for the supplied GUI component.
|
||||
@ -116,6 +93,7 @@ public class WebComponentsHelper {
|
||||
|
||||
return (com.vaadin.ui.Component) comp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use ComponentsHelper.getComponents() instead
|
||||
*/
|
||||
@ -146,15 +124,15 @@ public class WebComponentsHelper {
|
||||
if (elements.length == 1) {
|
||||
final com.haulmont.cuba.gui.components.Component component = comp.getOwnComponent(id);
|
||||
|
||||
if (component == null) {
|
||||
return (T) getComponentByIterate(container, id);
|
||||
} else {
|
||||
if (component == null)
|
||||
return getComponentByIterate(container, id);
|
||||
else
|
||||
return (T) component;
|
||||
}
|
||||
|
||||
} else {
|
||||
com.haulmont.cuba.gui.components.Component component = comp.getOwnComponent(elements[0]);
|
||||
if (component == null) {
|
||||
return (T) getComponentByIterate(container, id);
|
||||
return getComponentByIterate(container, id);
|
||||
} else {
|
||||
final List<String> subpath = Arrays.asList(elements).subList(1, elements.length);
|
||||
if (component instanceof com.haulmont.cuba.gui.components.Component.Container) {
|
||||
@ -169,9 +147,8 @@ public class WebComponentsHelper {
|
||||
|
||||
protected static <T extends com.haulmont.cuba.gui.components.Component> T getComponentByIterate(ComponentContainer container, String id) {
|
||||
com.haulmont.cuba.gui.components.Component component;
|
||||
final Iterator iterator = container.getComponentIterator();
|
||||
while (iterator.hasNext()) {
|
||||
Component c = (Component) iterator.next();
|
||||
for (Object aContainer : container) {
|
||||
Component c = (Component) aContainer;
|
||||
|
||||
if (c instanceof com.haulmont.cuba.gui.components.Component.Container) {
|
||||
component = ((com.haulmont.cuba.gui.components.Component.Container) c).getComponent(id);
|
||||
|
@ -55,14 +55,13 @@ public class HierarchicalDsWrapper extends CollectionDsWrapper implements Contai
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areChildrenAllowed(Object itemId) {
|
||||
//return true;
|
||||
return ((HierarchicalDatasource<Entity<Object>, Object>) datasource).canHasChildren(itemId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed) throws UnsupportedOperationException {
|
||||
//return true;
|
||||
return false; // due to vaadin javadoc, return false if method is not implemented
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
.cuba-app-appname-label {
|
||||
color: white;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
font-family: $theme_fonts;
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 427 B |
Binary file not shown.
After Width: | Height: | Size: 402 B |
Binary file not shown.
After Width: | Height: | Size: 208 B |
BIN
modules/web/themes/havana/components/tree/sprites/tree-line.png
Normal file
BIN
modules/web/themes/havana/components/tree/sprites/tree-line.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 202 B |
82
modules/web/themes/havana/components/tree/tree.scss
Normal file
82
modules/web/themes/havana/components/tree/tree.scss
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
// Version: $Id$
|
||||
|
||||
@mixin havana-tree($primaryStyleName: v-tree) {
|
||||
.#{$primaryStyleName} {
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
border: 1px solid $theme_fieldBorderColor;
|
||||
overflow: auto;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
|
||||
.#{$primaryStyleName}-node-caption {
|
||||
margin-left: 16px;
|
||||
span {
|
||||
cursor: default;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
padding: 0 2px;
|
||||
display: inline;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
color: $theme_treeCaptionColor;
|
||||
}
|
||||
.v-icon {
|
||||
display: inline;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}-node {
|
||||
background: transparent;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(sprites/item-collapsed.png);
|
||||
background-position: 0 2px;
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}-node-expanded {
|
||||
background-image: url(sprites/item-expanded.png);
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}-node-children .#{$primaryStyleName}-node {
|
||||
background-image: url(sprites/item-collapsed.png);
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}-node-children .#{$primaryStyleName}-node-expanded {
|
||||
background-image: url(sprites/item-expanded.png);
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}-node.#{$primaryStyleName}-node-leaf {
|
||||
background-image: url(sprites/tree-line.png);
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}-node-children-last.#{$primaryStyleName}-node.#{$primaryStyleName}-node-leaf {
|
||||
background-image: url(sprites/tree-line.png);
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}-node.#{$primaryStyleName}-node-leaf.#{$primaryStyleName}-node-leaf-last {
|
||||
background-image: url(sprites/tree-line-last.png);
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}-node-selected span {
|
||||
background: $theme_treeSelectionColor;
|
||||
color: $theme_treeCaptionSelectedColor;
|
||||
padding: 0 2px;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.#{$primaryStyleName} > div {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.#{$primaryStyleName}:focus {
|
||||
border-color: $theme_fieldFocusedBorderColor;
|
||||
}
|
||||
}
|
@ -55,4 +55,8 @@ $theme_tableRowBackgroundColor: #fff;
|
||||
$theme_tableRowOddBackgroundColor: #f6f8fa;
|
||||
$theme_tableRowSelectionBackgroundColor: #c3e1ff;
|
||||
$theme_tableRowHoverBackgroundColor: #f5f4b9;
|
||||
$theme_tableCellSeparatorColor: #edf3f9;
|
||||
$theme_tableCellSeparatorColor: #edf3f9;
|
||||
|
||||
$theme_treeSelectionColor: #5daee8;
|
||||
$theme_treeCaptionColor: #1e3146;
|
||||
$theme_treeCaptionSelectedColor: #000;
|
@ -16,6 +16,7 @@
|
||||
@import "components/common/common";
|
||||
|
||||
// Components
|
||||
@import "components/tree/tree";
|
||||
@import "components/table/table";
|
||||
@import "components/panel/panel";
|
||||
@import "components/window/window";
|
||||
@ -44,6 +45,7 @@
|
||||
|
||||
@include havana-common;
|
||||
|
||||
@include havana-tree;
|
||||
@include havana-table;
|
||||
@include havana-panel;
|
||||
@include havana-window;
|
||||
|
Loading…
Reference in New Issue
Block a user