Example usage for com.google.gwt.user.client.ui TabPanel remove

List of usage examples for com.google.gwt.user.client.ui TabPanel remove

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui TabPanel remove.

Prototype

public boolean remove(Widget widget) 

Source Link

Document

Removes the given widget, and its associated tab.

Usage

From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java

License:Apache License

public static void clearChildren(TabPanel tp) {
    for (int i = tp.getWidgetCount() - 1; i >= 0; i--) {
        tp.remove(i);
    }//  www . j  ava2 s .c  om
}

From source file:org.drools.brms.client.ruleeditor.EditorLauncher.java

License:Apache License

/**
 * This will actually show the viewer once everything is loaded and ready.
 * @param openedViewers/*from   www . j av a  2s  .c  o  m*/
 * @param tab
 * @param uuid
 * @param readonly
 * @param asset
 */
private static void openRuleViewer(final Map openedViewers, final TabPanel tab, final String uuid,
        final boolean readonly, RuleAsset asset) {
    final RuleViewer view = new RuleViewer(asset, readonly);

    String displayName = asset.metaData.name;
    if (displayName.length() > 10) {
        displayName = displayName.substring(0, 7) + "...";
    }
    String icon = getAssetFormatIcon(asset.metaData.format);

    tab.add(view, "<img src='images/" + icon + "'>" + displayName, true);

    if (openedViewers != Collections.EMPTY_MAP) {
        openedViewers.put(uuid, view);
    }

    view.setCloseCommand(new Command() {
        public void execute() {
            tab.remove(tab.getWidgetIndex(view));
            tab.selectTab(0);
            if (openedViewers != Collections.EMPTY_MAP) {
                openedViewers.remove(uuid);
            }

        }
    });
    tab.selectTab(tab.getWidgetIndex(view));
}

From source file:org.freemedsoftware.gwt.client.PatientScreenInterface.java

License:Open Source License

/**
 * Close this screen by removing it from the tab panel.
 *///from  ww w.j a  v a 2  s  .  c  o m
public void closeScreen() {
    TabPanel t = patientScreen.getTabPanel();
    if (t.getWidgetIndex(this) != -1) {
        t.selectTab(t.getWidgetIndex(this) - 1);
        t.remove(t.getWidgetIndex(this));
    }
    Integer patientId = getPatientId();
    CurrentState.getPatientSubScreenMap().get(patientId).remove(this.getClass().getName());
}

From source file:org.freemedsoftware.gwt.client.ScreenInterface.java

License:Open Source License

/**
 * Remove the current ScreenInterface from the parent TabPanel.
 *///from   w  w  w.  j  a v  a 2  s . c  o  m
public void closeScreen() {
    TabPanel t = CurrentState.getTabPanel();
    if (t.getWidgetIndex(this) != -1) {
        t.selectTab(t.getWidgetIndex(this) - 1);
        t.remove(t.getWidgetIndex(this));
    }
    this.removeFromParent();
}

From source file:org.freemedsoftware.gwt.client.Util.java

License:Open Source License

/**
 * Close tab from main window/*from   w w w . j  a v a  2  s.  c  om*/
 * 
 * @param screen
 *            Object containing extended composite with content
 */
public static synchronized void closeTab(ScreenInterface screen) {

    TabPanel t = CurrentState.getTabPanel();
    t.selectTab(t.getWidgetIndex(screen) - 1);
    t.remove(t.getWidgetIndex(screen));

    // Special handling for PatientScreen
    if (screen instanceof PatientScreen) {
        HashMap<Integer, PatientScreen> map = CurrentState.getPatientScreenMap();
        Integer oldId = ((PatientScreen) screen).getPatient();
        if (map.get(oldId) != null) {
            map.remove(oldId);
        }
    }
}