mirror of
https://gitee.com/jmix/cuba.git
synced 2024-11-30 18:27:56 +08:00
PL-8425 Replace usages of ContextMenu addon with Vaadin ContextMenu addon
This commit is contained in:
parent
bd2511344d
commit
64da32e371
@ -472,8 +472,8 @@ configure(webModule) {
|
||||
/* Vaadin addons */
|
||||
compile(bom['com.haulmont.thirdparty:popupbutton'])
|
||||
compile(bom['org.vaadin.addons:aceeditor'])
|
||||
compile(bom['org.vaadin.addons:contextmenu'])
|
||||
compile(bom['org.vaadin.addons:dragdroplayouts'])
|
||||
compile(bom['com.vaadin.addon:vaadin-context-menu'])
|
||||
|
||||
provided(bom['org.apache.tomcat:tomcat-servlet-api'])
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
<!-- Add-ons -->
|
||||
<inherits name="org.vaadin.aceeditor.AceEditorWidgetSet"/>
|
||||
<inherits name="org.vaadin.hene.popupbutton.widgetset.PopupbuttonWidgetset"/>
|
||||
<inherits name="org.vaadin.peter.contextmenu.ContextmenuWidgetset"/>
|
||||
<inherits name="fi.jasoft.dragdroplayouts.DragDropLayoutsWidgetSet"/>
|
||||
<inherits name="com.vaadin.addon.contextmenu.WidgetSet"/>
|
||||
|
||||
<replace-with class="com.haulmont.cuba.web.toolkit.ui.client.tooltip.CubaTooltip">
|
||||
<when-type-is class="com.vaadin.client.VTooltip"/>
|
||||
|
@ -79,4 +79,13 @@ public class CubaMenuBarWidget extends VMenuBar {
|
||||
}
|
||||
return itemHTML.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showChildMenuAt(CustomMenuItem item, int top, int left) {
|
||||
super.showChildMenuAt(item, top, left);
|
||||
|
||||
if (popup != null) {
|
||||
popup.addStyleName("c-main-menu-popup");
|
||||
}
|
||||
}
|
||||
}
|
@ -32,9 +32,11 @@ import com.haulmont.cuba.gui.components.mainwindow.FtsField;
|
||||
import com.haulmont.cuba.web.WebConfig;
|
||||
import com.haulmont.cuba.web.gui.components.WebComponentsHelper;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaHorizontalSplitPanel;
|
||||
import com.vaadin.addon.contextmenu.ContextMenu;
|
||||
import com.vaadin.addon.contextmenu.MenuItem;
|
||||
import com.vaadin.server.Sizeable.Unit;
|
||||
import com.vaadin.ui.AbstractComponent;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.vaadin.peter.contextmenu.ContextMenu;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
@ -82,11 +84,9 @@ public class AppMainWindow extends AbstractMainWindow {
|
||||
|
||||
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
|
||||
if (clientConfig.getLayoutAnalyzerEnabled()) {
|
||||
ContextMenu contextMenu = new ContextMenu();
|
||||
contextMenu.setOpenAutomatically(true);
|
||||
ContextMenu contextMenu = new ContextMenu(titleBar.unwrap(AbstractComponent.class), false);
|
||||
contextMenu.setAsContextMenuOf(logoImage.unwrap(com.vaadin.ui.AbstractComponent.class));
|
||||
ContextMenu.ContextMenuItem analyzeLayout = contextMenu.addItem(messages.getMainMessage("actions.analyzeLayout"));
|
||||
analyzeLayout.addItemClickListener(event -> {
|
||||
MenuItem menuItem = contextMenu.addItem(messages.getMainMessage("actions.analyzeLayout"), c -> {
|
||||
LayoutAnalyzer analyzer = new LayoutAnalyzer();
|
||||
List<LayoutTip> tipsList = analyzer.analyze(this);
|
||||
|
||||
@ -96,6 +96,7 @@ public class AppMainWindow extends AbstractMainWindow {
|
||||
openWindow("layoutAnalyzer", OpenType.DIALOG, ParamsMap.of("tipsList", tipsList));
|
||||
}
|
||||
});
|
||||
menuItem.setStyleName("c-cm-item");
|
||||
}
|
||||
|
||||
if (webConfig.getUseInverseHeader()) {
|
||||
|
@ -50,7 +50,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.v-menubar-submenu {
|
||||
.c-main-menu.v-menubar-submenu {
|
||||
display: table;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
@ -139,7 +139,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.v-menubar-submenu-has-icons .v-menubar-menuitem {
|
||||
.c-main-menu.v-menubar-submenu-has-icons .v-menubar-menuitem {
|
||||
.v-icon {
|
||||
margin-left: -$v-font-size--h1;
|
||||
margin-right: 0;
|
||||
|
@ -58,26 +58,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
// styles for context-menu add-on
|
||||
@mixin halo-contextmenu-addon($primary-stylename: v-context-menu) {
|
||||
.#{$primary-stylename}-container {
|
||||
@include valo-selection-overlay-style;
|
||||
@mixin halo-vaadin-contextmenu-addon($primary-stylename: c-cm-item) {
|
||||
|
||||
.v-menubar-submenu .#{$primary-stylename}.v-menubar-menuitem {
|
||||
padding-right: $v-selection-item-padding-horizontal*2;
|
||||
padding-left: $v-selection-item-padding-horizontal;
|
||||
}
|
||||
|
||||
.#{$primary-stylename}-item-basic {
|
||||
@include box-defaults;
|
||||
@include valo-button-borderless-style;
|
||||
@include valo-selection-item-style;
|
||||
height: $v-selection-item-height;
|
||||
cursor: pointer;
|
||||
|
||||
text-decoration: none;
|
||||
text-align: left;
|
||||
|
||||
&:focus {
|
||||
@include valo-selection-item-selected-style;
|
||||
}
|
||||
|
||||
outline: 0;
|
||||
.#{$primary-stylename}.v-menubar-menuitem-selected:active {
|
||||
@include opacity(.7);
|
||||
}
|
||||
}
|
@ -124,7 +124,7 @@
|
||||
@include halo-richtextarea;
|
||||
@include halo-orderedlayout;
|
||||
@include halo-sourcecodeeditor;
|
||||
@include halo-contextmenu-addon;
|
||||
@include halo-vaadin-contextmenu-addon;
|
||||
@include halo-textarea;
|
||||
@include halo-draganddrop;
|
||||
@include halo-colorpicker;
|
||||
|
38
modules/web/themes/havana/app/app-menu.scss
Normal file
38
modules/web/themes/havana/app/app-menu.scss
Normal file
@ -0,0 +1,38 @@
|
||||
/*!
|
||||
* Copyright (c) 2008-2017 Haulmont.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@mixin cuba-menubar {
|
||||
.c-main-menu-popup.v-menubar-popup {
|
||||
box-shadow: 0 2px 6px 0 rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.c-main-menu.v-menubar-submenu {
|
||||
background: $cuba-app-header-background-color;
|
||||
border: solid 2px $cuba-app-menu-highlight-color;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.c-main-menu.v-menubar-submenu-has-icons .v-menubar-menuitem {
|
||||
.v-icon {
|
||||
margin-left: -19px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.v-menubar-menuitem-caption {
|
||||
padding-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
@ -169,17 +169,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.v-menubar-submenu-has-icons .v-menubar-menuitem {
|
||||
.v-icon {
|
||||
margin-left: -19px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.v-menubar-menuitem-caption {
|
||||
padding-left: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
// Padding for main tabsheet content
|
||||
|
||||
.c-splitpanel-dockable-right > div > div.v-splitpanel-second-container .c-app-tabbed-window.v-margin-left,
|
||||
|
@ -119,38 +119,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
// styles for context-menu add-on
|
||||
@mixin havana-contextmenu-addon($primary-stylename: v-context-menu) {
|
||||
.#{$primary-stylename}-container {
|
||||
font-family: $cuba-havana-fonts;
|
||||
font-size: 0;
|
||||
|
||||
color: $cuba-contextmenu-font-color;
|
||||
@mixin havana-vaadin-contextmenu-addon($primary-stylename: c-cm-item) {
|
||||
.v-menubar-popup {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.v-menubar-submenu {
|
||||
background: $cuba-contextmenu-background-color;
|
||||
border: 1px solid $cuba-field-focused-border-color;
|
||||
|
||||
.popupContent {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.#{$primary-stylename}.v-menubar-menuitem .v-menubar-menuitem-caption {
|
||||
text-shadow: none;
|
||||
color: $cuba-contextmenu-font-color;
|
||||
padding: 2px 8px;
|
||||
border-left-width: 0;
|
||||
}
|
||||
|
||||
.#{$primary-stylename}-item-basic {
|
||||
@include box-defaults;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
|
||||
border: 1px solid transparent;
|
||||
padding: 3px 7px;
|
||||
|
||||
&:focus {
|
||||
outline: 0;
|
||||
.#{$primary-stylename}.v-menubar-menuitem-selected .v-menubar-menuitem-caption {
|
||||
background: $cuba-field-selection-color;
|
||||
color: white;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.#{$primary-stylename}-item-basic-text {
|
||||
@include box-defaults;
|
||||
}
|
||||
}
|
@ -82,6 +82,7 @@
|
||||
|
||||
// Application specific
|
||||
@import "app/app-window";
|
||||
@import "app/app-menu";
|
||||
@import "app/login-window";
|
||||
@import "app/logger-level";
|
||||
@import "app/breadcrumbs";
|
||||
@ -138,7 +139,7 @@
|
||||
@include havana-loadingindicator;
|
||||
@include havana-sourcecodeeditor;
|
||||
@include havana-progressindicator;
|
||||
@include havana-contextmenu-addon;
|
||||
@include havana-vaadin-contextmenu-addon;
|
||||
@include havana-draganddrop;
|
||||
@include havana-scrollbox;
|
||||
@include havana-calendar;
|
||||
@ -161,6 +162,7 @@
|
||||
@include havana-cuba-fileupload-wrapper;
|
||||
|
||||
@include cuba-login-window;
|
||||
@include cuba-menubar;
|
||||
@include cuba-application-window;
|
||||
@include cuba-logger-level;
|
||||
@include cuba-generic-filter;
|
||||
|
Loading…
Reference in New Issue
Block a user