* Collapsed and Horizontal Tab for Field Group
- Hide tab area for horizontal tab if only one tab.
This commit is contained in:
parent
73cb6d88f5
commit
d03bb12c3f
|
@ -46,6 +46,8 @@ public class AdempiereLookAndFeel extends com.jgoodies.looks.plastic.Plastic3DLo
|
||||||
|
|
||||||
public static final String TABLEVEL = "TabLevel";
|
public static final String TABLEVEL = "TabLevel";
|
||||||
|
|
||||||
|
public static final String HIDE_IF_ONE_TAB = "adempiere.hideIfOneTab";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Name
|
* The Name
|
||||||
* @return Name
|
* @return Name
|
||||||
|
|
|
@ -143,6 +143,8 @@ public final class AdempiereTabbedPaneUI extends MetalTabbedPaneUI {
|
||||||
|
|
||||||
/** For use when tabLayoutPolicy == SCROLL_TAB_LAYOUT. */
|
/** For use when tabLayoutPolicy == SCROLL_TAB_LAYOUT. */
|
||||||
private ScrollableTabSupport tabScroller;
|
private ScrollableTabSupport tabScroller;
|
||||||
|
|
||||||
|
private Boolean hideIfOneTab;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the <code>PlasticTabbedPaneUI</code>.
|
* Creates the <code>PlasticTabbedPaneUI</code>.
|
||||||
|
@ -162,6 +164,7 @@ public final class AdempiereTabbedPaneUI extends MetalTabbedPaneUI {
|
||||||
super.installUI(c);
|
super.installUI(c);
|
||||||
embeddedTabs = (Boolean) c.getClientProperty(Options.EMBEDDED_TABS_KEY);
|
embeddedTabs = (Boolean) c.getClientProperty(Options.EMBEDDED_TABS_KEY);
|
||||||
noContentBorder = (Boolean) c.getClientProperty(Options.NO_CONTENT_BORDER_KEY);
|
noContentBorder = (Boolean) c.getClientProperty(Options.NO_CONTENT_BORDER_KEY);
|
||||||
|
hideIfOneTab = (Boolean) c.getClientProperty(AdempiereLookAndFeel.HIDE_IF_ONE_TAB);
|
||||||
renderer = createRenderer(tabPane);
|
renderer = createRenderer(tabPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,6 +264,10 @@ public final class AdempiereTabbedPaneUI extends MetalTabbedPaneUI {
|
||||||
private boolean hasEmbeddedTabs() {
|
private boolean hasEmbeddedTabs() {
|
||||||
return Boolean.TRUE.equals(embeddedTabs);
|
return Boolean.TRUE.equals(embeddedTabs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isHideIfOneTab() {
|
||||||
|
return Boolean.TRUE.equals(hideIfOneTab);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the renderer used to lay out and paint the tabs.
|
* Creates the renderer used to lay out and paint the tabs.
|
||||||
|
@ -1017,6 +1024,10 @@ public final class AdempiereTabbedPaneUI extends MetalTabbedPaneUI {
|
||||||
noContentBorderPropertyChanged((Boolean) e.getNewValue());
|
noContentBorderPropertyChanged((Boolean) e.getNewValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pName.equals(AdempiereLookAndFeel.HIDE_IF_ONE_TAB)) {
|
||||||
|
hideIfOneTab = (Boolean)e.getNewValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,6 +1099,14 @@ public final class AdempiereTabbedPaneUI extends MetalTabbedPaneUI {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tabCount == 1 && isHideIfOneTab()) {
|
||||||
|
rects[0].height = 0;
|
||||||
|
rects[0].width = 0;
|
||||||
|
rects[0].x = 0;
|
||||||
|
rects[0].y = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Run through tabs and partition them into runs
|
// Run through tabs and partition them into runs
|
||||||
Rectangle rect;
|
Rectangle rect;
|
||||||
for (i = 0; i < tabCount; i++) {
|
for (i = 0; i < tabCount; i++) {
|
||||||
|
@ -1594,6 +1613,14 @@ public final class AdempiereTabbedPaneUI extends MetalTabbedPaneUI {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tabCount == 1 && isHideIfOneTab()) {
|
||||||
|
rects[0].height = 0;
|
||||||
|
rects[0].width = 0;
|
||||||
|
rects[0].x = 0;
|
||||||
|
rects[0].y = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
selectedRun = 0;
|
selectedRun = 0;
|
||||||
runCount = 1;
|
runCount = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue