I tried following CSS if there is effect of color but I could not change the default white color of the Part.
.MPartStack {
swt-maximize-visible: false;
swt-minimize-visible: false;
swt-mru-visible: true;
swt-tab-outline: false;
}
.MPart {
background-color: black;
border-color: black;
swt-corner-radius: 0;
}
Only Part Stack works and I am unable to see any change reflected from .MPart.
If you create a Composite in the code for your part to need to set it to inherit the background using
composite.setBackgroundMode(SWT.INHERIT_DEFAULT);
otherwise the part Composite will not pick up the MPart style.
An alternative is to set a CSS class for the controls that you create, like this:
WidgetElement.setCSSClass(control, "your-class-name");
Related
In ag-Grid when I change the row background color, it is working fine, but when I select the row, the color doesn't change to the blue color so I can recognize that the row is selected.
I'm using gridOptions.getRowStyle to change the row background color:
gridOptions.getRowStyle = function(params) {
return { background: "#3a3a3a" }
}
The way I would approach it, would be to use the rowClass option in ag-grid.
rowClass: 'my-row'
And then in your css you can define:
.ag-root .my-row:not(.ag-row-selected) {
background-color: #3a3a3a;
}
https://embed.plnkr.co/fTENsl/
Another option, if you want a custom selected color, would be to use this:
.ag-root .my-row {
background-color: #3a3a3a;
}
.ag-root .my-row.ag-row-selected {
background-color: blue;
}
if you want to change style of selected row use class in css
.ag-row-selected {
background-color: black;
color: white ;
border-color: gray;
}
As the title, it's possible to to apply a default color to all text of a TextFlow component?
TextFlow textFlow = new TextFlow();
textFlow.setId("supertextflow");
// Somewhere else in the code
textFlow.getChildren()
.add(new Text("Dynamic added text! OMG!"));
I tryed different solution but none of them works
#supertextflow {
-fx-text-fill: red;
}
#supertextflow * .text{
-fx-fill: red;
}
#supertextflow > * > .text {
-fx-fill: red;
}
I know that Text is another component, but why i can't style it from it's parent?
Well you can't do that with Text cause it's style class doesn't have fill css rule if you look at the JavaFX CSS Reference Guide. So I would suggest to leave the Text and use Label instead. If you do then you could use the css rule below :
#supertextflow > .label {
-fx-text-fill: blue;
-fx-font-size : 20px;
}
In case you want to keep using Text you will have to set each element (Text) inside the FlowPane a specific id (ex. #customText) and then use it to set the CSS rule like below :
#supertextflow > #customText {
-fx-fill: red;
-fx-font-size : 20px;
}
Edit : As James_D mentioned on the commends below you should use Type Selector (I am guessing that's the correct term) on the CSS rule in order to style all the Text nodes inside your TextFlow without needed to set any ids on them :
#supertextflow > Text {
-fx-fill: red;
-fx-font-size : 20px;
}
I'm using GWT. I see that the gwt "clean" theme (the default one?) makes our body element have a 10px margin:
body {
color: black;
margin: 10px; <------
border: 0px;
padding: 0px;
background: #fff;
direction: ltr;
}
In my own css file, I set the margin to 0px, but it seems that GWT's keeps winning (maybe because it gets loaded last?).
What's the right way to override their setting?
Thanks
There are several possibilities:
You can use margin: 0px !important (this is the "brute-force" approach).
Or you can give your body a class like <body class="myApp">...</body>, and then in your CSS, use body.myApp { ... }. This will take precedence, because body.myApp is a more specific selector than body.
Or you can simply not use any theme at all (which is often a good idea if you want to create a fresh layout without worrying which attributes you'll have to override)
Another option is to load your css file by using clientbundle. (assume that playground.css is your css file)
public interface Resources extends ClientBundle {
public static Resources INSTANCE = GWT.create(Resources.class);
#Source("playground.css")
CssResource getPlaygroundCSS();
}
Note: playground.css is located in the same package as the Resources interface.
in the onmoduleload:
public class Playground implements EntryPoint {
#Override
public void onModuleLoad() {
Resources.INSTANCE.getPlaygroundCSS().ensureInjected();
Label lblHelloWorld = new Label("Hello World");
RootPanel.get().add(lblHelloWorld);
}
}
In the CSS:
body {
background-color: #FFFFD2 !important; }
works fine to change the background color.
How can TH style name/s of a GWT CellTable's heading be looked up programatically?
I have looked at the Client Bundle documentation but it isn't immediately obvious to me how it all fits together. Thanks.
Not sure exactly what you want to do when accessing the TH style names.
If you want to override the standard css style of a celltable header, here are some of the css styles you can override to change the Look and Feel of the component.
.cellTableFirstColumnHeader {}
.cellTableLastColumnHeader {}
.cellTableHeader {
border-bottom: 2px solid #6f7277;
padding: 3px 15px;
text-align: left;
color: #4b4a4a;
text-shadow: #ddf 1px 1px 0;
overflow: hidden;
}
.cellTableSortableHeader {
cursor: pointer;
cursor: hand;
}
.cellTableSortableHeader:hover {
color: #6c6b6b;
}
.cellTableSortedHeaderAscending {
}
.cellTableSortedHeaderDescending {
}
Here is the complete list of styles for cellTables CellTable.css
Now if you want to access you header programmatically, you can use this solution to get the TableSectionElement corresponding the the Header of your table. Then you can access the row, then the cells, and lookup for their styles I guess.
Last thing if you want to override the header style, maybe you can use the following method when adding your column to your table
public void addColumn(Column<T, ?> col, Header<?> header)
Then create your Header or use a TextHeader for example then set your style on it before adding it to the table using
public void setHeaderStyleNames(String styleNames)
Example
TextHeader textHeader = new TextHeader("headerTitle");
textHeader.setHeaderStyleNames("my-style");
myTable.addColumn(myColumn, textHeader);
Easy solution:
import com.google.gwt.user.cellview.client.CellTable.Resources;
private String getCellTableHeaderStyle() {
Resources res = GWT.create(Resources.class);
return res.cellTableStyle().cellTableHeader();
}
I'm creating a MenuBar, and I want to have it display a little icon when there are sub-elements to be displayed. I thought I could achieve this like so:
interface ActionHeroResources extends ClientBundle, MenuBar.Resources
{
#Source("actionhero.css")
public ActionHeroCSS css();
#Override
#Source("agw-dropdown.png")
ImageResource menuBarSubMenuIcon();
}
private static final ActionHeroResources RESOURCES = GWT.create(ActionHeroResources.class);
MenuBar actionMenu = new MenuBar(true, RESOURCES);
public ActionHero()
{
actionMenu.addItem("Select", aSelectMenuFullOfOptions);
}
But the menu appears with the word "Select" an no icon! I'm positive my ImageResource is working correctly because I use menuBarSubMenuIcon().getURL() from the same resource later, and my image shows up just as you'd expect. In the HTML generated by GWT, there is absolutely no distinction between the items with MenuBars as children and the items with Commands. My CSS is working fine.
Any thoughts?
Try overriding the CSS style for .gwt-MenuBar-vertical .subMenuIcon-selected, like this:
.gwt-MenuBar-vertical .subMenuIcon-selected {
background: none;
}
I use this for my own selected items and it works great:
.gwt-MenuBar-vertical .subMenuIcon-selected {
background: url(images/hand_pointer.png) no-repeat 0px 0px;
}
The problem was ultimately that the popup panels that form the submenus take their stylename from the parent, but append a dependent stylename. I don't know of a way to predict what that dependent stylename will be, since the original stylename is obfuscated. I worked around this problem by using the more generic .gwt-MenuBar popup stylename. This only works because I only have one style of popup menu in my program - I'm not sure what I would do if I wanted two popups to look different!
Hopefully, in later gwt releases, the MenuBar styles will come more closely from the resources passed to the menubar and make less use of dependent style names.
You can simply set a css rule for the that appears in the sub menu like this:
.subMenuIcon > img {
/* override gwt sub menu icon */
width: 6px !important;
height: 11px !important;
background: url('your-image-relative-path.png') no-repeat 0px 0px !important;
}