Skip to content

Commit

Permalink
Initial source import
Browse files Browse the repository at this point in the history
  • Loading branch information
hrj committed Nov 29, 2014
1 parent 6374602 commit c49405e
Show file tree
Hide file tree
Showing 11 changed files with 1,423 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/co/uproot/htabs/custom/tabbedpane/CustomTabbedPane.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
Copyright 2014 Uproot Labs India Pvt Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
* Custom TabbedPane to support the indentation
* of tabs in hierarchical manner.
*/

package co.uproot.htabs.custom.tabbedpane;

import javax.swing.JTabbedPane;
import javax.swing.plaf.TabbedPaneUI;

import co.uproot.htabs.helpers.TabRects;

public class CustomTabbedPane extends JTabbedPane {

private static final long serialVersionUID = 1L;

public CustomTabbedPane() {
super();
}

public CustomTabbedPane(final int tabPlacement) {
super(tabPlacement);
}

public CustomTabbedPane(final int tabPlacement, final int tabLayoutPolicy) {
super(tabPlacement, tabLayoutPolicy);
}

@Override
public void doLayout() {
super.doLayout();

final TabbedPaneUI ui = getUI();
if (ui != null) {
if (ui instanceof TabRects) {
((TabRects) ui).computeTabRects();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright 2014 Uproot Labs India Pvt Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
* Custom TabbedPane UI for indenting the tabs.
*
*/

package co.uproot.htabs.custom.tabbedpane.ui;

import javax.swing.plaf.basic.BasicTabbedPaneUI;

import co.uproot.htabs.helpers.TabRects;
import co.uproot.htabs.tabmanager.TabManager;

public class CustomBasicTabbedPaneUI extends BasicTabbedPaneUI implements TabRects {
final private TabManager tabManager;

public CustomBasicTabbedPaneUI(final TabManager tabManager) {
this.tabManager = tabManager;
}

@Override
public void computeTabRects() {
tabManager.computeTabIndents(this.tabPane.getTabCount(), rects);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
Copyright 2014 Uproot Labs India Pvt Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
* Custom TabbedPane UI for indenting the tabs.
*
*/

package co.uproot.htabs.custom.tabbedpane.ui;

import javax.swing.plaf.metal.MetalTabbedPaneUI;

import co.uproot.htabs.helpers.TabRects;
import co.uproot.htabs.tabmanager.TabManager;

public class CustomMetalTabbedPaneUI extends MetalTabbedPaneUI implements TabRects {
final TabManager tabManager;

public CustomMetalTabbedPaneUI(final TabManager tabManager) {
this.tabManager = tabManager;
tabManager.setTabIndent(0);
tabManager.setTabComponentIndent(20);
}

@Override
public void computeTabRects() {
tabManager.computeTabIndents(this.tabPane.getTabCount(), rects);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright 2014 Uproot Labs India Pvt Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
* Custom TabbedPane UI for indenting the tabs.
*
*/

package co.uproot.htabs.custom.tabbedpane.ui;

import co.uproot.htabs.helpers.TabRects;
import co.uproot.htabs.tabmanager.TabManager;

import com.sun.java.swing.plaf.motif.MotifTabbedPaneUI;

public class CustomMotifTabbedPaneUI extends MotifTabbedPaneUI implements TabRects {
final TabManager tabManager;

public CustomMotifTabbedPaneUI(final TabManager tabManager) {
this.tabManager = tabManager;
}

@Override
public void computeTabRects() {
tabManager.computeTabIndents(this.tabPane.getTabCount(), rects);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Copyright 2014 Uproot Labs India Pvt Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
* Custom TabbedPane UI for indenting the tabs.
*
*/

package co.uproot.htabs.custom.tabbedpane.ui;

import javax.swing.plaf.synth.SynthTabbedPaneUI;

import co.uproot.htabs.helpers.TabRects;
import co.uproot.htabs.tabmanager.TabManager;

public class CustomSynthTabbedPaneUI extends SynthTabbedPaneUI implements TabRects {
final private TabManager tabManager;

public CustomSynthTabbedPaneUI(final TabManager tabManager) {
this.tabManager = tabManager;
}

public void computeTabRects() {
tabManager.computeTabIndents(this.tabPane.getTabCount(), rects);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
Copyright 2014 Uproot Labs India Pvt Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*
* Custom TabbedPane UI for indenting the tabs.
*
*/

package co.uproot.htabs.custom.tabbedpane.ui;

import co.uproot.htabs.helpers.TabRects;
import co.uproot.htabs.tabmanager.TabManager;

import com.sun.java.swing.plaf.windows.WindowsTabbedPaneUI;

public class CustomWindowsTabbedPaneUI extends WindowsTabbedPaneUI implements TabRects {
final TabManager tabManager;

public CustomWindowsTabbedPaneUI(final TabManager tabManager) {
this.tabManager = tabManager;
}

@Override
public void computeTabRects() {
tabManager.computeTabIndents(this.tabPane.getTabCount(), rects);
}
}
Loading

0 comments on commit c49405e

Please sign in to comment.