can anyone tell me how I can change the style of the draggers in a UIBinder template for the SplitLayoutPanel.
Here is my MainMenu.ui.xml:
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style src="Resources/GlobalStyles.css" />
<g:SplitLayoutPanel width="100%" height="100%" styleName='{style.splitLayoutPanel}'>
<g:north size="100">
<g:HTMLPanel/>
</g:north>
<g:west size="250">
<g:HTMLPanel/>
</g:west>
<g:center>
<g:HTMLPanel/>
</g:center>
<g:south size="50">
<g:HTMLPanel
styleName='{style.footerPanel}'>
<div>
Contact us
Privacy
About
</div>
</g:HTMLPanel>
</g:south>
</g:SplitLayoutPanel>
</ui:UiBinder>
The Resources/GlobalStyles.css looks like this:
body,table {
font-size: small;
}
body {
font-family: Helvetica, Arial, sans-serif;
color: #000;
background: #red;
}
.splitLayoutPanel {
.gwt-SplitLayoutPanel-HDragger {
background:#d0e4f6;
cursor: col-resize;
}
.gwt-SplitLayoutPanel-VDragger {
background: #d0e4f6;
cursor: row-resize;
}
}
.footerPanel {
margin-left: 11px;
padding: 10px;
border-top: 2px solid #5693d6;
text-align: right;
}
What's wrong here? My draggers are not visible and there is no cursus change.
I think GWT doesn't like the nesting. So rewritting the css as follows should make it work:
.splitLayoutPanel .gwt-SplitLayoutPanel-HDragger {
background:#d0e4f6;
cursor: col-resize;
}
.splitLayoutPanel .gwt-SplitLayoutPanel-VDragger {
background: #d0e4f6;
cursor: row-resize;
}
Also GWT will probably complain about the .gwt- styles, in that case the following lines in your css:
#external .gwt-SplitLayoutPanel-HDragger;
#external .gwt-SplitLayoutPanel-VDragger;
Related
I would like to add 3 div elements in a top section of a card where currently there is an image. I would like to add an image, logo and text message in place of that image. What can I do???
Thanks in Advance,
Here's my code
1)HTML
<div class="card">
<b-card no-body
style="width: 20rem;"
img-src="https://placekitten.com/380/200"
>
<b-list-group class="group">
<b-list-group-item>Anvay Joshi</b-list-group-item>
<b-list-group-item>Computer</b-list-group-item>
<b-list-group-item>A-1103</b-list-group-item>
<b-list-group-item>30-11-1997</b-list-group-item>
<b-list-group-item>anvay.joshi#viit.ac.in</b-list-group-item>
<b-list-group-item>9766583977</b-list-group-item>
</b-list-group>
<b-button href="#" variant="primary">QR Code</b-button>
</b-card>
2)CSS
.group {
text-align: center;
}
.header{
text-align: center;
}
.card {
margin: 25px 120px 25px 240px;
border: none;
}
My Actual output looks like as shown
/Users/anvayjoshi/Desktop
My expected output is the top part of the card as shown
/Users/anvayjoshi/Desktop
Please help me !!!!!
Instead of using the img-src attribute on b-card, you can just add a new b-list-group-item.
Here's a jsfiddle demonstrating that, and an image of the result.
new Vue({
el: "#app",
data: {
}
});
.image {
float: left;
}
.logo {
float: left;
margin-right: 10px;
margin-left: 10px;
margin-top: 20px;
}
.text {
float: left;
width: 100px;
}
.group {
text-align: center;
}
.header {
text-align: center;
}
.card {
margin: 10px;
border: none;
}
<div id="app">
<div class="card">
<b-card no-body style="width: 20rem;">
<b-list-group class="group">
<b-list-group-item>
<img class="image" src="https://placekitten.com/100/100" />
<img class="logo" src="https://placekitten.com/50/50" />
<div class="text">
Vishwakarma Institute of Information Technology
</div>
</b-list-group-item>
<b-list-group-item>Anvay Joshi</b-list-group-item>
<b-list-group-item>Computer</b-list-group-item>
<b-list-group-item>A-1103</b-list-group-item>
<b-list-group-item>30-11-1997</b-list-group-item>
<b-list-group-item>anvay.joshi#viit.ac.in</b-list-group-item>
<b-list-group-item>9766583977</b-list-group-item>
</b-list-group>
<b-button href="#" variant="primary">QR Code</b-button>
</b-card>
</div>
</div>
I'm currently developing a base layout for a website. I'm using a docklayoutpanel for the different areas (top - breadcrumbs, left - navigationbar, right - contentbar).
The idea is, that the website fills out all available screen area.
I've added panels to the different areas (north, west, center) in order to add widgets later on.
The panels also have a padding of 0.5em.
The problem is that the padding isn't working for the right side of the content area.
Here's a picture:
Here's the xml code:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
.dockLayout {
border: black solid 1px;
margin: 0.5em;
}
.breadcrumbsPanel {
border-bottom: black solid 1px;
width: auto;
height: auto;
background-color: #ffffff;
}
.navigationPanel {
border-right: black solid 1px;
width: 100%;
height: 100%;
background-color: #ffffff;
padding: 0.5em;
}
.contentPanel {
width: 100%;
height: 100%;
background-color: #ffffff;
padding: 0.5em;
}
.testPanel {
background-color: #ffffff;
border: black solid 1px;
}
</ui:style>
<g:DockLayoutPanel styleName="{style.dockLayout}" unit='EM' height="100%">
<g:north size='3'>
<g:SimplePanel styleName="{style.breadcrumbsPanel}" ui:field='breadcrumbsPanel'></g:SimplePanel>
</g:north>
<g:west size='20'>
<g:VerticalPanel styleName="{style.navigationPanel}" ui:field='navigationPanel' height="100%">
</g:VerticalPanel>
</g:west>
<g:center size='76'>
<g:ScrollPanel styleName="{style.contentPanel}" ui:field='contentPanel'>
<g:FlowPanel styleName="{style.testPanel}">
<g:Label>content</g:Label>
</g:FlowPanel>
</g:ScrollPanel>
</g:center>
</g:DockLayoutPanel>
</ui:UiBinder>
I think is more a CSS issue than other thing. Probably if you change your .contentPanel for something like:
.contentPanel {
position: relative;
left:0.5em;
right: 0.5em;
top: 0;
bottom: 0;
background-color: #ffffff;
}
Should work.
I'm fairly new to GWT App development, so the learning curve hasn't really straightened out a whole lot yet; however, it seems to me the following shouldn't be causing a problem.
I'm working from example code off the net to learn more. I'm using Eclipse Kepler and GWT designer 3.1.2.
The App works, minus a small error in the styling references in the Login.ui.xml which I had fixed but reversed out trying to find how I broke this.
I'm getting the following error when I use design mode on Login.ui.xml.
Unable to create #UiField(provided=true).
You are attempting to use #UiField(provided=true) for (com.learn.client.LoginResources) res, however GWT Designer was not able to create instance of requested object. This can be caused by one of the following reasons:
Type is interface and you've not provided *.wbp-component.xml description with UiBinder.createInstance script.
GWT Designer attempted to use shortest constructor of type (such as default constructor), but it caused exception.
Show stack trace.
Hide stack trace.
Stack trace:
org.eclipse.wb.internal.core.utils.exception.DesignerException: 4508 (Unable to create #UiField(provided=true).). com.learn.client.LoginResources res
at com.google.gdt.eclipse.designer.uibinder.parser.UiBinderParser.createProvidedField(UiBinderParser.java:291)
at com.google.gdt.eclipse.designer.uibinder.parser.UiBinderParser$2.invoke(UiBinderParser.java:182)
at com.sun.proxy.$Proxy670.provideField(Unknown Source)
My sources are as follows:
Login.ui.xml
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:gwt="urn:import:com.google.gwt.user.client.ui"
xmlns:res="urn:with:com.learn.client.LoginResources">
<ui:with field="res" type="com.learn.client.LoginResources" />
<gwt:HTMLPanel>
<div align="center">
<gwt:VerticalPanel res:styleName="style.background">
<gwt:Label text="Login" res:styleName="style.blackText" />
<gwt:TextBox ui:field="loginBox" res:styleName="style.box" />
<gwt:Label text="Password" res:styleName="style.blackText" />
<gwt:PasswordTextBox ui:field="passwordBox" res:styleName="style.box" />
<gwt:HorizontalPanel verticalAlignment="middle">
<gwt:Button ui:field="buttonSubmit" text="Submit" res:styleName="style.loginButton" />
<gwt:CheckBox ui:field="myCheckBox" />
<gwt:Label ui:field="myLabel" text="Remember me" res:styleName="style.blackText" />
</gwt:HorizontalPanel>
<gwt:Label ui:field="completionLabel1" res:styleName="style.blackText" />
<gwt:Label ui:field="completionLabel2" res:styleName="style.blackText" />
</gwt:VerticalPanel>
</div>
</gwt:HTMLPanel>
</ui:UiBinder>
Login.java
public class Login extends Composite {
private static LoginUiBinder uiBinder = GWT.create(LoginUiBinder.class);
private Boolean tooShort = false;
#UiField(provided=true) TextBox loginBox;
#UiField TextBox passwordBox;
#UiField Label completionLabel1;
#UiField Label completionLabel2;
#UiField(provided=true) final LoginResources res;
/*
* #UiTemplate is not mandatory but allows multiple XML templates
* to be used for the same widget.
* Default file loaded will be <class-name>.ui.xml
*/
#UiTemplate("Login.ui.xml")
interface LoginUiBinder extends UiBinder<Widget, Login> {
}
public Login() {
loginBox = new TextBox();
this.res = GWT.create(LoginResources.class);
res.style().ensureInjected();
initWidget(uiBinder.createAndBindUi(this));
}
:
:
Handlers
:
:
}
nResources.java
public interface LoginResources extends ClientBundle {
/**
* Sample CssResource.
*/
public interface MyCss extends CssResource {
String blackText();
String redText();
String loginButton();
String box();
String background();
}
#Source("LoginStyle.css")
MyCss style();
}
LoginStyle.css
.blackText {
font-family: Arial, Sans-serif;
color: #000000;
font-size: 11px;
text-align: left;
}
.redText {
font-family: Arial, Sans-serif;
color: #ff0000;
font-size: 11px;
text-align: left;
}
.loginButton {
border: 1px solid #3399DD;
color: #FFFFFF;
background: #555555;
font-size: 11px;
font-weight: bold;
margin: 0 5px 0 0;
padding: 4px 10px 5px;
text-shadow: 0 -1px 0 #3399DD;
}
.box {
border: 1px solid #AACCEE;
display: block;
font-size: 12px;
margin: 0 0 5px;
padding: 3px;
width: 203px;
}
.background {
background-color: #999999;
border: 1px none transparent;
color: #000000;
font-size: 11px;
margin-left: -8px;
margin-top: 5px;
padding: 6px;
}
It seems designer does not support provided fields when they need a generator.
I would include the LoginStyle.css stuff in the Login.ui.xml
Something like this:
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:style>
.container {
}
</ui:style>
<g:FlowPanel ui:field="container" addStyleNames="{style.container}">
</g:FlowPanel>
</ui:UiBinder>
I want the browser to show a vertical scrollbar when the content grows larger than the page. The content and footer disappear below the screen instead of showing a vertical scroll bar (like we see on the SO home page).
I asked a similar question earlier, but it was directed at why the page footer wouldn't expand as the content grew. I got that sorted out but now the footer moves south but a page scrollbar never shows up.
My UiBinder xml is as follows (here's a link to the file):
<g:DockLayoutPanel unit='PX' styleName="{style.shellStyles.wrap}">
<g:north size='180'>
<g:HTMLPanel styleName='{style.shellStyles.header}'>
<div id="login" class="{style.shellStyles.login}">
<g:InlineLabel ui:field="loggedInUser"/>
<g:InlineHyperlink ui:field="loginLogoutLink"/>
</div>
<h1>Flash Cards Application</h1>
</g:HTMLPanel>
</g:north>
<g:center>
<g:FlowPanel>
<g:HTMLPanel styleName='{style.shellStyles.content}'>
<g:SimplePanel styleName='{style.shellStyles.left}' ui:field="navigationPanel" />
<g:SimplePanel styleName='{style.shellStyles.right}' ui:field='contentPanel' />
<div style="clear: both;" ></div>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.shellStyles.footer}" height="70">
<g:Label>© Copyright by Justin Robbins</g:Label>
</g:HTMLPanel>
</g:FlowPanel>
</g:center>
Excerpt of CSS is as follows (here's a link to the full CSS):
.wrap {
width: 820px;
margin: 20px auto 10px auto;
}
#sprite .header {
gwt-image: "headerImage";
background-color: #efefef;
height: 180px;
}
#sprite .content {
gwt-image: "contentImage";
background-color: #efefef;
padding: 10px 40px 20px 20px;
min-height: 500px;
}
.left {
width: 210px;
float: left;
}
#sprite .left h4 {
gwt-image: "sidebarImage";
padding: 0 0 0 10px;
height: 50px;
line-height: 50px;
color: #fff;
}
.right {
width: 530px;
float: right;
padding-top: 10px;
padding-right: 60px;
}
#sprite .footer {
gwt-image: "footerImage";
background-color: #efefef;
height: 70px;
line-height: 70px;
color: #fff;
text-align: center;
}
*{margin:0; padding:0;}
body {
font-family: Arial;
font-size: 12px;
background: #efefef;
color: #232323;
margin:0;
padding:0;
line-height: 150%;
}
Wrap your Flowpanel in the content area with ScrollPanel and set its height. You will get the scroll
You are using a Layout-based panel as your root element, hence it will always fit the whole page and if you resize the browser window, everything will resize accordingly (if you've used ProvidesResize/RequiresResize widget down the road).
If the content you know it will grow, simply wrap it into a ScrollLayoutPanel, or set the first FlowPanel of the <center> element to have overflow (it's ugly as you will see).
You also probably want the footer to be always visible, so why not moving that into the region of the main DockLayoutPanel?
I suggest you to give a read here.
I am trying to center a TabLayoutPanel in a uibinder and having no luck whatsoever. As you can see below, I've tried every CSS trick I can think of. Can anyone assist?
<ui:style>
.gwt-TabLayoutPanel {
vertical-align: middle;
text-align: center;
margin-left: auto;
margin-right: auto;
border-top: 1px solid #666;
border-left: 1px solid #999;
border-right: 1px solid #666;
}
</ui:style>
<g:VerticalPanel ui:field="userInterfacePanel" width="100%">
<mapmaker:MapBox ui:field="mapBox"/>
<g:TabLayoutPanel barHeight="20" ui:field="interfaceTabs" height="300px" width="80%" >
<g:tab>
<g:header>Lines</g:header>
<g:Label>Select Line Data Here</g:Label>
</g:tab>
<g:tab>
<g:header>Features</g:header>
<g:Label>Select Features Data Here</g:Label>
</g:tab>
<g:tab>
<g:header>Help</g:header>
<g:Label>Help goes here</g:Label>
</g:tab>
</g:TabLayoutPanel>
<g:HorizontalPanel>
<g:Button>Generate KML</g:Button>
<g:Button>Generate Shapefile</g:Button>
</g:HorizontalPanel>
</g:VerticalPanel>
Centering an item can be done with a cell element like this:
<g:HorizontalPanel width="100%" height="100%">
<g:cell horizontalAlignment="ALIGN_CENTER" verticalAlignment="ALIGN_MIDDLE">
<g:Label>Hello Center</g:Label>
</g:cell>
</g:HorizontalPanel>
The problem here is, that .gwt-TabLayoutPanel will not be applied to your TabLayoutPanel. That's because the class names in GWT's UiBinder styles will be obfuscated in the resulting CSS.
There are basically two solutions:
a) Either put your CSS for .gwt-TabLayoutPanel in a plain CSS file. Include that file in your HTML page using
<head>
...
<link type="text/css" rel="stylesheet" href="My.css">
...
</head>
This way, the class name won't be obfuscated.
b) Or (probably better), in the UiBinder <style> section, use an an arbitrary class name like .panel, and change your code like this:
<ui:style>
.panel {
vertical-align: middle;
text-align: center;
margin-left: auto;
margin-right: auto;
border-top: 1px solid #666;
border-left: 1px solid #999;
border-right: 1px solid #666;
}
</ui:style>
...
<g:TabLayoutPanel barHeight="20" ui:field="interfaceTabs"
height="300px" width="80%"
addStyleNames="{style.panel}" >
This way, the class name will be obfuscated both in the style definition, and in the class attribute of your panel.
Now your panel should be centered.
There is another solution exactly for jour case (btw mentioned in javadoc as not recommended for new code).
In View:
interface GlobalResources extends ClientBundle {
#NotStrict
#Source("../resources/css/global.css") //legacy.css
CssResource css();
}
View's constructor:
// Inject global styles.
GWT.<GlobalResources>create(GlobalResources.class).css().ensureInjected();
That way standart CSS can be used without obfuscation.
global.css:
.gwt-DialogBox .Caption {
background: #E3E8F3;
padding: 4px 24px 4px 8px;
cursor: move;
border-bottom: 1px solid #BBB;
border-top: 0px solid white;
text-align: center;
font-family: Georgia, Times New Roman, sans-serif;
}
I injected GlobalResources in main presenter so editing theme for standart widgets (MenuItem,DialogBox,etc.) became much easier.
If the obfuscation of the stylename is the problem as the others suggested simply add:
#external .gwt-TabLayoutPanel;
to the <ui:style> part.