Skip to content

Commit

Permalink
Change the default value for overflow to visible as CSS specs say and…
Browse files Browse the repository at this point in the history
… allow specifying overflow in the style editor. (#1262)
  • Loading branch information
hvbtup authored Apr 14, 2023
1 parent 9037f90 commit ceb1dde
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,7 @@ Element.Style.margin.left=L&eft:
Element.Style.margin.right=R&ight:
Element.Style.margin.top=To&p:
Element.Style.masterPage=Master &Page:
Element.Style.overflow=Overflow:
Element.Style.orphans=&Orphans:
Element.Style.padding.bottom=&Bottom:
Element.Style.padding.left=&Left:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.eclipse.birt.report.designer.internal.ui.dialogs;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

Expand All @@ -27,6 +28,8 @@
import org.eclipse.birt.report.model.api.ReportItemThemeHandle;
import org.eclipse.birt.report.model.api.SharedStyleHandle;
import org.eclipse.birt.report.model.api.StyleHandle;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
import org.eclipse.birt.report.model.api.metadata.IChoice;
import org.eclipse.birt.report.model.api.metadata.IPredefinedStyle;
import org.eclipse.birt.report.model.metadata.MetaDataDictionary;
import org.eclipse.jface.preference.IPreferenceStore;
Expand Down Expand Up @@ -118,6 +121,13 @@ protected void createFieldEditors() {
.getPropertyHandle(StyleHandle.SHOW_IF_BLANK_PROP).getDefn().getDisplayNameID()),
getFieldEditorParent());
addField(blank);

ComboBoxFieldEditor overflow = new ComboBoxFieldEditor(
StyleHandle.OVERFLOW_PROP, Messages.getString(((StyleHandle) model)
.getPropertyHandle(StyleHandle.OVERFLOW_PROP).getDefn().getDisplayNameID()),
getChoiceArray(DesignChoiceConstants.CHOICE_OVERFLOW), getFieldEditorParent());
addField(overflow);

UIUtil.bindHelp(getFieldEditorParent().getParent(), IHelpContextIds.STYLE_BUILDER_GERNERAL_ID);

Label note = new Label(getFieldEditorParent(), SWT.NONE);
Expand Down Expand Up @@ -429,4 +439,40 @@ public void setVisible(boolean visible) {
protected String[] getPreferenceNames() {
return new String[] { StyleHandle.CAN_SHRINK_PROP, StyleHandle.SHOW_IF_BLANK_PROP, };
}

/**
* Gets choice array of the given property name ( key ).
*
* @param key The given property name.
* @return String[][]: The choice array of the key, which contains he names
* (labels) and underlying values, will be arranged as: { {name1,
* value1}, {name2, value2}, ...}
*/
private String[][] getChoiceArray(String key) {
return getChoiceArray(key, null);
}

/**
* Gets choice array of the given property name ( key ).
*
* @param key The given property name.
* @return String[][]: The choice array of the key, which contains he names
* (labels) and underlying values, will be arranged as: { {name1,
* value1}, {name2, value2}, ...}
*/
private String[][] getChoiceArray(String key, Comparator comparator) {
IChoice[] choices = DEUtil.getMetaDataDictionary().getChoiceSet(key).getChoices(comparator);

String[][] names = null;
if (choices.length > 0) {
names = new String[choices.length][2];
for (int i = 0; i < choices.length; i++) {
names[i][0] = choices[i].getDisplayName();
names[i][1] = choices[i].getName();
}
}
return names;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public boolean isInheritedProperty() {

@Override
public Value getDefaultValue() {
return CSSValueConstants.OVERFLOW_HIDDEN_VALUE;
return CSSValueConstants.OVERFLOW_VISIBLE_VALUE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2441,7 +2441,7 @@
<Property detailType="MapRule" displayNameID="Element.Style.map.rules" isList="true" isStyleProperty="true" name="mapRules" since="1.0" type="structure"/>
<Property canInherit="false" detailType="HighlightRule" displayNameID="Element.Style.highlight.rules" isList="true" isStyleProperty="true" name="highlightRules" since="1.0" type="structure"/>
<Property canInherit="false" detailType="overflow" displayNameID="Element.Style.overflow" isStyleProperty="true" name="overflow" since="2.5.2" type="choice">
<Default>hidden</Default>
<Default>visible</Default>
</Property>
<Property canInherit="false" displayNameID="Element.Style.height" name="height" isStyleProperty="true" since="4.3" type="dimension" validator="NonNegativeValueValidator" />
<Property canInherit="false" displayNameID="Element.Style.width" name="width" isStyleProperty="true" since="4.3" type="dimension" validator="NonNegativeValueValidator" />
Expand Down Expand Up @@ -3972,29 +3972,29 @@
</Property>
</Element>
<Style displayNameID="Style.Report" name="report" reference="Overall default" />
<Style displayNameID="Style.List" name="list" reference="List. Applies to all slots within the list"/>
<Style displayNameID="Style.ListHeader" name="list-header" reference="List Header"/>
<Style displayNameID="Style.ListFooter" name="list-footer" reference="List Footer"/>
<Style displayNameID="Style.ListDetail" name="list-detail" reference="List Detail"/>
<Style displayNameID="Style.Table" name="table" reference="Table Item"/>
<Style displayNameID="Style.TableHeader" name="table-header" reference="Table Header"/>
<Style displayNameID="Style.TableFooter" name="table-footer" reference="Table Footer"/>
<Style displayNameID="Style.TableDetail" name="table-detail" reference="Table Detail"/>
<Style displayNameID="Style.TableRow" name="table-row" reference="Table Row"/>
<Style displayNameID="Style.TableCell" name="table-cell" reference="Table Cell"/>
<Style displayNameID="Style.TableHeaderCell" name="table-header-cell" reference="Table Header Cell"/>
<Style displayNameID="Style.TableFooterCell" name="table-footer-cell" reference="Table Footer Cell"/>
<Style displayNameID="Style.TableDetailCell" name="table-detail-cell" reference="Table Detail Cell"/>
<Style displayNameID="Style.Label" name="label" reference="Label item"/>
<Style displayNameID="Style.Text" name="text" reference="Text item"/>
<Style displayNameID="Style.Grid" name="grid" reference="Grid item"/>
<Style displayNameID="Style.GridRow" name="grid-row" reference="Grid Row"/>
<Style displayNameID="Style.GridRowCell" name="grid-cell" reference="Grid Cell"/>
<Style displayNameID="Style.Data" name="data" reference="Data item"/>
<Style displayNameID="Style.Image" name="image" reference="Image item"/>
<Style displayNameID="Style.TextData" name="text-data" reference="Text data item"/>
<Style displayNameID="Style.TableGroupHeaderCell" name="table-group-header-cell" reference="Table Group Header Cell"/>
<Style displayNameID="Style.TableGroupFooterCell" name="table-group-footer-cell" reference="Table Group Footer Cell"/>
<Style displayNameID="Style.List" name="list" reference="List. Applies to all slots within the list" />
<Style displayNameID="Style.ListHeader" name="list-header" reference="List Header" />
<Style displayNameID="Style.ListFooter" name="list-footer" reference="List Footer" />
<Style displayNameID="Style.ListDetail" name="list-detail" reference="List Detail" />
<Style displayNameID="Style.Table" name="table" reference="Table Item" />
<Style displayNameID="Style.TableHeader" name="table-header" reference="Table Header" />
<Style displayNameID="Style.TableFooter" name="table-footer" reference="Table Footer" />
<Style displayNameID="Style.TableDetail" name="table-detail" reference="Table Detail" />
<Style displayNameID="Style.TableRow" name="table-row" reference="Table Row" />
<Style displayNameID="Style.TableCell" name="table-cell" reference="Table Cell" />
<Style displayNameID="Style.TableHeaderCell" name="table-header-cell" reference="Table Header Cell" />
<Style displayNameID="Style.TableFooterCell" name="table-footer-cell" reference="Table Footer Cell" />
<Style displayNameID="Style.TableDetailCell" name="table-detail-cell" reference="Table Detail Cell" />
<Style displayNameID="Style.Label" name="label" reference="Label item" />
<Style displayNameID="Style.Text" name="text" reference="Text item" />
<Style displayNameID="Style.Grid" name="grid" reference="Grid item" />
<Style displayNameID="Style.GridRow" name="grid-row" reference="Grid Row" />
<Style displayNameID="Style.GridRowCell" name="grid-cell" reference="Grid Cell" />
<Style displayNameID="Style.Data" name="data" reference="Data item" />
<Style displayNameID="Style.Image" name="image" reference="Image item" />
<Style displayNameID="Style.TextData" name="text-data" reference="Text data item" />
<Style displayNameID="Style.TableGroupHeaderCell" name="table-group-header-cell" reference="Table Group Header Cell" />
<Style displayNameID="Style.TableGroupFooterCell" name="table-group-footer-cell" reference="Table Group Footer Cell" />
<Style displayNameID="Style.TableGroupHeader1" name="table-group-header-1" reference="Table Group Header 1" />
<Style displayNameID="Style.TableGroupHeader2" name="table-group-header-2" reference="Table Group Header 2" />
<Style displayNameID="Style.TableGroupHeader3" name="table-group-header-3" reference="Table Group Header 3" />
Expand Down

0 comments on commit ceb1dde

Please sign in to comment.