Example usage for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setHorizontalAlignment

Introduction

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

Prototype

public void setHorizontalAlignment(HorizontalAlignmentConstant align) 

Source Link

Document

Sets the default horizontal alignment to be used for widgets added to this panel.

Usage

From source file:net.cbtltd.client.form.OrganizationForm.java

License:Open Source License

private HorizontalPanel createCommands() {

    final HorizontalPanel bar = new HorizontalPanel();
    bar.addStyleName(AbstractField.CSS.cbtAbstractCommand());

    final LocalRequest resetRequest = new LocalRequest() {
        protected void perform() {
            onFocus();/*from   w  w w  .  jav a 2  s.  c  om*/
        }
    }; //onReset(Organization.CREATED);}};

    //-----------------------------------------------
    // Save button
    //-----------------------------------------------
    final CommandButton saveButton = new CommandButton(this, AbstractField.CONSTANTS.allSave(),
            organizationUpdate, tab++);
    saveButton.addStyleName(AbstractField.CSS.cbtCommandButtonTwo());
    saveButton.setTitle(CONSTANTS.saveHelp());
    bar.add(saveButton);

    //-----------------------------------------------
    // Delete button
    //-----------------------------------------------
    final CommandButton deleteButton = new CommandButton(this, CONSTANTS.deleteButton(), partyDelete, tab++);
    deleteButton.addStyleName(AbstractField.CSS.cbtCommandButtonTwo());
    deleteButton.addStyleName(AbstractField.CSS.cbtCommandButtonGray());
    deleteButton.setTitle(CONSTANTS.deleteHelp());
    bar.add(deleteButton);

    //-----------------------------------------------
    // Cancel button
    //-----------------------------------------------
    final HorizontalPanel cancelBar = new HorizontalPanel();
    final CommandButton cancelButton = new CommandButton(this, AbstractField.CONSTANTS.allCancel(),
            resetRequest, tab++);
    deleteButton.addStyleName(AbstractField.CSS.cbtCommandButtonTwo());
    cancelButton.addStyleName(AbstractField.CSS.cbtCommandButtonGray());
    cancelButton.setTitle(CONSTANTS.cancelHelp());
    cancelBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    cancelBar.add(cancelButton);
    bar.add(cancelBar);

    //-----------------------------------------------
    // The array of transitions to define the finite state machine.
    //-----------------------------------------------
    fsm = new ArrayList<Transition>();
    fsm.add(new Transition(Organization.INITIAL, saveButton, Organization.CREATED));
    fsm.add(new Transition(Organization.INITIAL, cancelButton, Organization.CREATED));
    //      fsm.add(new Transition(Organization.CREATED, createButton, Organization.INITIAL));
    //      fsm.add(new Transition(Organization.CREATED, copyButton, Organization.INITIAL));
    fsm.add(new Transition(Organization.CREATED, saveButton, Organization.CREATED));
    fsm.add(new Transition(Organization.CREATED, deleteButton, Organization.CREATED));

    return bar;
}

From source file:net.cbtltd.client.form.PartyForm.java

public void initialize() {
    AbstractField.CSS.ensureInjected();
    CSS.ensureInjected();//from  w  ww.j a  v  a 2 s  .  co  m

    final ScrollPanel scroll = new ScrollPanel();
    add(scroll);
    final HorizontalPanel panel = new HorizontalPanel();
    panel.addStyleName(AbstractField.CSS.cbtAbstractWidth());
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    scroll.add(panel);
    final HorizontalPanel content = new HorizontalPanel();
    panel.add(content);

    createActions();

    content.add(createContent());
    stackPanel = new StackLayoutPanel(com.google.gwt.dom.client.Style.Unit.EM);
    content.add(stackPanel);
    stackPanel.setVisible(true);
    stackPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        public void onSelection(SelectionEvent<Integer> event) {
            if (event.getSelectedItem() != 0 && partyField.noValue()) {
                AbstractField.addMessage(Level.ERROR, CONSTANTS.partyError(), partyField);
            }
            refreshStackPanel();
        }
    });
    stackPanel.addStyleName(CSS.stackStyle());
    stackPanel.add(createDescription(), CONSTANTS.descriptionLabel(), 1.5);
    stackPanel.add(createContact(), CONSTANTS.contactLabel(), 1.5);
    stackPanel.add(createReservation(), CONSTANTS.reservationLabel(), 1.5);
    stackPanel.add(createRelation(), CONSTANTS.relationLabel(), 1.5);
    //      stackPanel.add(createFinance(), CONSTANTS.financesLabel(), 1.5);
    stackPanel.add(createEventJournal(), CONSTANTS.eventjournalLabel(), 1.5);
    onRefresh();
    onReset(Party.CREATED);
    //      Window.alert("initialized");
}

From source file:net.cbtltd.client.form.ProductForm.java

public void initialize() {
    AbstractField.CSS.ensureInjected();
    CSS.ensureInjected();//from w  w w  .  j  a  v  a  2s  .c  o m

    final ScrollPanel scroll = new ScrollPanel();
    add(scroll);
    final HorizontalPanel panel = new HorizontalPanel();
    panel.addStyleName(AbstractField.CSS.cbtAbstractWidth());
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    scroll.add(panel);
    final HorizontalPanel content = new HorizontalPanel();
    panel.add(content);

    createActions();
    content.add(createContent());
    stackPanel = new StackLayoutPanel(com.google.gwt.dom.client.Style.Unit.EM);
    content.add(stackPanel);
    stackPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        public void onSelection(SelectionEvent<Integer> event) {
            if (event.getSelectedItem() != 0 && productField.noValue()) {
                AbstractField.addMessage(Level.ERROR, CONSTANTS.productError(), productField);
            }
            refreshStackPanel();
        }
    });
    stackPanel.addStyleName(CSS.stackStyle());
    stackPanel.add(createDescription(), CONSTANTS.descriptionLabel(), 1.5);
    stackPanel.add(createText(), CONSTANTS.textLabel(), 1.5);
    stackPanel.add(mapField, CONSTANTS.mapLabel(), 1.5);
    stackPanel.add(imageGallery, CONSTANTS.imageLabel(), 1.5);
    stackPanel.add(createPrice(), CONSTANTS.priceLabel(), 1.5);
    stackPanel.add(createTax(), CONSTANTS.taxLabel(), 1.5);
    stackPanel.add(createYield(), CONSTANTS.yieldLabel(), 1.5);
    stackPanel.add(createFeature(), CONSTANTS.featureLabel(), 1.5);
    stackPanel.add(createAsset(), CONSTANTS.assetLabel(), 1.5);
    stackPanel.add(createAudit(), CONSTANTS.auditLabel(), 1.5);
    stackPanel.add(createAlert(), CONSTANTS.alertLabel(), 1.5);

    productTable = createProduct();
    //      stackPanel.add(createService(), CONSTANTS.serviceLabel(), 1.5);
    createService();
    onRefresh();
    onReset(Product.CREATED);
    triggerResize();
}

From source file:net.cbtltd.client.form.ReservationForm.java

@Override
public void initialize() {
    AbstractField.CSS.ensureInjected();
    CSS.ensureInjected();//from w ww  . ja va 2s.  com

    final ScrollPanel scroll = new ScrollPanel();
    add(scroll);
    final HorizontalPanel panel = new HorizontalPanel();
    panel.addStyleName(AbstractField.CSS.cbtAbstractWidth());
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    scroll.add(panel);

    final HorizontalPanel content = new HorizontalPanel();
    panel.add(content);

    createActions();

    content.add(createContent());
    stackPanel = new StackLayoutPanel(com.google.gwt.dom.client.Style.Unit.EM);
    content.add(stackPanel);

    stackPanel.addSelectionHandler(new SelectionHandler<Integer>() {
        @Override
        public void onSelection(SelectionEvent<Integer> event) {
            if (event.getSelectedItem() != 0 && reservationField.noValue()) {
                AbstractField.addMessage(Level.ERROR, CONSTANTS.reservationError(), reservationField);
            }
            refreshStackPanel();
        }
    });

    stackPanel.addStyleName(CSS.stackStyle());
    stackPanel.add(createHospitality(), CONSTANTS.hospitalityLabel(), 1.5);
    stackPanel.add(createFeature(), CONSTANTS.featureLabel(), 1.5);
    stackPanel.add(createMaintenance(), CONSTANTS.maintenanceLabel(), 1.5);
    stackPanel.add(createFinancial(), CONSTANTS.financeLabel(), 1.5);
    createService();
    //      stackPanel.add(createService(), CONSTANTS.serviceLabel(), 1.5);
    onRefresh();
    onReset(Reservation.State.Provisional.name());
}

From source file:net.cbtltd.client.form.SearchForm.java

private VerticalPanel createSearch() {
    final VerticalPanel form = new VerticalPanel();
    form.addStyleName(AbstractField.CSS.cbtAbstractControl());

    //-----------------------------------------------
    // Advanced button
    //-----------------------------------------------
    //      advancedLabel = new HTML(CONSTANTS.advancedLabel());
    advancedLabel = new Button(CONSTANTS.advancedLabel());
    advancedLabel.addClickHandler(new ClickHandler() {
        @Override/*from   w w  w.ja  va 2  s .c  om*/
        public void onClick(ClickEvent event) {
            setAdvancedSearch(true);
        }
    });
    advancedLabel.addStyleName(CSS.searchLabel());
    advancedLabel.addStyleName(AbstractField.CSS.cbtAbstractCursor());
    form.add(advancedLabel);

    //-----------------------------------------------
    // Basic button
    //-----------------------------------------------
    //      basicLabel = new HTML(CONSTANTS.basicLabel());
    basicLabel = new Button(CONSTANTS.basicLabel());
    basicLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            setAdvancedSearch(false);
        }
    });
    basicLabel.addStyleName(CSS.searchLabel());
    basicLabel.addStyleName(AbstractField.CSS.cbtAbstractCursor());
    form.add(basicLabel);

    //-----------------------------------------------
    // Location field
    //-----------------------------------------------
    locationField = new LocationField(this, null, null, CONSTANTS.locationButton(), tab++);
    locationField.setDefaultValue(LatLng.newInstance(AbstractRoot.getDoubleValue(Party.Value.Latitude.name()),
            AbstractRoot.getDoubleValue(Party.Value.Longitude.name())));
    locationField.setFieldStyle(CSS.locationStyle());
    locationField.setHelpText(CONSTANTS.locationHelp());

    final HelpHTML whereLabel = new HelpHTML(CONSTANTS.whereLabel(), CONSTANTS.locationHelp(), locationField);
    whereLabel.addStyleName(CSS.searchLabel());
    whereLabel.addStyleName(CSS.searchLabelTop());
    form.add(whereLabel);
    form.add(locationField);

    //-----------------------------------------------
    // Distance from centre with one anchor slider
    // DISTANCE_INDEX is the zero based index into DISTANCE_MAP
    // DISTANCE_MAP translates the index into the distances:
    // 500m, 1km, 2km, 5km, 10km, 20km, 50km, 100km
    //-----------------------------------------------
    final Integer[] DISTANCE_INDEX = { 0, 7, 1, 7 };
    final Double[] DISTANCE_MAP = { 0.5, 1.0, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0 };
    distanceField = new SliderField(this, null, CONSTANTS.distanceLabel(), DISTANCE_INDEX, tab++);
    distanceField.setValueMap(DISTANCE_MAP);
    distanceField.setUnit(CONSTANTS.distanceUnit());
    distanceField.setDefaultValue(DEFAULT_DISTANCE_INDEX);
    distanceField.setFieldStyle(CSS.distanceStyle());
    distanceField.setHelpText(CONSTANTS.distanceHelp());
    //      form.add(distanceField);

    //-----------------------------------------------
    // Toggle field between kilometer/mile
    //-----------------------------------------------
    distanceunitField = new ToggleField(this, null, CONSTANTS.distanceunitLabel(), CONSTANTS.distanceunitKmt(),
            CONSTANTS.distanceunitSmi(), tab++);
    distanceunitField.setFieldStyle(CSS.distanceunitStyle());
    //      distanceunitField.setDefaultValue(AbstractRoot.getBooleanValue(Party.Value.Countunit.name()));
    distanceunitField.setHelpText(CONSTANTS.countunitHelp());

    HorizontalPanel distance = new HorizontalPanel();
    distance.addStyleName(AbstractField.CSS.cbtAbstractField());
    distance.addStyleName(CSS.labelStyle());
    form.add(distance);
    distance.add(distanceField);
    distance.add(distanceunitField);

    final HTML whenLabel = new HTML(CONSTANTS.whenLabel(), true);
    whenLabel.addStyleName(CSS.searchLabel());
    form.add(whenLabel);

    //-----------------------------------------------
    // Check to show only specials
    //-----------------------------------------------
    specialField = new ToggleField(this, null, CONSTANTS.specialLabel(), CONSTANTS.specialupLabel(),
            CONSTANTS.specialdownLabel(), tab++);
    specialField.setLabelStyle(CSS.specialLabel());
    specialField.setFieldStyle(CSS.specialField());
    specialField.setHelpText(CONSTANTS.specialHelp());
    form.add(specialField);

    //-----------------------------------------------
    // Date Range for reservation or special
    //-----------------------------------------------
    fromtodateField = new DatespanField(this, null, CONSTANTS.fromtodateLabel(), tab++);
    fromtodateField.setFieldStyle(CSS.fromtodateField());
    fromtodateField.setHelpText(CONSTANTS.fromtodateHelp());
    //form.add(fromtodateField);

    //-----------------------------------------------
    // Check to show on and off line availability
    //-----------------------------------------------
    offlineField = new ToggleField(this, null, CONSTANTS.offlineLabel(), CONSTANTS.offlineupLabel(),
            CONSTANTS.offlinedownLabel(), tab++);
    offlineField.setLabelStyle(CSS.offlineLabel());
    offlineField.setFieldStyle(CSS.offlineField());
    offlineField.setHelpText(CONSTANTS.offlineHelp());
    //form.add(specialField);
    final HorizontalPanel fo = new HorizontalPanel();
    fo.add(fromtodateField);
    fo.add(offlineField);
    form.add(fo);

    //-----------------------------------------------
    // Days field
    //-----------------------------------------------
    final Integer[] DAYS = { 0, 90, 1, 0 };
    durationField = new SliderField(this, null, CONSTANTS.durationLabel(), DAYS, tab++);
    durationField.setUnit(CONSTANTS.durationUnit());
    durationField.setFieldStyle(CSS.daysStyle());
    durationField.setHelpText(CONSTANTS.durationHelp());
    form.add(durationField);

    //-----------------------------------------------
    // Duration range with two anchor slider
    //-----------------------------------------------
    final Integer[] DAYSRANGE = { 1, 30, 1, 1, 30 };
    daysrangeField = new SliderField(this, null, CONSTANTS.daysrangeLabel(), DAYSRANGE, tab++);
    daysrangeField.setUnit(CONSTANTS.daysrangeUnit());
    daysrangeField.setFieldStyle(CSS.pricerangeStyle());
    daysrangeField.setVisible(false);
    daysrangeField.setHelpText(CONSTANTS.daysrangeHelp());
    form.add(daysrangeField);

    whatLabel = new HTML(CONSTANTS.whatLabel(), true);
    whatLabel.addStyleName(CSS.searchLabel());
    whatLabel.setVisible(true);
    form.add(whatLabel);

    HorizontalPanel count = new HorizontalPanel();
    count.addStyleName(AbstractField.CSS.cbtAbstractField());
    count.addStyleName(CSS.labelStyle());
    form.add(count);

    //-----------------------------------------------
    // Count field for number of people/rooms
    //-----------------------------------------------
    countField = new SpinnerField(this, null, 1, 99, null, //CONSTANTS.countLabel(),            
            tab++);
    countField.setFieldStyle(CSS.countField());
    countField.setDefaultValue(1);
    countField.setHelpText(CONSTANTS.countHelp());
    countLabel = new HelpLabel(CONSTANTS.countLabel(), CONSTANTS.countHelp(), countField);
    count.add(countLabel);
    exactcountLabel = new HelpLabel(CONSTANTS.countLabel(), CONSTANTS.countHelp(), countField);
    count.add(exactcountLabel);
    count.add(countField);

    //-----------------------------------------------
    // Toggle field between people/rooms
    //-----------------------------------------------
    countunitField = new ToggleField(this, null, null, //CONSTANTS.countunitLabel(),
            CONSTANTS.countunitBedroom(), CONSTANTS.countunitPerson(), tab++);
    countunitField.setFieldStyle(CSS.countunitStyle());
    countunitField.setDefaultValue(AbstractRoot.getBooleanValue(Party.Value.Countunit.name()));
    countunitField.setHelpText(CONSTANTS.countunitHelp());
    HelpLabel countunitLabel = new HelpLabel(CONSTANTS.countunitLabel(), CONSTANTS.countunitHelp(),
            countunitField);
    count.add(countunitLabel);
    count.add(countunitField);

    pricePanel = new HorizontalPanel();
    pricePanel.addStyleName(AbstractField.CSS.cbtAbstractField());
    form.add(pricePanel);

    //-----------------------------------------------
    // Currency field
    //-----------------------------------------------
    pricePanel.addStyleName(CSS.labelStyle());
    currencyField = new ListField(this, null, new CurrencyrateNameId(), null, false, tab++);
    currencyField.setFieldStyle(CSS.currencyField());
    currencyField.setDefaultValue(AbstractRoot.getValue(Party.Value.Currency.name()));
    currencyField.setHelpText(CONSTANTS.currencyHelp());
    currencyLabel = new HelpLabel(CONSTANTS.currencyLabel(), CONSTANTS.currencyHelp(), currencyField);
    pricePanel.add(currencyLabel);
    pricePanel.add(currencyField);

    //-----------------------------------------------
    // Price range unit field between stay/night
    //-----------------------------------------------
    priceunitField = new ToggleField(this, null, null, CONSTANTS.priceunitNight(), CONSTANTS.priceunitStay(),
            tab++);
    priceunitField.setFieldStyle(CSS.priceunitStyle());
    priceunitField.setDefaultValue(AbstractRoot.getBooleanValue(Party.Value.Priceunit.name()));
    priceunitField.setHelpText(CONSTANTS.priceunitHelp());
    priceunitLabel = new HelpLabel(CONSTANTS.priceunitLabel(), CONSTANTS.priceunitHelp(), priceunitField);
    pricePanel.add(priceunitLabel);
    pricePanel.add(priceunitField);

    //-----------------------------------------------
    // Price range with two anchor slider
    //-----------------------------------------------
    final Integer[] PRICERANGE = { 0, 2000, 50, 0, 2000 };
    pricerangeField = new SliderField(this, null, CONSTANTS.pricerangeLabel(), PRICERANGE, tab++);
    pricerangeField.setUnlimitedValue(Integer.MAX_VALUE);
    pricerangeField.setFieldStyle(CSS.pricerangeStyle());
    pricerangeField.setHelpText(CONSTANTS.pricerangeHelp());
    form.add(pricerangeField);

    //-----------------------------------------------
    // Rating range with one anchor slider
    //-----------------------------------------------
    final Integer[] RATINGS = { 0, 10, 1, 0 };
    ratingField = new SliderField(this, null, CONSTANTS.ratingLabel(), RATINGS, tab++) {
        public Widget getWidget(int value) {
            return new Image(AbstractField.STARS[value]);
        }
    };
    ratingField.setSliderStyle(CSS.ratingSlider());
    ratingField.setHelpText(CONSTANTS.ratingHelp());
    form.add(ratingField);

    //-----------------------------------------------
    // Minimum commission with one anchor slider
    //-----------------------------------------------
    Integer[] COMMISSION = { 0, 50, 1, 0 };
    commissionField = new SliderField(this, null, CONSTANTS.commissionLabel(), COMMISSION, tab++);
    commissionField.setUnit(CONSTANTS.commissionUnit());
    commissionField.setFieldStyle(CSS.commissionStyle());
    commissionField.setHelpText(CONSTANTS.commissionHelp());
    form.add(commissionField);

    //-----------------------------------------------
    // Attribute shuttle
    //-----------------------------------------------
    attributeField = new StackField(this, null,
            new AttributeMapAction(Attribute.ACCOMMODATION_SEARCH, Attribute.RZ, AbstractRoot.getLanguage()),
            null, tab++);
    attributeField.setUniquekeys(Attribute.UNIQUE_KEYS);
    attributeField.setHelpText(CONSTANTS.attributeHelp());

    attributeButton = new Button(CONSTANTS.attributeButton(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            attributeField.deselect();
            attributeButton.setVisible(false);
            event.stopPropagation();
            availableTable.execute();
            specialTable.execute();
        }
    });
    //      attributeButton.addStyleName(CSS.attributeButton());
    attributeButton.setVisible(false);
    final HorizontalPanel header = new HorizontalPanel();

    attributeLabel = new DisclosurePanel("");//CONSTANTS.attributeLabel());

    //http://www.summa-tech.com/blog/2010/04/19/gwt-disclosurepanel-openclose-without-header/
    Widget defaultHeader = attributeLabel.getHeader();
    //HorizontalPanel newHeader = new HorizontalPanel();
    header.add(defaultHeader);
    //Widget widget = new Button(CONSTANTS.attributeLabel());
    header.add(new Button(CONSTANTS.attributeLabel()));
    //      attributeLabel.setHeader(newHeader);

    //      attributeLabel.getHeader().addStyleName(CSS.attributeHeader());
    //      header.add(attributeLabel.getHeader());
    header.add(attributeButton);
    attributeLabel.setHeader(header);
    attributeLabel.setAnimationEnabled(true);
    final ScrollPanel scroll = new ScrollPanel();
    scroll.add(attributeField);
    scroll.addStyleName(CSS.attributeContent());
    attributeLabel.setContent(scroll);
    attributeLabel.addOpenHandler(new OpenHandler<DisclosurePanel>() {
        public void onOpen(OpenEvent<DisclosurePanel> event) {
            setAttributeInvisible(false);
        }
    });
    attributeLabel.addCloseHandler(new CloseHandler<DisclosurePanel>() {
        public void onClose(CloseEvent<DisclosurePanel> event) {
            setAttributeInvisible(true);
        }
    });
    form.add(attributeLabel);

    actionLabel = new HelpHTML(CONSTANTS.wishLabel(), CONSTANTS.attributeHelp(), attributeLabel.getHeader());
    actionLabel.addStyleName(CSS.searchLabel());
    form.add(actionLabel);

    final HorizontalPanel bar = new HorizontalPanel();
    bar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    bar.addStyleName(AbstractField.CSS.cbtAbstractCommand());

    Button previewButton = new Button(CONSTANTS.previewButton(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (noSelectedItems()) {
                AbstractField.addMessage(Level.ERROR, CONSTANTS.previewbuttonError(), availableTable);
            } else {
                BrochurePopup.getInstance().show(getSelectedItems());
            }
        }
    });
    previewButton.addStyleName(AbstractField.CSS.cbtCommandButton());
    previewButton.addStyleName(AbstractField.CSS.cbtCommandButtonTwo());
    previewButton.addStyleName(AbstractField.CSS.cbtGradientBlue());
    bar.add(previewButton);

    Button bookButton = new Button(CONSTANTS.bookButton(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            Date fromdate = Time.getDateServer(fromtodateField.getValue());
            Date todate = Time.getDateServer(fromtodateField.getTovalue());
            if (countSelectedItems() != 1) {
                AbstractField.addMessage(Level.ERROR, CONSTANTS.bookbuttonError(), availableTable);
            } else if (AbstractRoot.readable(AccessControl.ORGANIZATION_ROLES)) {
                AbstractRoot.render(Razor.RESERVATION_TAB, getSelectedItems().get(0).getReservation(fromdate,
                        todate, AbstractRoot.getActorid(), null, null));
            } else {
                ReservationPopup.getInstance()
                        .show(getSelectedItems().get(0).getReservation(fromdate, todate,
                                AbstractRoot.getActorid(), null, null),
                                availableTable.isVisible() ? availableTable : specialTable);
            }
        }
    });
    bookButton.addStyleName(AbstractField.CSS.cbtCommandButton());
    bookButton.addStyleName(AbstractField.CSS.cbtCommandButtonTwo());
    bookButton.addStyleName(AbstractField.CSS.cbtGradientGreen());
    bar.add(bookButton);

    form.add(bar);

    setAdvancedSearch(false);
    components.onReset();
    currencyrateRead.execute();
    return form;
}

From source file:net.cbtltd.client.form.SessionForm.java

@Override
public void initialize() {
    AbstractField.CSS.ensureInjected();
    CSS.ensureInjected();/*from  www.  j a v  a 2 s  .  c o  m*/

    final ScrollPanel scroll = new ScrollPanel();
    add(scroll);
    final HorizontalPanel panel = new HorizontalPanel();
    panel.setWidth("100%");
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    //panel.addStyleName(AbstractField.CSS.cbtAbstractForm());
    //panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    scroll.add(panel);

    final FlowPanel west = new FlowPanel();
    //      panel.add(west);
    final FlowPanel sessionForm = new FlowPanel();
    sessionForm.addStyleName(AbstractField.CSS.cbtAbstractControl());
    sessionForm.addStyleName(CSS.formStyle());
    sessionForm.addStyleName(CSS.magnify());
    west.add(sessionForm);

    final Frame frame = new Frame(HOSTS.cloudUrl());
    frame.setStylePrimaryName(CSS.frameStyle());
    //      panel.add(frame);

    //Rishi
    VerticalPanel frontPanel = new VerticalPanel();

    frontPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    frontPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    frontPanel.addStyleName(CSS.loginPopup());
    panel.add(frontPanel);

    // Add the header label
    Label loginFormLabel = new Label(CONSTANTS.headerLabel());
    loginFormLabel.addStyleName(CSS.frontHeaderStyle());
    frontPanel.add(loginFormLabel);

    // Create a horizontal panel to add the login window and registration window
    HorizontalPanel loginRegPanel = new HorizontalPanel();

    // Add the login Panel
    loginRegPanel.add(new LoginWindow());

    // Add the registration Panel
    VerticalPanel registrationPanel = new VerticalPanel();
    registrationPanel.addStyleName(CSS.registerForm());

    Label registerHeaderLabel = new Label("Register");
    registerHeaderLabel.addStyleName(CSS.signLabel());

    Label registerPropertyButton = new Label(CONSTANTS.registerPropertyLabel());
    registerPropertyButton.addStyleName(CSS.passwordcreateStyle());
    registerPropertyButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            AbstractRoot.renderTabs(Razor.ORGANIZATION_TAB, new Organization());
        }
    });

    Label registerTravelButton = new Label(CONSTANTS.registerTravelLabel());
    registerTravelButton.addStyleName(CSS.passwordcreateStyle());
    registerTravelButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            AbstractRoot.renderTabs(Razor.ORGANIZATION_TAB, new Agent());
        }
    });

    registrationPanel.add(registerHeaderLabel);
    registrationPanel.add(registerPropertyButton);
    registrationPanel.add(registerTravelButton);

    loginRegPanel.add(registrationPanel);

    frontPanel.add(loginRegPanel);

    //-----------------------------------------------
    // Log In button
    //-----------------------------------------------
    final HTML loginButton = new HTML(CONSTANTS.loginLabel());
    loginButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            new SessionPopup().center();
        }
    });
    loginButton.addStyleName(CSS.sessionButton());
    loginButton.addStyleName(CSS.loginButton());
    loginButton.addStyleName(AbstractField.CSS.cbtGradientGreen());
    sessionForm.add(loginButton);

    final Label registerLabel = new Label(CONSTANTS.registerLabel());
    registerLabel.addStyleName(CSS.registerLabel());
    sessionForm.add(registerLabel);

    //-----------------------------------------------
    // Register Agent button
    //-----------------------------------------------
    final HTML registeragentButton = new HTML(CONSTANTS.registeragentLabel());
    registeragentButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            AbstractRoot.renderTabs(Razor.ORGANIZATION_TAB, new Agent());
        }
    });
    registeragentButton.addStyleName(CSS.sessionButton());
    registeragentButton.addStyleName(CSS.registerButton());
    registeragentButton.addStyleName(AbstractField.CSS.cbtGradientBase());
    sessionForm.add(registeragentButton);

    //-----------------------------------------------
    // Register Manager button
    //-----------------------------------------------
    final HTML registermanagerButton = new HTML(CONSTANTS.registermanagerLabel());
    registermanagerButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            AbstractRoot.renderTabs(Razor.ORGANIZATION_TAB, new Organization());
        }
    });
    registermanagerButton.addStyleName(CSS.sessionButton());
    registermanagerButton.addStyleName(CSS.registerButton());
    registermanagerButton.addStyleName(AbstractField.CSS.cbtGradientBase());
    sessionForm.add(registermanagerButton);

    //-----------------------------------------------
    // Register Affiliate button
    //-----------------------------------------------
    final HTML registercreatorButton = new HTML(CONSTANTS.registercreatorLabel());
    registercreatorButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            PartyPopup.getInstance().show(Party.Type.Affiliate, null, null);
        }
    });
    registercreatorButton.addStyleName(CSS.sessionButton());
    registercreatorButton.addStyleName(CSS.registerButton());
    registercreatorButton.addStyleName(AbstractField.CSS.cbtGradientBase());
    sessionForm.add(registercreatorButton);

    Label infoLabel = new Label(CONSTANTS.infoLabel());
    infoLabel.addStyleName(CSS.registerLabel());
    sessionForm.add(infoLabel);

    //-----------------------------------------------
    // More Info button
    //-----------------------------------------------
    final HTML infoButton = new HTML(CONSTANTS.infoButton());
    infoButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.open(HOSTS.infoUrl(), CONSTANTS.infoTitle(),
                    "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
        }
    });
    infoButton.addStyleName(CSS.sessionButton());
    infoButton.addStyleName(CSS.registerButton());
    infoButton.addStyleName(AbstractField.CSS.cbtGradientBase());
    sessionForm.add(infoButton);

    FlowPanel shadow = new FlowPanel();
    shadow.addStyleName(AbstractField.CSS.cbtAbstractShadow());
    west.add(shadow);

    //      if(getUserAgent().contains("msie")) {
    //         loginButton.setVisible(false);
    //         registerLabel.setVisible(false);
    //         registeragentButton.setVisible(false);
    //         registermanagerButton.setVisible(false);
    //         sessionError.setVisible(true);
    //      }
    onRefresh();
    onReset(Session.LOGGED_OUT);
}

From source file:net.imgseek.server.admin.client.Iskdaemon_admin.java

License:GNU General Public License

public void onModuleLoad() {

    WEB_ENDPOINT = GWT.getModuleBaseURL();

    // Load all the sinks.
    loadSinks();//from  w  w w .j  a  v a  2 s. co  m

    // Status panel
    statusPanel.setVisible(false);
    statusPanel.setStyleName("msg-alert");
    statusPanel.add(statusMessageLabel);
    statusPanel.setSpacing(8);
    statusPanel.setWidth("100%");
    Button closeBtn = new Button("Dismiss", new ClickHandler() {
        public void onClick(ClickEvent event) {
            statusPanel.setVisible(false);
        }
    });

    statusPanel.add(closeBtn);

    // Put the sink list on the left, and add the outer dock panel to the
    // root.
    sinkContainer = new DockPanel();
    sinkContainer.setStyleName("ks-Sink");

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.add(statusPanel);
    vp.add(description);
    vp.add(sinkContainer);

    description.setStyleName("ks-Info");

    // Common Header
    HorizontalPanel hpHeader = new HorizontalPanel();
    hpHeader.setWidth("100%");
    hpHeader.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    HTML iskTitle = new HTML("isk-daemon (" + VERSION + ")");// " at <i>" +
    // WEB_ENDPOINT
    // +
    // "</i>");
    // TODO show remote server name when cluster funcionality is implemented
    iskTitle.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    hpHeader.add(iskTitle);

    // Compose dock panel
    panel.add(hpHeader, DockPanel.NORTH);
    panel.add(list, DockPanel.WEST);
    panel.add(vp, DockPanel.CENTER);

    panel.setCellVerticalAlignment(list, HasAlignment.ALIGN_TOP);
    panel.setCellWidth(vp, "100%");
    RootPanel.get().add(panel);

    // Common Footer
    HorizontalPanel hpFooter = new HorizontalPanel();
    hpFooter.setWidth("100%");
    hpFooter.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    HTML copyRightFooter = new HTML(
            "<div align='right'>Copyright &copy; <a target='_blank' href='http://server.imgseek.net/'>imgSeek</a>. All rights reserved. Licensed under the <a href='http://www.gnu.org/licenses/gpl-2.0-standalone.html'>GPLv2</a></div>");
    copyRightFooter.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    // hpFooter.add(footerShare);
    hpFooter.add(copyRightFooter);
    RootPanel.get().add(hpFooter);

    // Start timer
    Timer t = new Timer() {
        public void run() {
            for (@SuppressWarnings("unchecked")
            Iterator<SinkInfo> iter = list.getSinks().iterator(); iter.hasNext();) {
                SinkInfo element = iter.next();
                element.getInstance().autoRefreshAll();
            }
        }
    };
    // Schedule the timer to run once in 5 seconds.
    t.scheduleRepeating(5000);

    // If the application starts with no history token, redirect to a new
    String initToken = History.getToken();
    if (initToken.length() == 0) {
        History.newItem("Status");
    }
    // Add history listener
    History.addValueChangeHandler(this);
    // Now that we've setup our listener, fire the initial history state.
    History.fireCurrentHistoryState();

    // TODO: check if iskdaemon instance is passwd protect then prompt for
    // login: http://code.google.com/p/gwt-stuff/
}

From source file:net.scran24.common.client.UiHelper.java

public static Widget createFullPageSection(Widget contents, HorizontalAlignmentConstant horizontalAlignment,
        VerticalAlignmentConstant verticalAlignment) {
    VerticalPanel outerPanel = new VerticalPanel();
    outerPanel.addStyleName("scran24-full-page-section");

    HorizontalPanel alignPanel = new HorizontalPanel();
    alignPanel.setVerticalAlignment(verticalAlignment);
    alignPanel.setHorizontalAlignment(horizontalAlignment);
    alignPanel.setWidth("100%");
    alignPanel.setHeight("100%");

    alignPanel.add(contents);/*from  w w w .j  ava2s.c o m*/

    outerPanel.add(alignPanel);

    return outerPanel;
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.Clustering.java

License:Apache License

@Override
public void buildPanel() {
    csVPanel = new ViewerPanel();
    KmlDataSourceLoadStaticOptions kmlDataSourceOptions = KmlDataSourceLoadStaticOptions
            .create(csVPanel.getViewer().camera, csVPanel.getViewer().canvas());
    Promise<KmlDataSource, Void> dataSourcePromise = csVPanel.getViewer().dataSources().add(KmlDataSource
            .load(GWT.getModuleBaseURL() + "SampleData/kml/facilities/facilities.kml", kmlDataSourceOptions));
    dataSourcePromise.then(new Fulfill<KmlDataSource>() {
        @Override//from w w w  .  j a  va  2 s .  c o m
        public void onFulfilled(KmlDataSource dataSource) {
            int pixelRange = 25;
            int minimumClusterSize = 3;
            boolean enabled = true;

            dataSource.clustering.enabled = enabled;
            dataSource.clustering.pixelRange = pixelRange;
            dataSource.clustering.minimumClusterSize = minimumClusterSize;

            PinBuilder pinBuilder = new PinBuilder();
            pin50 = pinBuilder.fromText("50+", Color.RED(), 48).toDataUrl();
            pin40 = pinBuilder.fromText("40+", Color.ORANGE(), 48).toDataUrl();
            pin30 = pinBuilder.fromText("30+", Color.YELLOW(), 48).toDataUrl();
            pin20 = pinBuilder.fromText("20+", Color.GREEN(), 48).toDataUrl();
            pin10 = pinBuilder.fromText("10+", Color.BLUE(), 48).toDataUrl();

            singleDigitPins = new String[8];
            for (int i = 0; i < singleDigitPins.length; ++i) {
                singleDigitPins[i] = pinBuilder.fromText("" + (i + 2), Color.VIOLET(), 48).toDataUrl();
            }
            // start with custom style
            customStyle(dataSource);

            _dataSource = dataSource;
        }
    });

    pixelRangeSlider = new Slider("pixelRange", 1, 200, 15);
    pixelRangeSlider.setStep(1);
    pixelRangeSlider.setWidth("150px");
    pixelRangeSlider.addListener(new MSliderListener());
    pixelRangeTBox = new TextBox();
    pixelRangeTBox.addChangeHandler(new MChangeHandler());
    pixelRangeTBox.setText("" + 15);
    pixelRangeTBox.setSize("30px", "12px");

    HorizontalPanel pixelRangeHPanel = new HorizontalPanel();
    pixelRangeHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    pixelRangeHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pixelRangeHPanel.setSpacing(10);
    pixelRangeHPanel.add(pixelRangeSlider);
    pixelRangeHPanel.add(pixelRangeTBox);

    minimumClusterSizeSlider = new Slider("minimumClusterSize", 1, 20, 3);
    minimumClusterSizeSlider.setStep(1);
    minimumClusterSizeSlider.setWidth("150px");
    minimumClusterSizeSlider.addListener(new MSliderListener());
    minimumClusterSizeTBox = new TextBox();
    pixelRangeTBox.addChangeHandler(new MChangeHandler());
    minimumClusterSizeTBox.setText("" + 3);
    minimumClusterSizeTBox.setSize("30px", "12px");

    HorizontalPanel minimumClusterSizeHPanel = new HorizontalPanel();
    minimumClusterSizeHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    minimumClusterSizeHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    minimumClusterSizeHPanel.setSpacing(10);
    minimumClusterSizeHPanel.add(minimumClusterSizeSlider);
    minimumClusterSizeHPanel.add(minimumClusterSizeTBox);

    CheckBox enabledCBox = new CheckBox();
    enabledCBox.setValue(true);
    enabledCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            _dataSource.clustering.enabled = valueChangeEvent.getValue();
        }
    });

    CheckBox customStyleCBox = new CheckBox();
    customStyleCBox.setValue(true);
    customStyleCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            customStyle(_dataSource);
        }
    });

    FlexTable flexTable = new FlexTable();
    flexTable.setHTML(1, 0, "<font color=\"white\">Pixel Range</font>");
    flexTable.setWidget(1, 1, pixelRangeHPanel);
    flexTable.setHTML(2, 0, "<font color=\"white\">Minimum Cluster Size</font>");
    flexTable.setWidget(2, 1, minimumClusterSizeHPanel);
    flexTable.setHTML(3, 0, "<font color=\"white\">Enabled</font>");
    flexTable.setWidget(3, 1, enabledCBox);
    flexTable.setHTML(4, 0, "<font color=\"white\">Custom Style</font>");
    flexTable.setWidget(4, 1, customStyleCBox);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(flexTable, 20, 20);

    contentPanel.add(new HTML("<p>Cluster labels, billboards and points.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.GeoJSONAndTopoJSON.java

License:Apache License

@Override
public void buildPanel() {
    csVPanel = new ViewerPanel();

    csVPanel.getViewer().dataSources().removeAll();
    csVPanel.getViewer().camera.lookAt(Cartesian3.fromDegrees(-98.0, 40.0),
            new Cartesian3(0.0, -4790000.0, 3930000.0));
    csVPanel.getViewer().camera.lookAtTransform(Matrix4.IDENTITY());

    Button defaultStylingBtn = new Button("Default styling");
    defaultStylingBtn.addClickHandler(new ClickHandler() {
        @Override//w  w  w.j  a  v  a 2  s.  c  om
        public void onClick(ClickEvent clickEvent) {
            reset();
            csVPanel.getViewer().dataSources().add(
                    GeoJsonDataSource.load(GWT.getModuleBaseURL() + "SampleData/ne_10m_us_states.topojson"));
        }
    });

    Button basicStylingBtn = new Button("Basic styling");
    basicStylingBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            reset();
            GeoJsonDataSourceOptions options = new GeoJsonDataSourceOptions();
            options.stroke = Color.HOTPINK();
            options.fill = Color.DEEPPINK().withAlpha(0.5f);
            options.strokeWidth = 3;
            csVPanel.getViewer().dataSources().add(GeoJsonDataSource
                    .load(GWT.getModuleBaseURL() + "SampleData/ne_10m_us_states.topojson", options));
        }
    });

    Button customStylingBtn = new Button("Custom styling");
    customStylingBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            Math.setRandomNumberSeed(0);

            Promise<GeoJsonDataSource, String> promise = GeoJsonDataSource
                    .load(GWT.getModuleBaseURL() + "SampleData/ne_10m_us_states.topojson");
            promise.then(new Fulfill<GeoJsonDataSource>() {
                @Override
                public void onFulfilled(GeoJsonDataSource dataSource) {
                    reset();
                    csVPanel.getViewer().dataSources().add(dataSource);

                    Entity[] entities = dataSource.entities.values();
                    HashMap<String, Color> colorHash = new HashMap<>();
                    for (int i = 0; i < entities.length; i++) {
                        Entity entity = entities[i];
                        String name = entity.name;
                        Color color = colorHash.get(name);
                        if (color == null) {
                            ColorRandomOptions options = new ColorRandomOptions();
                            options.alpha = 1.0f;
                            color = Color.fromRandom(options);
                            colorHash.put(name, color);
                        }

                        entity.polygon.material = new ColorMaterialProperty(new ConstantProperty<>(color));
                        entity.polygon.outline = new ConstantProperty<>(false);
                        entity.polygon.extrudedHeight = new ConstantProperty<>(
                                JsObject.getObject(entity, "properties").getNumber("Population").doubleValue()
                                        / 50.);
                    }
                }
            }, new Reject<String>() {
                @Override
                public void onRejected(String value) {
                    Window.alert(value);
                }
            });
        }
    });

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(5);
    hPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    hPanel.add(defaultStylingBtn);
    hPanel.add(basicStylingBtn);
    hPanel.add(customStylingBtn);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(hPanel, 20, 20);

    contentPanel.add(new HTML("<p>Load GeoJSON or TopoJSON data and apply custom styling.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}