use of org.entirej.framework.core.properties.EJCoreBlockProperties in project rap by entirej.
the class EJRWTLineChartRecordBlockRenderer method initialiseRenderer.
@Override
public void initialiseRenderer(EJEditableBlockController block) {
_block = block;
EJCoreBlockProperties blockProperties = _block.getProperties();
options.setAnimation(blockProperties.getBlockRendererProperties().getBooleanProperty(ANIMATION, options.getAnimation()));
options.setShowToolTips(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_TOOLTIPS, options.getShowToolTips()));
options.getLegend().setEnabled(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_LEGEND, options.getLegend().isEnabled()));
options.getLegend().setPosition(blockProperties.getBlockRendererProperties().getStringProperty(LEGEND_POSITION));
options.getGridLines().setDisplay(blockProperties.getBlockRendererProperties().getBooleanProperty("gridLines", options.getGridLines().isDisplay()));
xAxisColumn = blockProperties.getBlockRendererProperties().getStringProperty(X_AXIS_COLUMN);
EJItemGroupPropertiesContainer container = blockProperties.getScreenItemGroupContainer(EJScreenType.MAIN);
Collection<EJItemGroupProperties> itemGroupProperties = container.getAllItemGroupProperties();
options.getYAxes().clear();
for (EJItemGroupProperties g : itemGroupProperties) {
Axis axis = new Axis();
options.getYAxes().add(axis);
if (g.getRendererProperties() == null) {
continue;
}
Ticks ticks = axis.getTicks();
if (!g.getRendererProperties().isPropertyValueNull(BEGIN_AT_ZERO))
ticks.setBeginAtZero(g.getRendererProperties().getBooleanProperty(BEGIN_AT_ZERO, false));
if (!g.getRendererProperties().isPropertyValueNull(MIN))
ticks.setMin(Double.valueOf(g.getRendererProperties().getFloatProperty(MIN, 0f)));
if (!g.getRendererProperties().isPropertyValueNull(MAX))
ticks.setMax(Double.valueOf(g.getRendererProperties().getFloatProperty(MAX, 0f)));
if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MAX))
ticks.setSuggestedMax(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MAX, 0f)));
if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MIN))
ticks.setSuggestedMin(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MIN, 0f)));
if (!g.getRendererProperties().isPropertyValueNull(STEP_SIZE))
ticks.setStepSize(Double.valueOf(g.getRendererProperties().getFloatProperty(STEP_SIZE, 0f)));
ticks.setMaxTicksLimit((g.getRendererProperties().getIntProperty(MAX_TICKS_LIMIT, ticks.getMaxTicksLimit())));
}
}
use of org.entirej.framework.core.properties.EJCoreBlockProperties in project rap by entirej.
the class EJRWTPieChartRecordBlockRenderer method initialiseRenderer.
@Override
public void initialiseRenderer(EJEditableBlockController block) {
_block = block;
EJCoreBlockProperties blockProperties = _block.getProperties();
options.setAnimation(blockProperties.getBlockRendererProperties().getBooleanProperty(ANIMATION, options.getAnimation()));
multi = (blockProperties.getBlockRendererProperties().getBooleanProperty(MULTI, false));
options.setViewType(blockProperties.getBlockRendererProperties().getStringProperty(VIEW_TYPE));
options.setShowToolTips(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_TOOLTIPS, options.getShowToolTips()));
options.getLegend().setEnabled(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_LEGEND, options.getLegend().isEnabled()));
options.getLegend().setPosition(blockProperties.getBlockRendererProperties().getStringProperty(LEGEND_POSITION));
labelColumn = blockProperties.getBlockRendererProperties().getStringProperty(LABLE_COLUMN);
}
use of org.entirej.framework.core.properties.EJCoreBlockProperties in project rap by entirej.
the class EJRWTBarChartRecordBlockRenderer method initialiseRenderer.
@Override
public void initialiseRenderer(EJEditableBlockController block) {
_block = block;
EJCoreBlockProperties blockProperties = _block.getProperties();
options.setAnimation(blockProperties.getBlockRendererProperties().getBooleanProperty(ANIMATION, options.getAnimation()));
options.setShowToolTips(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_TOOLTIPS, options.getShowToolTips()));
options.getLegend().setEnabled(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_LEGEND, options.getLegend().isEnabled()));
options.getLegend().setPosition(blockProperties.getBlockRendererProperties().getStringProperty(LEGEND_POSITION));
options.getGridLines().setDisplay(blockProperties.getBlockRendererProperties().getBooleanProperty("gridLines", options.getGridLines().isDisplay()));
options.setBarPercentage(blockProperties.getBlockRendererProperties().getFloatProperty("barPercentage", options.getBarPercentage()));
options.setCategoryPercentage(blockProperties.getBlockRendererProperties().getFloatProperty("categoryPercentage", options.getCategoryPercentage()));
int barThickness = blockProperties.getBlockRendererProperties().getIntProperty("barThickness", 0);
if (barThickness > 0)
options.setBarThickness(barThickness);
int maxBarThickness = blockProperties.getBlockRendererProperties().getIntProperty("maxBarThickness", 0);
if (maxBarThickness > 0)
options.setMaxBarThickness(maxBarThickness);
horizontalBar = blockProperties.getBlockRendererProperties().getBooleanProperty("horizontalBar", false);
xAxisColumn = blockProperties.getBlockRendererProperties().getStringProperty(X_AXIS_COLUMN);
EJItemGroupPropertiesContainer container = blockProperties.getScreenItemGroupContainer(EJScreenType.MAIN);
Collection<EJItemGroupProperties> itemGroupProperties = container.getAllItemGroupProperties();
options.getYAxes().clear();
options.getxAxes().clear();
for (EJItemGroupProperties g : itemGroupProperties) {
Axis axis = new Axis();
if (horizontalBar)
options.getxAxes().add(axis);
else
options.getYAxes().add(axis);
if (g.getRendererProperties() == null) {
continue;
}
Ticks ticks = axis.getTicks();
if (!g.getRendererProperties().isPropertyValueNull(BEGIN_AT_ZERO))
ticks.setBeginAtZero(g.getRendererProperties().getBooleanProperty(BEGIN_AT_ZERO, false));
if (!g.getRendererProperties().isPropertyValueNull(MIN))
ticks.setMin(Double.valueOf(g.getRendererProperties().getFloatProperty(MIN, 0f)));
if (!g.getRendererProperties().isPropertyValueNull(MAX))
ticks.setMax(Double.valueOf(g.getRendererProperties().getFloatProperty(MAX, 0f)));
if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MAX))
ticks.setSuggestedMax(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MAX, 0f)));
if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MIN))
ticks.setSuggestedMin(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MIN, 0f)));
if (!g.getRendererProperties().isPropertyValueNull(STEP_SIZE))
ticks.setStepSize(Double.valueOf(g.getRendererProperties().getFloatProperty(STEP_SIZE, 0f)));
ticks.setMaxTicksLimit((g.getRendererProperties().getIntProperty(MAX_TICKS_LIMIT, ticks.getMaxTicksLimit())));
}
}
use of org.entirej.framework.core.properties.EJCoreBlockProperties in project rap by entirej.
the class EJRWTHtmlTableBlockRenderer method createHTML.
private void createHTML() {
if (_browser == null || _browser.isDisposed()) {
return;
}
StringBuilder builder = new StringBuilder();
{
builder.append("<div id=\"table\" style=\"float:left;width:100%;height:100%; overflow:auto\">");
{
EJCoreBlockProperties blockProperties = _block.getProperties();
int cellSpacing = blockProperties.getBlockRendererProperties().getIntProperty(CELL_SPACING_PROPERTY, 0);
int cellPadding = blockProperties.getBlockRendererProperties().getIntProperty(CELL_PADDING_PROPERTY, 0);
boolean rowSelection = blockProperties.getBlockRendererProperties().getBooleanProperty(ROW_SELECTION, false);
String rowSelectionVA = blockProperties.getBlockRendererProperties().getStringProperty(ROW_SELECTION_VA);
String selectionTD = "<td width=1 class=\"rowindi\" style=\" border-left: 2px solid #4D90F0;\n" + " background-color: #fafafa; visibility:hidden \"></td>";
if (rowSelectionVA != null && !rowSelectionVA.isEmpty()) {
EJCoreVisualAttributeProperties selectVa = EJCoreProperties.getInstance().getVisualAttributesContainer().getVisualAttributeProperties(rowSelectionVA);
Color backgroundColor = selectVa.getBackgroundColor();
if (selectVa != null) {
String hexString = toHex(backgroundColor.getRed(), backgroundColor.getGreen(), backgroundColor.getBlue());
selectionTD = "<td width=1 class=\"rowindi\" style=\" border-left: 2px solid " + hexString + ";\n" + " background-color: #fafafa; visibility:hidden \"></td>";
}
}
String tdStyle = null;
if (cellPadding > 0) {
String str = String.valueOf(cellPadding);
tdStyle = String.format("padding: %spx %spx %spx %spx; ", str, str, str, str);
}
builder.append("<table border=0 cellspacing=").append(cellSpacing).append(" width=\"100%\" >");
{
builder.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
builder.append(createVACSSUrl());
builder.append("\">");
int charHeight = EJRWTImageRetriever.getGraphicsProvider().getCharHeight(Display.getDefault().getSystemFont());
if (_headerTag != null) {
String sortHeader = _headerTag;
if (activeSortColumn != null) {
StringBuilder header = new StringBuilder();
if (activeSortColumn.direction != SortInfo.DIRECTION.NONE) {
header.append("  <img name=\"open\" ");
header.append("src=\"");
header.append(createImageUrl(activeSortColumn.direction == SortInfo.DIRECTION.ASC ? "resource/widget/rap/column/sort-indicator-up.png" : "resource/widget/rap/column/sort-indicator-down.png"));
header.append("\"");
header.append(" >");
}
sortHeader = _headerTag.replace(String.format("<esh %s/>", activeSortColumn.id), header.toString());
}
builder.append(sortHeader);
}
Collection<EJDataRecord> records = _tableBaseRecords;
builder.append("<tbody>");
if (records.size() > 0) {
records = sortedRecords(records);
int lastRowSpan = 0;
String oddVA = "default_all";
String valueVA = blockProperties.getBlockRendererProperties().getStringProperty(ROW_ODD_VA);
if (valueVA != null && valueVA.length() > 0) {
oddVA = valueVA;
}
String evenVA = "default_all";
valueVA = blockProperties.getBlockRendererProperties().getStringProperty(ROW_EVEN_VA);
if (valueVA != null && valueVA.length() > 0) {
evenVA = valueVA;
}
int rowid = 0;
for (EJDataRecord record : records) {
String trDef = String.format("<tr style=\"height: %spx\" recid=\"%s\" >", String.valueOf(charHeight), String.valueOf(getDisplayedRecordNumber(record)));
rowid++;
if (lastRowSpan > 1) {
for (int i = 1; i < lastRowSpan; i++) {
builder.append(trDef).append("</tr>");
}
lastRowSpan = 0;
}
builder.append(trDef);
if (rowSelection) {
builder.append(selectionTD);
}
for (EJCoreMainScreenItemProperties item : _items) {
String styleClass = (rowid % 2) != 0 ? oddVA : evenVA;
String actionDef = null;
String alignment = null;
float width = -1;
ColumnLabelProvider columnLabelProvider = _itemLabelProviders.get(item.getReferencedItemName());
EJScreenItemController screenItem = _block.getScreenItem(EJScreenType.MAIN, item.getReferencedItemName());
EJCoreVisualAttributeProperties iva = screenItem.getManagedItemRenderer().getVisualAttributeProperties();
if (iva != null) {
styleClass = iva.getName();
}
EJFrameworkExtensionProperties rendererProperties = item.getReferencedItemProperties().getItemRendererProperties();
EJCoreVisualAttributeProperties diva = record.getItem(item.getReferencedItemName()).getVisualAttribute();
if (diva != null) {
styleClass = diva.getName();
}
builder.append(String.format("<td class=\"%s\" ", styleClass));
if (tdStyle != null) {
builder.append(String.format(" style=\'%s\'", tdStyle));
}
EJFrameworkExtensionProperties extentionProperties = item.getBlockRendererRequiredProperties();
if (width == -1) {
width = extentionProperties.getIntProperty(DISPLAY_WIDTH_PROPERTY, 0);
}
String action = extentionProperties.getStringProperty(CELL_ACTION_COMMAND);
if (action == null || action.length() == 0) {
action = item.getActionCommand();
}
if (action != null && action.length() > 0) {
actionDef = String.format("em='eaction' earg='%s , %s' ", action, String.valueOf(getDisplayedRecordNumber(record)));
}
if (width > 0) {
Font font = columnLabelProvider.getFont(new Object());
if (font == null)
font = _browser.getFont();
if (font != null) {
float avgCharWidth = RWTUtils.getAvgCharWidth(font);
if (avgCharWidth > 0) {
if (width != 1) {
// add +1 padding
width = ((int) (((width + 1) * avgCharWidth)));
}
}
}
builder.append(String.format(" width=%s ", width));
}
if (alignment == null) {
String alignmentProperty = rendererProperties.getStringProperty(PROPERTY_ALIGNMENT);
if (alignmentProperty == null) {
alignmentProperty = rendererProperties.getStringProperty("ALLIGNMENT");
}
alignment = getComponentAlignment(alignmentProperty);
}
if (alignment != null) {
builder.append(String.format(" align=\'%s\'", alignment));
}
final String caseProperty = getComponentCase(rendererProperties.getStringProperty(PROPERTY_CASE));
builder.append(String.format(" font style=\'%s\'", caseProperty));
if (item.getHint() != null && !item.getHint().isEmpty()) {
builder.append(String.format(" title=\'%s\'", item.getHint()));
}
builder.append(">");
String text = columnLabelProvider instanceof HtmlBaseColumnLabelProvider ? ((HtmlBaseColumnLabelProvider) columnLabelProvider).getSrcText(record) : columnLabelProvider.getText(record);
boolean htmlformatting = extentionProperties.getBooleanProperty(ENABLE_MARKUP, false) || rendererProperties.getBooleanProperty("HTML_FORMAT", false);
if (!htmlformatting)
text = ignoreHtml(text);
if (actionDef != null && text != null && text.length() > 0) {
builder.append(String.format("<ejl><u %s class=\"%s, %s\" ", "style=\"line-height: 100%;cursor: pointer; cursor: hand;\"", ("default_all".equals(styleClass) ? "default_link_fg" : "default_link"), styleClass));
builder.append(actionDef).append(">");
}
Image image = columnLabelProvider instanceof HtmlBaseColumnLabelProvider ? ((HtmlBaseColumnLabelProvider) columnLabelProvider).getSrcImage(record) : columnLabelProvider.getImage(record);
if (image != null) {
if (actionDef == null) {
builder.append("<img src=\"");
builder.append(ImageFactory.getImagePath(image));
builder.append("\"");
builder.append(String.format(" class=\"default %s\" >", styleClass));
} else {
builder.append("<ejl><img src=\"");
builder.append(ImageFactory.getImagePath(image));
builder.append("\"");
builder.append(String.format("style=\"cursor: hand;\" class=\"%s \" %s > </ejl>", styleClass, actionDef));
}
}
// builder.append(String.format("<p class=\"default %s\">",
// styleClass));
// if(textSelection && actionDef == null && !htmlformatting)
// {
// builder.append("<input value=\"");
// builder.append(text);
// builder.append("\" ");
// builder.append("style=\"border:none;\"");
// builder.append(" readonly />");
// }
// else
builder.append(text);
builder.append("</td>");
}
builder.append("</tr>");
}
} else {
String trDef = String.format("<tr style=\"height: %spx\" >", String.valueOf(charHeight));
builder.append(trDef);
for (EJCoreMainScreenItemProperties item : _items) {
String padding = tdStyle;
float width = -1;
ColumnLabelProvider columnLabelProvider = _itemLabelProviders.get(item.getReferencedItemName());
builder.append(String.format("<td class=\"%s\" ", "default_all"));
if (padding != null) {
builder.append(String.format(" style=\'%s\'", padding));
}
EJFrameworkExtensionProperties extentionProperties = item.getBlockRendererRequiredProperties();
if (width == -1) {
width = extentionProperties.getIntProperty(DISPLAY_WIDTH_PROPERTY, 0);
}
if (width > 0) {
Font font = columnLabelProvider.getFont(new Object());
if (font == null)
font = _browser.getFont();
if (font != null) {
float avgCharWidth = RWTUtils.getAvgCharWidth(font);
if (avgCharWidth > 0) {
if (width != 1) {
// add +1 padding
width = ((int) (((width + 1) * avgCharWidth)));
}
}
}
builder.append(String.format(" width=%s ", width));
}
builder.append(">");
builder.append("</td>");
}
builder.append("</tr>");
}
}
builder.append("</tbody></table>");
}
builder.append("</<div>");
}
String html = builder.toString();
if (_browser.getText() == null || (!html.equals(_browser.getText()))) {
_browser.setText(html);
LOGGER.debug(html);
}
}
Aggregations