I want to add the styclass and the allday variable to an event. Here's is the thing, The DefaultScheduleEvent does not have a method to be able to set both variables,
So if i choose to set the variable of allday i cannot change the color of the event shown in the schedule, but it shows by hours what i need to show; if I set the styleclass variable, i can change the colors, but the events are not by hours, so the appear as if each event took all day to be executed.
Is there a way can set this two variables, at the same time???
Thx
DefaultScheduleEvent has a constructor in which you can set the style and a setter for you to set whether or not it is all day (as of 3.0-RC1 anyway). Here's how I have it:
evt = new DefaultScheduleEvent("My event", start, finish, "calendarButton");
evt.setAllDay(true);
evt.setEditable(false);
calendar.add(evt);
Then, on my CSS I have this for the style (the background bit is a bit annoying to get right):
.calendarButton, .calendarButton .fc-event-skin, .calendarButton a {
background-color: #aaaaaa;
border-color: gray;
}
Related
I'm using Report Studio Version 10.2.2 and I have a question regarding value prompts.
I've got a report with a prompt page that works great. I set up a value prompt as a multi-select, check box group with default selections. I'd like to give a visual queue to the end user by changing the font color for the "Default Selections" to red.
How do you change the font color for specific display values in a value prompt?
JavaScript
You can add an HTML item before the value prompt:
<span id="MyList">
...and an HTML item after the value prompt...
</span>
<style>
.MyRedClass {
color: #ff0000;
font-weight: bold;
}
</style>
<script>
var s = document.getElementById("MyList");
var divCollection = s.getElementsByClassName("clsCheckBoxRow");
var isPositive = function(n) {
return n > 0;
}
for (var d = 0; d < divCollection.length; d++) {
switch (true) {
case isPositive(divCollection[d].innerHTML.indexOf("CORPORATION FOR PROFIT")):
case isPositive(divCollection[d].innerHTML.indexOf("CORPORATION NON PROFIT")):
case isPositive(divCollection[d].innerHTML.indexOf("INDIVIDUAL")):
divCollection[d].classList.add("MyRedClass");
break;
default:
break;
}
}
</script>
Problems:
You will need to maintain the list of default values in two places.
(Or you could abandon the Default selections property and use
JavaScript to set the defaults.)
My code looks for a class named
clsCheckBoxRow. That may not work for users using a different theme
(?). I don't know because I didn't bother testing.
If any of the default values match text that is in the HTML (other than the value -- unlikely), you'll need to make the search more specific. (like digging deeper into the DOM)
This may be challenging to upgrade to the Interactive Viewer in Cognos Analytics.
In my Vaadin code I want to add min-width feature to my sub-window.
I set width of my subwindow size %25 of my mainwindow, but I don't want it to be very small.I want it at least "125px". How can i set this with java code?
public class Awindow extends Window{
...
public Awindow(...)
setModal(true);
setCaption("Hello");
this.setHeight("100%");
this.setWidth("25%");// I don't want it to be %25 all the time,I want it to remain still after "150px".
VerticalLayout layout = new VerticalLayout (
memberTable,
new HorizontalTable(
createButton,
eraseButton)
);
layout.setSpacing(true);
...
this.setContent(layout);
The only possible solution i know is to make it with css.
You can add a css for the .v-window class eg:
.v-window {
min-width: 125px !important;
}
If you want fully programically
1) add your css style to page style with programmically
UI.getCurrent().getPage().getStyles().add(".min125px{min-width: 125px !important;}");
2) add this style (min125px) to your buttons
createButton.addStyleName("min125px");
eraseButton.addStyleName("min125px");
As long as https://github.com/vaadin/framework/issues/1360 is not implemented by Vaadin, you might want to check out the following add-on: https://vaadin.com/directory#!addon/restrain. This does essentially the same as proposed by the other answers, but has a nice server side api.
E.g.:
new Restrain(component).setMinWidth("125px");
i need to insert a title (not a tooltip, a text on the top) inside the svg rendered by Dojo. How can i do that?
Here my Dgauge:
http://jsfiddle.net/MacroX/pZU93/1/
PD: The line
gauge.title = 'Test Report'
doesnt show the title
EDIT: The question is regarding a label at the top of the gauge, not the title attribute as I originally thought.
You can use a TextIndicator much like you did for the value label below the needle, but you can set a labelFunc property that defines a function called to set a label and displays whatever string is returned from it.
var labelText = new TextIndicator();
labelText.set('x', 73.3);
labelText.set('y', 55);
labelText.set('labelFunc', function() {return 'Test Report';});
gauge.addElement('labelText', labelText);
Here is a modified version of your fiddle with the title text in place.
Original answer remans below in case someone else needs it
Pass the title in when you create the gauge:
var gauge = new CircularLinearGauge({
title: 'Test Report'
}, dojo.byId("gauge"));
You can also use set to set it after the gauge is created:
gauge.set('title', 'Test Report'); //does work :)
The reason for this is that the gauge widget needs to set the text you give as the title on a specific element within the widget's template. gauge.title just sets the title property of the gauge widget, and the widget has no idea when or with what value that property is being set and thus is not able to make it show up as a title attribute on the gauge.
Finally i got a way to resolve this, and this is useful when you need to personalize your dgauge. Here the example:
http://jsfiddle.net/MacroX/THJqV/
What i did is basicly create a gauge, fill it with background white, and then add elements inside
var baseWidth = 400;
gauge.addElement("background", function (g) {
var auxHeight = baseWidth * objGauge.offsetHeight / objGauge.offsetWidth;
g.createRect({
width: 400, height: auxHeight
//width: 400, height: 300
}).setFill("#FFF");
});
I dont know if is the best way, but works and i didnt find something similar in other sites
And what I think is great, this support multiple chart dgauges in only one SVG
I hope this will useful to someone else
I have a JavaFX app which contains a line chart. I want users to be able to select the color of each series in the chart. Since the selection is dynamic I can't use static CSS to set the colors. I also have other controls that I need to set to the same color as the associated series. It's possible to set the line color of a series dynamically using code like this:
series.getNode().setStyle("-fx-stroke: " + color + ";");
That works well and I can use the user-specified color on the associated controls.
My problem is that I also need to set the color of the symbols for each series to the same color. I can't find any way to do that dynamically. All of the tutorials, documentation, and posts that I've read on the topic point to the static CSS approach.
Most charting widgets make this sort of thing very easy to do, but I've found no clues here or on the Oracle forums. Any guidance would be greatly appreciated.
-- Update --
I've found no way to do this other than to enumerate every data point in every series, grab the associated symbol node and set the style individually. Not what I was hoping for. In the process I realized that the default Node allocated for a symbol is a StackPane. I didn't need that flexibility so I replaced it with a Rectangle. This made rendering faster.
I'm late to the game, but maybe someone can use my solution. What worked for me, was iterating through every item in the data series and setting the CSS style for each one.
for (int index = 0; index < series.getData().size(); index++) {
XYChart.Data dataPoint = series.getData().get(index);
Node lineSymbol = dataPoint.getNode().lookup(".chart-line-symbol");
lineSymbol.setStyle("-fx-background-color: #00ff00, #000000; -fx-background-insets: 0, 2;\n" +
" -fx-background-radius: 3px;\n" +
" -fx-padding: 3px;");
}
I was stuck with a similar problem. I don't know upfront which data is going to be added to the graph, so I can't make use of a fixed stylesheet.
I came up with this solution. This code listens for new series added to graph. For every added series, it will create a new listener for data added to the series.
This listener will look up which series this is, the 0th, 1st, etc and then find the two nodes for the coloring of the line and of the legend/symbol.
As soon as it has set both, it can unsubscribe.
Problem can be that the legend/symbol node is not available yet when you receive the callback on the first added datapoint.
I'm aware it's very convoluted and I'm open to hear improvements.
At least it will give you the option to dynamically set the color to anything you want.
final LineChart<Number, Number> chart = new LineChart<>(new NumberAxis(), new NumberAxis());
final ObservableList<Series<Number, Number>> series = chart.getData();
series.addListener(new ListChangeListener<Series<Number, Number>>() {
#Override
public void onChanged(Change<? extends Series<Number, Number>> change) {
ObservableList<? extends Series<Number, Number>> list = change.getList();
for (final Series<Number, Number> serie : list) {
serie.getData().addListener(new ListChangeListener<Data<Number, Number>>() {
#Override
public void onChanged(Change<? extends Data<Number, Number>> ignore) {
int index = series.indexOf(serie);
Set<Node> nodes = chart.lookupAll(".series" + index);
boolean isStyleSet = false;
for (Node n : nodes) {
if (StringUtils.isEmpty(n.getStyle())) {
String css = "-fx-stroke: %s; -fx-background-color: %s, white; ";
String color = //assign dynamically here, for instance based on the name of the series
n.setStyle(String.format(css, color, color));
isStyleSet = true;
}
}
if (!isStyleSet & nodes.size() > 1) {
serie.getData().removeListener(this);
}
}
});
}
}
});
I had a problem which might be slightly different (possibly more complex); I needed to style some nodes of a series one color, others within the same series another color (I also needed to be able to change the allocation of color dynamically). I am working in JavaFx 2.2; I have css-styling, but of course that does not help here. I could not find my issue addressed anywhere; this was the closest I've found.
I just want to say that I could not get "series.getNode().setStyle("-fx-stroke: " + color + ";")" to work. However, using "-fx-background" instead does work. I hope this helps someone.
I have a resizeable CListCtrl and I want to avoid any item being displayed partially, ever.
For example:
I want Item 9 to not be displayed in this case. Is there a flag or method for this? How would you go about solving this issue?
I tried the following and it was no good:
void CMyCListCtrl::OnEndScrolling()
{
int iCount = this->GetCountPerPage();
EnsureVisible(iCount - 1, FALSE);
}
after catching
...
ON_NOTIFY( LVN_ENDSCROLL, IDC_LIST1, OnEndScroll )
...
void CWheelTestDlg::OnEndScroll(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVSCROLL pnmLVScroll = (LPNMLVSCROLL) pNMHDR;
m_MyListCtrl.OnEndScrolling();
*pResult = 0;
}
In the CListCtrl parent dialog. (which I don't want to do, I want to do everything in my CListCtrl derived class only, if possible).
All I accomplish is showing item 9 completely, but item 10 is partially visible below it. If I have 30 items I don't want to scroll the list to show item 30, I want to show up to item 8 with no partially visible item below it.
CListCtrl doesn't appear to support Integral Height.
Here's a solution that accomplishes what you desire by forcefully changing the control height [with commented conditions] (http://www.codeproject.com/Messages/418084/Socket-accept-call.aspx):
/////////////////////////////////////////////////////////////////////////////////
// This assumes a REPORT-style CListCtrl.
//
// Resize the control. This works correctly only if scrolling is disabled. If
// there is scrolling, then setting to the size from ApproximateViewRect() will
// always give scroll bars showing. Which is irritating.
//
// We need to adjust the vertical size from what ApproximateViewRect() returns
// by one row minus border width
//////////////////////////////////////////////////////////////////////////////////
CSize sz = m_list.ApproximateViewRect(); // always adds room for a new row
CRect itRect; // Get the height of a single row (there had better *be* a row!)
m_list.GetItemRect(0, &itRect, LVIR_BOUNDS);
int vOffset = itRect.Height() - 3; // leave a little 'cuz it looks better
m_list.SetWindowPos(NULL, 0, 0, sz.cx, sz.cy - vOffset,
SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOMOVE);
I have the similar problem in wince, and find a solution accidentally. No direct solution in internet, so i decide to re-position scroll bar after receive some message, and the only message i can used in wince is WM_LBUTTONDOWN, other messages such as OnEndScroll are not called, maybe something wrong in my code.
Whatever, i use Timer(ON_WM_TIMER) to re-position scroll bar when receive WM_LBUTTONDOWN message, then find that list control doesn't scroll automatically! then i remain a empty OnTimer function and remove everything else. It works, and i guess list control use Timer to scroll partial row.
Hope useful to you.